Welcome to mirror list, hosted at ThFree Co, Russian Federation.

docker-images.gitlab-ci.yml « ci « .gitlab - gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: af0a16aead0bcfaae93b4bc42b437574ecc19a86 (plain)
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
###############################################
#           Docker images builds              #
###############################################

#
# Reuse some common commands
#
.docker_prepare:
  extends:
    - .retry
  image: "docker:${DOCKER_VERSION}"
  tags:
    - gitlab-org-docker
  services:
    - "docker:${DOCKER_VERSION}-dind"
  before_script:
    - docker info
    - docker context create docs-context
    - docker buildx create --use docs-context
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
  variables:
    DOCKER_TLS_CERTDIR: "/certs"
    DOCKER_VERSION: "24.0.6"

#
# Build and deploy the GitLab Docs base Docker image
#
image:gitlab-docs-base:
  extends:
    - .rules_docker_images
    - .docker_prepare
  stage: build-images
  needs: ["test:image:gitlab-docs-base"]
  variables:
    IMAGE_NAME: $CI_REGISTRY_IMAGE/base:alpine-$ALPINE_VERSION-ruby-$RUBY_VERSION-$CI_COMMIT_SHORT_SHA
    DOCKERFILE: dockerfiles/gitlab-docs-base.Dockerfile
  script:
    - docker buildx build
             --build-arg ALPINE_VERSION=${ALPINE_VERSION}
             --build-arg RUBY_VERSION=${RUBY_VERSION}
             --tag $IMAGE_NAME
             --file $DOCKERFILE .
             --push
  environment:
    name: registry/docs-base

#
# Test the GitLab docs base Docker image if changes are made to its Dockerfile
#
test:image:gitlab-docs-base:
  extends:
    - .docker_prepare
    - .rules_docker_image_tests
  stage: test
  needs: []
  variables:
    IMAGE_NAME: $CI_REGISTRY_IMAGE/base:alpine-$ALPINE_VERSION-ruby-$RUBY_VERSION-$CI_COMMIT_SHORT_SHA
    DOCKERFILE: dockerfiles/gitlab-docs-base.Dockerfile
  script:
    - docker buildx build
             --build-arg ALPINE_VERSION=${ALPINE_VERSION}
             --build-arg RUBY_VERSION=${RUBY_VERSION}
             --tag $IMAGE_NAME
             --file $DOCKERFILE .

#
# Build and deploy the GitLab Docs linting (Markdown) Docker image
#
image:docs-lint-markdown:
  extends:
    - .rules_docker_images
    - .docker_prepare
  stage: build-images
  needs: ["test:image:docs-lint-markdown"]
  variables:
    IMAGE_NAME: $CI_REGISTRY_IMAGE/lint-markdown:alpine-$ALPINE_VERSION-vale-$VALE_VERSION-markdownlint-$MARKDOWNLINT_VERSION-markdownlint2-$MARKDOWNLINT2_VERSION
    DOCKERFILE: dockerfiles/gitlab-docs-lint-markdown.Dockerfile
  script:
    - docker buildx build
             --build-arg ALPINE_VERSION=${ALPINE_VERSION}
             --build-arg VALE_VERSION=${VALE_VERSION}
             --build-arg MARKDOWNLINT_VERSION=${MARKDOWNLINT_VERSION}
             --build-arg MARKDOWNLINT2_VERSION=${MARKDOWNLINT2_VERSION}
             --tag $IMAGE_NAME
             --file $DOCKERFILE .
             --push
  environment:
    name: registry/docs-lint-markdown

#
# Test the GitLab Docs linting (Markdown) Docker image if changes are made to its Dockerfile
#
test:image:docs-lint-markdown:
  extends:
    - .docker_prepare
    - .rules_docker_image_tests
  stage: test
  needs: []
  variables:
    DOCKERFILE: dockerfiles/gitlab-docs-lint-markdown.Dockerfile
  script:
    - docker buildx build
             --build-arg ALPINE_VERSION=${ALPINE_VERSION}
             --build-arg VALE_VERSION=${VALE_VERSION}
             --build-arg MARKDOWNLINT_VERSION=${MARKDOWNLINT_VERSION}
             --build-arg MARKDOWNLINT2_VERSION=${MARKDOWNLINT2_VERSION}
             --file $DOCKERFILE .

#
# Build and deploy the GitLab Docs linting (HTML) Docker image
#
image:docs-lint-html:
  extends:
    - .rules_docker_images
    - .docker_prepare
  stage: build-images
  needs: ["test:image:docs-lint-html"]
  variables:
    IMAGE_NAME: $CI_REGISTRY_IMAGE/lint-html:alpine-$ALPINE_VERSION-ruby-$RUBY_VERSION-$CI_COMMIT_SHORT_SHA
    DOCKERFILE: dockerfiles/gitlab-docs-lint-html.Dockerfile
  script:
    - docker buildx build
             --build-arg RUBY_VERSION=${RUBY_VERSION}
             --build-arg ALPINE_VERSION=${ALPINE_VERSION}
             --tag $IMAGE_NAME
             --file $DOCKERFILE .
             --push
  environment:
    name: registry/docs-lint-html

