Skip to content

Commit f37c7b6

Browse files
committed
Use runner base images
1 parent 55bc4d0 commit f37c7b6

File tree

89 files changed

+1549
-4283
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1549
-4283
lines changed

.gitlab-ci.yml

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
stages:
2-
- prepare
3-
- fips helper binaries
4-
- prebuild
5-
- prerelease
2+
- build
3+
- qa
64
- test
75
- test kubernetes integration
86
- coverage
9-
- build
107
- package
118
- release
129
- postrelease
@@ -15,18 +12,17 @@ stages:
1512
include:
1613
- local: /.gitlab/ci/_common.gitlab-ci.yml
1714
- local: /.gitlab/ci/_rules.gitlab-ci.yml
18-
- local: /.gitlab/ci/prepare.gitlab-ci.yml
19-
- local: /.gitlab/ci/fips-helper-binaries.gitlab-ci.yml
20-
- local: /.gitlab/ci/prebuild.gitlab-ci.yml
21-
- local: /.gitlab/ci/prerelease.gitlab-ci.yml
15+
- local: /.gitlab/ci/build.gitlab-ci.yml
16+
- local: /.gitlab/ci/qa.gitlab-ci.yml
2217
- local: /.gitlab/ci/test.gitlab-ci.yml
2318
- local: /.gitlab/ci/test-kubernetes-integration.gitlab-ci.yml
2419
- local: /.gitlab/ci/coverage.gitlab-ci.yml
25-
- local: /.gitlab/ci/build.gitlab-ci.yml
2620
- local: /.gitlab/ci/package.gitlab-ci.yml
2721
- local: /.gitlab/ci/release.gitlab-ci.yml
2822
- local: /.gitlab/ci/postrelease.gitlab-ci.yml
2923
- local: /.gitlab/ci/docs.gitlab-ci.yml
3024
- component: ${CI_SERVER_FQDN}/gitlab-org/components/danger-review/[email protected]
25+
inputs:
26+
job_stage: qa
3127
rules:
32-
- if: '$CI_SERVER_HOST == "gitlab.com"'
28+
- if: '$CI_SERVER_HOST == "gitlab.com"'

.gitlab/ci/_common.gitlab-ci.yml

