-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
56 lines (48 loc) · 1.92 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
stages:
- build_base
- build_libs
- test
image: docker:latest
services:
- docker:dind
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN scm.cms.hu-berlin.de:4567
# - docker login -u CI_USER -p $CI_USER_TOKEN scm.cms.hu-berlin.de:4567
variables:
# https://about.gitlab.com/blog/2019/07/31/docker-in-docker-with-docker-19-dot-03/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
DOCKER_IMAGE: scm.cms.hu-berlin.de:4567/berlinunited/tools/linuxtoolchain
build_base_image:
# there is a schedule that runs every week and builds the base image
stage: build_base
rules:
- changes:
- Dockerfile.base
- if: '$BUILD_BASE_IMAGE'
script:
- docker build -f Dockerfile.base -t $DOCKER_IMAGE:toolchain_base_image .
- docker push $DOCKER_IMAGE:toolchain_base_image
build_and_deploy:
stage: build_libs
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
- if: '$CI_PIPELINE_SOURCE == "web"'
- if: $CI_COMMIT_BRANCH == "master"
script:
- echo "build and deploy the toolchain"
# getting docker-tag friendly version of the current branch name: replace / with underscore
- branchname=`echo "${CI_COMMIT_REF_NAME}" | sed "s/\//_/g"`
- docker build -t $DOCKER_IMAGE:$branchname .
- docker push $DOCKER_IMAGE:$branchname
build_naoth:
stage: test
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
- if: '$CI_PIPELINE_SOURCE == "web"'
- if: $CI_COMMIT_BRANCH == "master"
script:
- apk add curl
# getting docker-tag friendly version of the current branch name: replace / with underscore
- branchname=`echo "${CI_COMMIT_REF_NAME}" | sed "s/\//_/g"`
- curl --request POST --form token=$build_trigger --form ref=develop --form "variables[TOOLCHAIN_DOCKER_IMAGE]=$DOCKER_IMAGE:$branchname" https://scm.cms.hu-berlin.de/api/v4/projects/3384/trigger/pipeline