-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
94 lines (86 loc) · 2.46 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stages:
- build_base
- build
- build_singularity
.build base image:
stage: build_base
before_script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor
--context $CI_PROJECT_DIR/base_image
--dockerfile $CI_PROJECT_DIR/base_image/Dockerfile
--destination $CI_REGISTRY_IMAGE:base
--reproducible
needs: []
build base image:master:
extends: .build base image
only:
refs:
- master
- schedules
changes:
- base_image/**/*
build base image:scheduled:
extends: .build base image
only:
refs:
- schedules
build base image:manual:
extends: .build base image
when: manual
resolve singularity:
stage: build_base
image: $CI_REGISTRY/qt-restricted/registry/ci_bot
script:
- python resolve_singularity.py
artifacts:
paths:
- singularity_url
build image:
stage: build
only:
# To ensure that CI_COMMIT_REF_SLUG exists
refs:
- branches
- tags
before_script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- '[[ "$CI_COMMIT_REF_SLUG" == "master" ]] && export CI_REF="latest" || export CI_REF="$CI_COMMIT_REF_SLUG"'
script:
# Copy the CI config so that we can read the job specs from it.
- /kaniko/executor
--context $CI_PROJECT_DIR/main_image
--dockerfile $CI_PROJECT_DIR/main_image/Dockerfile
--destination $CI_REGISTRY_IMAGE:$CI_REF
--build-arg SINGULARITY_URL=$(cat singularity_url)
--reproducible
- /busybox/sed -e "s%{{ docker_container_name }}%$CI_REGISTRY_IMAGE:$CI_REF%g" Singularity.j2 > Singularity
artifacts:
paths:
- Singularity
build singularity image:
stage: build_singularity
image:
name: quay.io/singularity/singularity:v3.5.3
entrypoint: [""]
only:
# To ensure that CI_COMMIT_REF_SLUG exists
refs:
- master@qt/research-docker
- staging@qt/research-docker
before_script:
- mkdir -p build
script:
- cp Singularity build/Singularity
- cd build && /bin/bash ../.ci/build_singularity.sh Singularity
needs: ["build image"]
artifacts:
paths:
- build/Singularity
- build/Singularity.simg