diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-08-14 09:26:43 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-08-16 10:51:44 +0300 |
commit | dbece80da3c106762416aef2560e592a473f18d2 (patch) | |
tree | 5d9d3dc17f0a1f3cd911dd602f20d94e9e307949 /.gitlab-ci.yml | |
parent | fd65052184bb812c0a909ca1f508d4c4fd0aaafb (diff) |
ci: Provide common dictionary of component versions
We specify about a dozen different versions in our CI definitions, and
many of these versions are repeated in multiple locations. At times,
this makes it hard to update one of these versions while making sure
that all of the places have been updated that should be.
Unfortunately, it is not possible to have YAML anchors that refer to a
single plain string, only. That is, the following is not possible:
```yaml
.versions:
git: "v2.41.0" &version_git
```
We are lucky though, because at GitLab we have noticed that this is
indeed an issue and have introduced the `!reference` extension that is
available in GitLab 13.9 and later. So let's unify all our versions into
a common dictionary so that we can easily reference them. This has two
major advantages, namely that all used versions are defined in a single
spot and that the versions are deduplicated.
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 77dda5aff..8219d54b4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,19 +11,34 @@ default: - saas-linux-large-amd64 interruptible: true +.versions: + debian: "bullseye" + git_default: "default" + git_minimum: "v2.41.0" + gitlab_dangerfiles: "3.1.0" + go_default: "1.20" + go_supported: [ "1.20" ] + macos: "macos-12-xcode-14" + pgbouncer: "1.17.0" + postgres_default: "12-alpine" + postgres_minimum: "11-alpine" + ruby: "3.1" + rust: "1.65" + ubi: "8.6" + variables: FF_USE_FASTZIP: "true" FF_NETWORK_PER_BUILD: "true" - DEBIAN_VERSION: "bullseye" - UBI_VERSION: "8.6" + DEBIAN_VERSION: !reference [.versions, debian] + UBI_VERSION: !reference [.versions, ubi] CACHE_PREFIX: "debian-${DEBIAN_VERSION}" # We use Gitaly's Git version by default. - GIT_VERSION: "default" - GO_VERSION: "1.20" - RUBY_VERSION: "3.1" - RUST_VERSION: "1.65" - POSTGRES_VERSION: "12-alpine" - PGBOUNCER_VERSION: "1.17.0" + GIT_VERSION: !reference [.versions, git_default] + GO_VERSION: !reference [.versions, go_default] + RUBY_VERSION: !reference [.versions, ruby] + RUST_VERSION: !reference [.versions, rust] + POSTGRES_VERSION: !reference [.versions, postgres_default] + PGBOUNCER_VERSION: !reference [.versions, pgbouncer] GOCACHE: "${CI_PROJECT_DIR}/_build/cache/go-build" GOMODCACHE: "${CI_PROJECT_DIR}/_build/cache/go-mod" # We run the build as an untrusted user in a source directory owned by @@ -165,7 +180,7 @@ danger-review: stage: build allow_failure: true variables: - GITLAB_DANGERFILES_VERSION: "3.1.0" + GITLAB_DANGERFILES_VERSION: !reference [.versions, gitlab_dangerfiles] build: needs: [] @@ -184,9 +199,9 @@ build: - go run ./tools/test-boot ${TEST_BOOT_ARGS} parallel: matrix: - - GO_VERSION: [ "1.20" ] + - GO_VERSION: !reference [.versions, go_supported] TEST_BOOT_ARGS: "--bundled-git" - - GIT_VERSION: "v2.41.0" + - GIT_VERSION: !reference [.versions, git_minimum ] build:binaries: needs: [] @@ -207,7 +222,7 @@ build:binaries: expire_in: 6 months parallel: matrix: - - GO_VERSION: [ "1.20" ] + - GO_VERSION: !reference [.versions, go_supported] rules: - if: $CI_COMMIT_TAG @@ -217,18 +232,18 @@ test: matrix: # The following jobs all test with our default Git version, which is # using bundled Git binaries. - - GO_VERSION: [ "1.20" ] + - GO_VERSION: !reference [.versions, go_supported] TEST_TARGET: test - TEST_TARGET: [ test-with-praefect, race-go, test-wal, test-with-praefect-wal] # We also verify that things work as expected with a non-bundled Git # version matching our minimum required Git version. - TEST_TARGET: test - GIT_VERSION: "v2.41.0" + GIT_VERSION: !reference [.versions, git_minimum] # Execute tests with our minimum required Postgres version, as well. If # the minimum version changes, please change this to the new minimum # version. Furthermore, please make sure to update the minimum required # version in `datastore.CheckPostgresVersion()`. - - POSTGRES_VERSION: "11-alpine" + - POSTGRES_VERSION: !reference [.versions, postgres_minimum] TEST_TARGET: [ test, test-with-praefect ] test:pgbouncer: @@ -309,14 +324,14 @@ test:fips: matrix: - TEST_TARGET: [ test, test-with-praefect ] FIPS_MODE: "YesPlease" - GO_VERSION: ["1.20"] + GO_VERSION: !reference [.versions, go_supported] rules: # Automatically run the job when the FIPS label is set. - if: $CI_MERGE_REQUEST_LABELS =~ /FIPS/ - *rules_run_on_merge test:macos: - image: macos-12-xcode-14 + image: !reference [.versions, macos] tags: - saas-macos-medium-m1 needs: [] @@ -328,7 +343,7 @@ test:macos: policy: pull-push variables: <<: *test_variables - CACHE_PREFIX: macos-12-xcode-14 + CACHE_PREFIX: !reference [.versions, macos] # This is required to fix inconsistent deployment targets across CGo and # libgit2. MACOSX_DEPLOYMENT_TARGET: "12.0" |