#
# Test the GitLab Docs linting (HTML) Docker image if changes are made to its Dockerfile
#
test:image:docs-lint-html:
  extends:
    - .docker_prepare
    - .rules_docker_image_tests
  stage: test
  needs: []
  variables:
    DOCKERFILE: dockerfiles/gitlab-docs-lint-html.Dockerfile
  script:
    - docker buildx build
             --build-arg RUBY_VERSION=${RUBY_VERSION}
             --build-arg ALPINE_VERSION=${ALPINE_VERSION}
             --file $DOCKERFILE .

#
# Final Docker image containing a single version
# It is based on single.Dockerfile for each branch
#
image:docs-single:
  tags:
    - saas-linux-medium-amd64
  extends:
    - .docker_prepare
    - .rules_docker_single_images
  stage: pre-deploy
  needs:
    - test:image:docs-single
    - compile_prod
  artifacts: {}
  cache: {}
  dependencies: []
  variables:
    IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
    DOCKERFILE: $CI_COMMIT_REF_NAME.Dockerfile
    NANOC_ENV: production
  environment:
    name: registry/$CI_COMMIT_REF_SLUG
  script:
    - docker buildx build
             --build-arg NANOC_ENV=${NANOC_ENV}
             --build-arg VER=${CI_COMMIT_REF_NAME}
             --build-arg SEARCH_BACKEND="google"
             --build-arg GOOGLE_SEARCH_KEY=${GOOGLE_SEARCH_KEY}
             --tag $IMAGE_NAME
             --file $DOCKERFILE .
             --push

#
# Test the GitLab docs single version Docker image if changes made to its Dockerfile
# We need to specify an output (similar to --push), otherwise the build result
# will only remain in the build cache. We use --load to load the image into
# Docker.
#
test:image:docs-single:
  tags:
    - saas-linux-medium-amd64
  extends:
    - .docker_prepare
    - .rules_docker_single_images_tests
  stage: test
  variables:
    GITLAB_VERSION: '16.8'
    DOCKERFILE: dockerfiles/single.Dockerfile
    IMAGE_NAME: $CI_REGISTRY_IMAGE:$GITLAB_VERSION
    NANOC_ENV: test
  needs: []
  script:
    - docker buildx build
             --build-arg NANOC_ENV=${NANOC_ENV}
             --build-arg VER=${GITLAB_VERSION}
             --build-arg SEARCH_BACKEND="google"
             --tag $IMAGE_NAME
             --file $DOCKERFILE .
             --load
    - version=$(docker run --rm $IMAGE_NAME ls -1 /usr/share/nginx/html/ | grep -v html)
    - echo $version
    - if [ "$version" = "$GITLAB_VERSION" ]; then echo "OK"; else exit 1 ; fi

#
# Final Docker image containing a single version with lunr.js enabled
# It is based on single.Dockerfile for each branch
#
image:docs-single-lunrjs:
  tags:
    - saas-linux-medium-amd64
  extends:
    - .docker_prepare
    - .rules_docker_single_images
  stage: pre-deploy
  needs:
    - test:image:docs-single-lunrjs
    - compile_prod
  artifacts: {}
  cache: {}
  dependencies: []
  variables:
    IMAGE_NAME: $CI_REGISTRY_IMAGE/archives:$CI_COMMIT_REF_NAME
    DOCKERFILE: $CI_COMMIT_REF_NAME.Dockerfile
    NANOC_ENV: production
  environment:
    name: registry-archives/$CI_COMMIT_REF_SLUG
  script:
    - docker buildx build
             --build-arg NANOC_ENV=${NANOC_ENV}
             --build-arg VER=${CI_COMMIT_REF_NAME}
             --build-arg SEARCH_BACKEND="lunr"
             --tag $IMAGE_NAME
             --file $DOCKERFILE .
             --push

#
# Test the GitLab docs single version Docker image with lunr.js enabled
# if changes made to its Dockerfile
#
test:image:docs-single-lunrjs:
  tags:
    - saas-linux-medium-amd64
  extends:
    - .docker_prepare
    - .rules_docker_single_images_tests
  stage: test
  variables:
    GITLAB_VERSION: '16.8'
    IMAGE_NAME: $CI_REGISTRY_IMAGE/archives:$GITLAB_VERSION
    DOCKERFILE: dockerfiles/single.Dockerfile
    NANOC_ENV: test
  needs: []
  script:
    - apk add make bash
    - docker buildx build
             --build-arg NANOC_ENV=${NANOC_ENV}
             --build-arg VER=${GITLAB_VERSION}
             --build-arg SEARCH_BACKEND="lunr"
             --tag $IMAGE_NAME
             --file $DOCKERFILE .
             --load
    - make check-lunr-index