+10-37
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,18 @@ variables:
33
# When updating GO_VERSION, update Go versions in docs/development/index.md
44
# or the 'docs:check development docs Go version' job will fail
55
GO_VERSION: "1.23.2"
6-
# ubi version for go.fips image base (see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/38034)
7-
GO_FIPS_UBI_VERSION: "ubi8"
8-
# Sometimes the FIPS repo lags behind the official releases
9-
GO_FIPS_VERSION: "1.23.2"
10-
# Account for the suffix used in https://github.com/golang-fips/go/releases/tag/go1.23.2-2-openssl-fips
11-
GO_FIPS_VERSION_SUFFIX: "-1-openssl-fips"
12-
GO_CI_IMAGE: "$GO_VERSION-bookworm"
13-
CI_IMAGE: "registry.gitlab.com/gitlab-org/gitlab-runner/ci:$GO_CI_IMAGE-1"
6+
RUNNER_IMAGES_REGISTRY: registry.gitlab.com/gitlab-org/ci-cd/runner-tools/base-images
7+
RUNNER_IMAGES_VERSION: "0.0.1"
8+
RUNNER_IMAGES_WINDOWS_GO_URL: https://gitlab.com/api/v4/projects/gitlab-org%2fci-cd%2frunner-tools%2fbase-images/packages/generic/runner-images/v${RUNNER_IMAGES_VERSION}/golang-windows-amd64.zip
9+
CI_IMAGE: "${RUNNER_IMAGES_REGISTRY}/ci:${RUNNER_IMAGES_VERSION}"
1410
# Feature flags
1511
FF_SCRIPT_SECTIONS: "true"
1612
FF_USE_FASTZIP: "true"
1713
FF_USE_NEW_BASH_EVAL_STRATEGY: "true"
1814
FF_TIMESTAMPS: "true"
1915
# Following variables are used in some jobs to install specified software
2016
RELEASE_INDEX_GEN_VERSION: "latest"
21-
DOCKER_VERSION: 24.0.5
22-
DOCKER_MACHINE_VERSION: "v0.16.2-gitlab.30"
23-
BUILDX_VERSION: 0.10.4
24-
KUBECTL_VERSION: 1.23.0
25-
AWS_CLI_VERSION: 2.4.19
26-
GIT_VERSION: "2.40.1"
27-
GIT_VERSION_BUILD: "1"
28-
GIT_LFS_VERSION: "3.5.1"
29-
YQ_VERSION: "4.30.5"
17+
DOCKER_VERSION: 27.3.1
3018
LICENSE_MANAGEMENT_SETUP_CMD: echo "Skip setup. Dependency already vendored"
3119
DOCS_GITLAB_REPO_SUFFIX: "runner"
3220
# We're overriding rules for the jobs that we want to run.
@@ -35,26 +23,7 @@ variables:
3523
TRANSFER_METER_FREQUENCY: "5s"
3624
CACHE_COMPRESSION_FORMAT: tarzstd
3725
GO111MODULE: "on"
38-
GO_FIPS_IMAGE: registry.gitlab.com/gitlab-org/gitlab-runner/go-fips:$GO_FIPS_VERSION-$GO_FIPS_UBI_VERSION
39-
# Leaving the Alpine and UBI versions defined here until the renovate pattern is changed
40-
# to recognize the definitions as a Go variable
41-
# renovate: datasource=docker depName=alpine allowedVersions=/3\.18\..+/
42-
ALPINE_318_VERSION: "3.18.9"
43-
# renovate: datasource=docker depName=alpine allowedVersions=/3\.19\..+/
44-
ALPINE_319_VERSION: "3.19.4"
45-
# renovate: datasource=docker depName=alpine allowedVersions=/3\.21\..+/
46-
ALPINE_321_VERSION: "3.21.0"
47-
# renovate: datasource=docker depName=ubuntu allowedVersions=/20\..+/
48-
UBUNTU_VERSION: "20.04"
49-
# renovate: datasource=docker depName=redhat/ubi9-micro versioning=redhat allowedVersions=/9\.5-[0-9]+/
50-
UBI_MICRO_VERSION: "9.5-1731934928"
51-
UBI_MICRO_IMAGE: redhat/ubi9-micro
52-
# renovate: datasource=docker depName=redhat/ubi9-minimal versioning=redhat allowedVersions=/9\.5-[0-9]+/
53-
UBI_MINIMAL_VERSION: "9.5-1731604394"
54-
UBI_MINIMAL_IMAGE: redhat/ubi9-minimal
55-
UBI_FIPS_BASE_IMAGE: registry.gitlab.com/gitlab-org/gitlab-runner/ubi-fips-base
56-
## Note: UBI_FIPS_VERSION=$UBI_MICRO_VERSION, post conversion to ubi-micro
57-
UBI_FIPS_VERSION: "$UBI_MICRO_VERSION"
26+
# renovate: datasource=docker depName=redhat/ubi9-micro versioning=redhat allowedVersions=/9\.4-[0-9]+/
5827
PACKAGES_ITERATION: "1"
5928

6029
default:
@@ -85,8 +54,10 @@ default:
8554
tags:
8655
- gitlab-org-docker
8756

57+
8858
.go-cache:
8959
variables:
60+
GODEBUG: gocachetest=1
9061
GOCACHE: $CI_PROJECT_DIR/.gocache-$CI_COMMIT_REF_PROTECTED
9162
before_script:
9263
- mkdir -p "$GOCACHE"
@@ -98,9 +69,11 @@ default:
9869

9970
.go-cache-windows:
10071
variables:
72+
GODEBUG: gocachetest=1
10173
GOCACHE: $CI_PROJECT_DIR\.gocache-$CI_COMMIT_REF_PROTECTED
10274
before_script:
10375
- New-Item -Path "$Env:GOCACHE" -Type Directory -Force
76+
- $env:GOCACHE = (Resolve-Path $env:GOCACHE).Path
10477
- ./ci/touch_git.ps1
10578
cache:
10679
paths:

.gitlab/ci/_rules.gitlab-ci.yml

+2-60
Original file line numberDiff line numberDiff line change
@@ -228,69 +228,11 @@
228228
- <<: *if-runner-merge-request-pipeline
229229
changes: *code-backstage-patterns
230230

