-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
187 lines (176 loc) · 6.58 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
.before-script-build: &before-script-build
- |
if [[ ! -z "$CI_BUILD_PLATFORMS" ]]; then
export OS_ARCH=`echo $CI_BUILD_PLATFORMS | tr ' ' '\n' | \
sed 's|\/||2' | sed 's|\/|-|' | tr '\n' ' '`
fi
- export CI_APP_REPO=${CI_APP_REPO:-$CI_REGISTRY_IMAGE}
- >
echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER
--password-stdin $CI_REGISTRY
.build:
image: glcr.b-data.ch/docker/docker:dind
stage: build
services:
- name: glcr.b-data.ch/docker/docker:dind
alias: docker
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "/certs"
BUILDX_NO_DEFAULT_ATTESTATIONS: "true"
before_script:
- *before-script-build
build:latest-linux-amd64:
extends: .build
tags:
- arch:amd64
- os:linux
script:
- >
docker build
--build-arg IMAGE
--build-arg QGIS_VERSION
-t $CI_APP_REPO/$QGIS_VERSION/$IMAGE-linux-amd64
-t $CI_APP_REPO/latest/$IMAGE-linux-amd64
-f build.Dockerfile .
- |
docker push $CI_APP_REPO/$QGIS_VERSION/$IMAGE-linux-amd64
docker push $CI_APP_REPO/latest/$IMAGE-linux-amd64
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_TRIGGERED && $CI_BUILD_PLATFORMS =~ /(linux\/amd64)/
build:latest-linux-arm64v8:
extends: .build
tags:
- arch:arm64/v8
- os:linux
script:
- >
docker build
--build-arg IMAGE
--build-arg QGIS_VERSION
-t $CI_APP_REPO/$QGIS_VERSION/$IMAGE-linux-arm64v8
-t $CI_APP_REPO/latest/$IMAGE-linux-arm64v8
-f build.Dockerfile .
- |
docker push $CI_APP_REPO/$QGIS_VERSION/$IMAGE-linux-arm64v8
docker push $CI_APP_REPO/latest/$IMAGE-linux-arm64v8
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_TRIGGERED && $CI_BUILD_PLATFORMS =~ /(linux\/arm64\/v8)/
build:ltr-linux-amd64:
extends: .build
tags:
- arch:amd64
- os:linux
script:
- >
docker build
--build-arg IMAGE
--build-arg QGIS_VERSION
-t $CI_APP_REPO/$QGIS_VERSION/$IMAGE-linux-amd64
-t $CI_APP_REPO/ltr/$IMAGE-linux-amd64
-f build.Dockerfile .
- |
docker push $CI_APP_REPO/$QGIS_VERSION/$IMAGE-linux-amd64
docker push $CI_APP_REPO/ltr/$IMAGE-linux-amd64
rules:
- if: $CI_COMMIT_BRANCH == "ltr" && $CI_PIPELINE_TRIGGERED && $CI_BUILD_PLATFORMS =~ /(linux\/amd64)/
build:ltr-linux-arm64v8:
extends: .build
tags:
- arch:arm64/v8
- os:linux
script:
- >
docker build
--build-arg IMAGE
--build-arg QGIS_VERSION
-t $CI_APP_REPO/$QGIS_VERSION/$IMAGE-linux-arm64v8
-t $CI_APP_REPO/ltr/$IMAGE-linux-arm64v8
-f build.Dockerfile .
- |
docker push $CI_APP_REPO/$QGIS_VERSION/$IMAGE-linux-arm64v8
docker push $CI_APP_REPO/ltr/$IMAGE-linux-arm64v8
rules:
- if: $CI_COMMIT_BRANCH == "ltr" && $CI_PIPELINE_TRIGGERED && $CI_BUILD_PLATFORMS =~ /(linux\/arm64\/v8)/
build-manifest:latest-linux-multiarch:
extends: .build
needs: ["build:latest-linux-amd64", "build:latest-linux-arm64v8"]
script:
- |
for i in $OS_ARCH; do
export CI_MANIFEST_LIST="$CI_MANIFEST_LIST $CI_APP_REPO/$QGIS_VERSION/$IMAGE-$i"
export CI_MANIFEST_LIST="$CI_MANIFEST_LIST $CI_APP_REPO/latest/$IMAGE-$i"
done
- |
docker manifest create $CI_APP_REPO/$QGIS_VERSION/$IMAGE $CI_MANIFEST_LIST
if echo $OS_ARCH | grep "linux-arm64v8" >/dev/null ; then
docker manifest annotate --variant v8 $CI_APP_REPO/$QGIS_VERSION/$IMAGE \
$CI_APP_REPO/$QGIS_VERSION/$IMAGE-linux-arm64v8
fi
docker manifest push $CI_APP_REPO/$QGIS_VERSION/$IMAGE
docker manifest create $CI_APP_REPO/latest/$IMAGE $CI_MANIFEST_LIST
if echo $OS_ARCH | grep "linux-arm64v8" >/dev/null ; then
docker manifest annotate --variant v8 $CI_APP_REPO/latest/$IMAGE \
$CI_APP_REPO/latest/$IMAGE-linux-arm64v8
fi
docker manifest push $CI_APP_REPO/latest/$IMAGE
- |
if [[ ! -z "$ADD_IMAGES" ]]; then
for i in $ADD_IMAGES; do
docker manifest create $CI_APP_REPO/$QGIS_VERSION/$i $CI_MANIFEST_LIST
if echo $OS_ARCH | grep "linux-arm64v8" >/dev/null ; then
docker manifest annotate --variant v8 $CI_APP_REPO/$QGIS_VERSION/$i \
$CI_APP_REPO/$QGIS_VERSION/$IMAGE-linux-arm64v8
fi
docker manifest push $CI_APP_REPO/$QGIS_VERSION/$i
docker manifest create $CI_APP_REPO/latest/$i $CI_MANIFEST_LIST
if echo $OS_ARCH | grep "linux-arm64v8" >/dev/null ; then
docker manifest annotate --variant v8 $CI_APP_REPO/latest/$i \
$CI_APP_REPO/latest/$IMAGE-linux-arm64v8
fi
docker manifest push $CI_APP_REPO/latest/$i
done
fi
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_TRIGGERED
build-manifest:ltr-linux-multiarch:
extends: .build
needs: ["build:ltr-linux-amd64", "build:ltr-linux-arm64v8"]
script:
- |
for i in $OS_ARCH; do
export CI_MANIFEST_LIST="$CI_MANIFEST_LIST $CI_APP_REPO/$QGIS_VERSION/$IMAGE-$i"
export CI_MANIFEST_LIST="$CI_MANIFEST_LIST $CI_APP_REPO/ltr/$IMAGE-$i"
done
- |
docker manifest create $CI_APP_REPO/$QGIS_VERSION/$IMAGE $CI_MANIFEST_LIST
if echo $OS_ARCH | grep "linux-arm64v8" >/dev/null ; then
docker manifest annotate --variant v8 $CI_APP_REPO/$QGIS_VERSION/$IMAGE \
$CI_APP_REPO/$QGIS_VERSION/$IMAGE-linux-arm64v8
fi
docker manifest push $CI_APP_REPO/$QGIS_VERSION/$IMAGE
docker manifest create $CI_APP_REPO/ltr/$IMAGE $CI_MANIFEST_LIST
if echo $OS_ARCH | grep "linux-arm64v8" >/dev/null ; then
docker manifest annotate --variant v8 $CI_APP_REPO/ltr/$IMAGE \
$CI_APP_REPO/ltr/$IMAGE-linux-arm64v8
fi
docker manifest push $CI_APP_REPO/ltr/$IMAGE
- |
if [[ ! -z "$ADD_IMAGES" ]]; then
for i in $ADD_IMAGES; do
docker manifest create $CI_APP_REPO/$QGIS_VERSION/$i $CI_MANIFEST_LIST
if echo $OS_ARCH | grep "linux-arm64v8" >/dev/null ; then
docker manifest annotate --variant v8 $CI_APP_REPO/$QGIS_VERSION/$i \
$CI_APP_REPO/$QGIS_VERSION/$IMAGE-linux-arm64v8
fi
docker manifest push $CI_APP_REPO/$QGIS_VERSION/$i
docker manifest create $CI_APP_REPO/ltr/$i $CI_MANIFEST_LIST
if echo $OS_ARCH | grep "linux-arm64v8" >/dev/null ; then
docker manifest annotate --variant v8 $CI_APP_REPO/ltr/$i \
$CI_APP_REPO/ltr/$IMAGE-linux-arm64v8
fi
docker manifest push $CI_APP_REPO/ltr/$i
done
fi
rules:
- if: $CI_COMMIT_BRANCH == "ltr" && $CI_PIPELINE_TRIGGERED