#
# Build master containing the online archives and latest docs (on schedules)
#
image:docs-latest:
  extends:
    - .rules_docker_images
    - .docker_prepare
  stage: build-images
  needs: ["test:image:docs-latest"]
  artifacts: {}
  cache: {}
  dependencies: []
  variables:
    NANOC_ENV: 'production'
    IMAGE_NAME: $CI_REGISTRY_IMAGE:latest
    DOCKERFILE: latest.Dockerfile
  environment:
    name: registry/latest
  script:
    - docker buildx build
             --build-arg NANOC_ENV=${NANOC_ENV}
             --tag $IMAGE_NAME
             --file $DOCKERFILE .
             --push

#
# Test the GitLab docs latest Docker image if changes made to its Dockerfile
# We need to specify an output (similar to --push), otherwise the build result
# will only remain in the build cache. We use --load to load the image into
# Docker.
#
test:image:docs-latest:
  extends:
    - .docker_prepare
    - .rules_docker_image_tests
  stage: test
  variables:
    IMAGE_NAME: $CI_REGISTRY_IMAGE:latest
    DOCKERFILE: latest.Dockerfile
  needs: []
  script:
    - docker buildx build
             --build-arg NANOC_ENV=${NANOC_ENV}
             --tag $IMAGE_NAME
             --file $DOCKERFILE .
             --load
    - docker run --rm $IMAGE_NAME ls -l /usr/share/nginx/html
    - versions_image=$(docker run --rm $IMAGE_NAME ls -1 /usr/share/nginx/html | head -n 3)
    - versions_dockerfile=$(grep COPY latest.Dockerfile | cut -d ' ' -f2 | cut  -d ':' -f2 | sort -u)
    - echo $versions_image
    - echo $versions_dockerfile
    - if [ "$versions_image" = "$versions_dockerfile" ]; then echo "OK"; else echo "Versions mismatch" && exit 1 ; fi

#
# Build the archives image that is deployed at https://archives.docs.gitlab.com
#
image:docs-archives:
  extends:
    - .docker_prepare
    - .rules_docker_images
  needs: ["test:image:docs-archives"]
  stage: build-images
  variables:
    IMAGE_NAME: $CI_REGISTRY_IMAGE/archives:all
    DOCKERFILE: dockerfiles/archives.Dockerfile
  script:
    - docker buildx build -t $IMAGE_NAME -f $DOCKERFILE . --push

#
# Test the GitLab docs archives Docker image if changes made to its Dockerfile
#
test:image:docs-archives:
  extends:
    - .docker_prepare
    - .rules_docker_image_tests
  stage: test
  variables:
    IMAGE_NAME: $CI_REGISTRY_IMAGE/archives:all
    DOCKERFILE: dockerfiles/archives.Dockerfile
  needs: []
  script:
    - docker buildx build -t $IMAGE_NAME -f $DOCKERFILE .

#
# Build the image that is used for the gitlab-docs Workspace
#
image:docs-workspace:
  extends:
    - .docker_prepare
    - .rules_docker_images
  needs: ["test:image:docs-workspace"]
  stage: build-images
  variables:
    IMAGE_NAME: $CI_REGISTRY_IMAGE/workspace
    DOCKERFILE: dockerfiles/gitlab-docs-workspace.Dockerfile
  script:
    - docker buildx build --build-arg ASDF_VERSION=${ASDF_VERSION} -t $IMAGE_NAME -f $DOCKERFILE . --push

#
# Test the GitLab docs workspace Docker image if changes made to its Dockerfile
#
test:image:docs-workspace:
  extends:
    - .docker_prepare
  stage: test
  variables:
    IMAGE_NAME: $CI_REGISTRY_IMAGE/workspace
    DOCKERFILE: dockerfiles/gitlab-docs-workspace.Dockerfile
  needs: []
  script:
    - docker buildx build --build-arg ASDF_VERSION=${ASDF_VERSION} -t $IMAGE_NAME -f $DOCKERFILE .
  rules:
    - if: '$DOCS_PROJECT_PIPELINE_TYPE == "Build docker images pipeline"'
    - if: '$DOCS_PROJECT_PIPELINE_TYPE =~ /^MR pipeline.*/'
      # This image uses asdf to manage dependencies, so run this test if tool versions change.
      changes:
        - .tool-versions
        - $DOCKERFILE