231-
.rules:prepare:ci:image:merge-requests:
231+
.rules:build:test:images:merge-requests:
232232
rules:
233233
- <<: *if-runner-merge-request-pipeline
234234
changes:
235-
- dockerfiles/ci/Dockerfile
236-
- dockerfiles/ci/Dockerfile.rebuild
237-
- .gitlab/ci/_common.gitlab-ci.yml
238-
- .gitlab/ci/prepare.gitlab-ci.yml
239-
240-
.rules:prepare:alpine-no-root:image:merge-requests:
241-
rules:
242-
- <<: *if-runner-merge-request-pipeline
243-
changes:
244-
- tests/dockerfiles/alpine-no-root/*
245-
- .gitlab/ci/prepare.gitlab-ci.yml
246-
247-
.rules:prepare:alpine-entrypoint:image:merge-requests:
248-
rules:
249-
- <<: *if-runner-merge-request-pipeline
250-
changes:
251-
- tests/dockerfiles/alpine-entrypoint/*
252-
- .gitlab/ci/prepare.gitlab-ci.yml
253-
254-
.rules:prepare:powershell-entrypoint:image:merge-requests:
255-
rules:
256-
- <<: *if-runner-merge-request-pipeline
257-
changes:
258-
- tests/dockerfiles/powershell-entrypoint/*
259-
- .gitlab/ci/prepare.gitlab-ci.yml
260-
261-
.rules:prepare:alpine-id-overflow:image:merge-requests:
262-
rules:
263-
- <<: *if-runner-merge-request-pipeline
264-
changes:
265-
- tests/dockerfiles/alpine-id-overflow/*
266-
- .gitlab/ci/prepare.gitlab-ci.yml
267-
268-
.rules:prepare:go-fips:image:merge-requests:
269-
rules:
270-
- <<: *if-runner-merge-request-pipeline
271-
changes:
272-
- dockerfiles/ci/go.fips.Dockerfile
273-
- dockerfiles/ci/go.fips.Dockerfile.rebuild
274-
- dockerfiles/ci/ubi.fips.base.Dockerfile
275-
- dockerfiles/ci/ubi.fips.base.Dockerfile.rebuild
276-
- .gitlab/ci/prepare.gitlab-ci.yml
277-
- .gitlab/ci/_common.gitlab-ci.yml
278-
279-
.rules:prepare:ubi-base:image:merge-requests:
280-
rules:
281-
- <<: *if-runner-merge-request-pipeline
282-
changes:
283-
- dockerfiles/ci/ubi.fips.base.Dockerfile
284-
- dockerfiles/ci/ubi.fips.base.Dockerfile.rebuild
285-
- .gitlab/ci/prepare.gitlab-ci.yml
286-
- .gitlab/ci/_common.gitlab-ci.yml
287-
288-
.rules:prepare:gitlab-runner-helper-entrypoint:image:merge-requests:
289-
rules:
290-
- <<: *if-runner-merge-request-pipeline
291-
changes:
292-
- tests/dockerfiles/gitlab-runner-helper-entrypoint/*
293-
- .gitlab/ci/prepare.gitlab-ci.yml
235+
- tests/dockerfiles/*
294236

295237
.rules:prepare:test-ci-scripts:merge-requests:
296238
rules:

.gitlab/ci/build.gitlab-ci.yml

+100-26
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,119 @@
1-
binaries:
1+
helper images:
2+
tags:
3+
- saas-linux-2xlarge-amd64
24
extends:
5+
- .docker
36
- .rules:merge_request_pipelines:no_docs
4-
- .go-cache
57
stage: build
68
needs:
7-
- 'prepare done'
9+
- 'binaries'
810
script:
9-
- make runner-bin BUILD_PLATFORMS="-osarch='$PLATFORMS'"
11+
- ./ci/touch_git
12+
- make helper-images
13+
- ls -alh out/helper-images/
14+
retry: 2
1015
artifacts:
1116
paths:
12-
- out/binaries/gitlab-runner-*
13-
exclude:
14-
- out/binaries/gitlab-runner-helper/
17+
- out/helper-images/
1518
expire_in: 7d
1619
parallel:
1720
matrix:
18-
- PLATFORMS:
19-
- linux/amd64 linux/arm64 #64bit
20-
- linux/386 linux/arm #32bit
21-
- linux/s390x linux/ppc64le #ibm
22-
- linux/riscv64 #riscv
23-
- darwin/amd64 darwin/arm64
24-
- freebsd/386 freebsd/amd64 freebsd/arm
25-
- windows/386 windows/amd64
21+
- TARGETS:
22+
- alpine alpine-pwsh ubuntu ubuntu-pwsh ubi-fips
23+
- windows-nanoserver-ltsc2019 windows-servercore-ltsc2019
24+
- windows-nanoserver-ltsc2022 windows-servercore-ltsc2022
2625

27-
binaries-fips:
26+
prebuilt helper images:
27+
tags:
28+
- saas-linux-2xlarge-amd64
2829
extends:
30+
- .docker
2931
- .rules:merge_request_pipelines:no_docs
30-
- .go-cache
3132
stage: build
32-
image: $GO_FIPS_IMAGE
33+
image: "${RUNNER_IMAGES_REGISTRY}/ci:${RUNNER_IMAGES_VERSION}-prebuilt-images"
3334
needs:
34-
- job: 'prepare go fips'
35-
optional: true
35+
- 'helper images: [alpine alpine-pwsh ubuntu ubuntu-pwsh ubi-fips]'
3636
script:
37-
- make runner-bin-fips GOOS=$GOOS GOARCH=$GOARCH
37+
- apt-get update -yq && apt-get install -yq parallel time p7zip-full
38+
- make prebuilt-helper-images
39+
- ls -alh out/helper-images/
3840
artifacts:
3941
paths:
40-
- out/binaries/gitlab-runner-*
42+
- out/helper-images/*.tar.xz
4143
expire_in: 7d
42-
parallel:
43-
matrix:
44-
- GOOS: linux
45-
GOARCH: amd64
44+
45+
runner images:
46+
tags:
47+
- saas-linux-2xlarge-amd64
48+
extends:
49+
- .docker
50+
- .rules:merge_request_pipelines:no_docs
51+
stage: build
52+
needs:
53+
- 'binaries'
54+
script:
55+
- ./ci/touch_git
56+
- TARGETS="ubuntu alpine ubi-fips" make runner-images
57+
- ls -alh out/runner-images/
58+
retry: 2
59+
artifacts:
60+
paths:
61+
- out/runner-images/
62+
expire_in: 7d
63+
64+
test images:
65+
extends:
66+
- .docker
67+
- .rules:build:test:images:merge-requests
68+
stage: build
69+
needs:
70+
- 'binaries'
71+
script:
72+
- docker buildx create --name builder --use --driver docker-container default || true
73+
- echo "${CI_REGISTRY_PASSWORD}" | docker login --username "${CI_REGISTRY_USER}" --password-stdin "${CI_REGISTRY}"
74+
- cd tests/dockerfiles && docker buildx bake --progress plain tests-images --set *.output="type=registry,compression=zstd"
75+
- docker logout "${CI_REGISTRY}"
76+
77+
binaries:
78+
image: "${RUNNER_IMAGES_REGISTRY}/ubi-go:${RUNNER_IMAGES_VERSION}"
79+
tags:
80+
- saas-linux-2xlarge-amd64
81+
extends:
82+
- .rules:merge_request_pipelines:no_docs
83+
- .go-cache
84+
stage: build
85+
needs: []
86+
script:
87+
- go mod download
88+
- make -j$(($(nproc) * 2)) helper-bin helper-bin-fips runner-bin runner-bin-fips
89+
artifacts:
90+
paths:
91+
- out/binaries/gitlab-runner*
92+
expire_in: 7d
93+
94+
clone test repo:
95+
extends:
96+
- .rules:merge_request_pipelines:no_docs
97+
- .no_cache_and_dependencies
98+
stage: build
99+
image: alpine:latest
100+
needs: []
101+
variables:
102+
GIT_STRATEGY: none
103+
script:
104+
- apk add git
105+
- mkdir tmp
106+
- succeed=0
107+
- for i in {1..3}; do git clone https://gitlab.com/gitlab-org/ci-cd/gitlab-runner-pipeline-tests/gitlab-test tmp/gitlab-test && succeed=1 && break; echo "retrying"; done
108+
- '[[ "$succeed" -eq 1 ]]'
109+
artifacts:
110+
paths:
111+
- tmp/gitlab-test
112+
expire_in: 7d
113+
114+
# prepare done is used as a sentinel for "Prepare" stage completion, so we can kick off builds in later stages
115+
# without waiting for the completion of the Prebuild stage
116+
prepare done:
117+
stage: build
118+
extends:
119+
- .stage_done

0 commit comments

Comments
 (0)