diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d7759cdbedc21b55be08c10b69ed740ee6f84e6e..ee611d4b92adb36ff8cac4846ac0d1d0971cd8c9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,15 +64,15 @@ workflow: # they serve no purpose and will run anyway when the changes are merged. - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^release-tools\/\d+\.\d+\.\d+-rc\d+$/ && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^[\d-]+-stable(-ee)?$/ && $CI_PROJECT_PATH == "gitlab-org/gitlab"' when: never - # For merge requests running exclusively in Ruby 3.1 - - if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-in-ruby3_1/' + # For merge requests running exclusively in Ruby 3.0 + - if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-in-ruby3_0/' variables: - <<: *next-ruby-variables + <<: *default-ruby-variables PIPELINE_NAME: 'Ruby $RUBY_VERSION $CI_MERGE_REQUEST_EVENT_TYPE MR pipeline' NO_SOURCEMAPS: 'true' - if: '$CI_MERGE_REQUEST_LABELS =~ /Community contribution/' variables: - <<: *default-ruby-variables + <<: *next-ruby-variables GITLAB_DEPENDENCY_PROXY_ADDRESS: "" PIPELINE_NAME: 'Ruby $RUBY_VERSION $CI_MERGE_REQUEST_EVENT_TYPE MR pipeline (community contribution)' NO_SOURCEMAPS: 'true' @@ -83,7 +83,7 @@ workflow: # For (detached) merge request pipelines. - if: '$CI_MERGE_REQUEST_IID' variables: - <<: *default-ruby-variables + <<: *next-ruby-variables <<: *default-merge-request-slow-tests-variables PIPELINE_NAME: 'Ruby $RUBY_VERSION $CI_MERGE_REQUEST_EVENT_TYPE MR pipeline' NO_SOURCEMAPS: 'true' diff --git a/.gitlab/ci/cng/main.gitlab-ci.yml b/.gitlab/ci/cng/main.gitlab-ci.yml index d27a4ef4b0874a0ff7ae391beb97fd98c56be641..1ecbbbd47adf76bb65a9ca5a7cedf8c690dc4efe 100644 --- a/.gitlab/ci/cng/main.gitlab-ci.yml +++ b/.gitlab/ci/cng/main.gitlab-ci.yml @@ -54,6 +54,8 @@ include: GITLAB_WORKHORSE_VERSION: "${GITLAB_WORKHORSE_VERSION}" GITALY_SERVER_VERSION: "${GITALY_SERVER_VERSION}" RUBY_VERSION: "${FULL_RUBY_VERSION}" + NEXT_RUBY_CACHE_KEY: "${RUBY_VERSION}" + NEXT_RUBY_VERSION: "${FULL_RUBY_VERSION}" trigger: project: ${CI_PROJECT_NAMESPACE}/build/CNG-mirror branch: $TRIGGER_BRANCH diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml index 9dc489ab3c4d20f0f6e10c0be95d2468e52cd9db..336e2df80f72dac2fca3eadba32b6a5ccf45265e 100644 --- a/.gitlab/ci/rules.gitlab-ci.yml +++ b/.gitlab/ci/rules.gitlab-ci.yml @@ -59,9 +59,15 @@ .if-merge-request-targeting-stable-branch: &if-merge-request-targeting-stable-branch if: '($CI_MERGE_REQUEST_EVENT_TYPE == "merged_result" || $CI_MERGE_REQUEST_EVENT_TYPE == "detached") && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^[\d-]+-stable(-ee|-jh)?$/' +.if-merge-request-labels-run-in-ruby3_0: &if-merge-request-labels-run-in-ruby3_0 + if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-in-ruby3_0/' + .if-merge-request-labels-run-in-ruby3_1: &if-merge-request-labels-run-in-ruby3_1 if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-in-ruby3_1/' +.if-merge-request-labels-run-in-non-default-ruby: &if-merge-request-labels-run-in-non-default-ruby + if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-in-ruby3_2/' + .if-merge-request-labels-as-if-foss: &if-merge-request-labels-as-if-foss if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-as-if-foss/' @@ -2738,9 +2744,9 @@ - <<: *if-default-refs changes: *code-backstage-patterns -.setup:rules:verify-ruby-3.0: +.setup:rules:verify-default-ruby: rules: - - <<: *if-merge-request-labels-run-in-ruby3_1 + - <<: *if-merge-request-labels-run-in-non-default-ruby .setup:rules:verify-tests-yml: rules: diff --git a/.gitlab/ci/setup.gitlab-ci.yml b/.gitlab/ci/setup.gitlab-ci.yml index b652ac5e30be6eab8118f0a2d2dd5a8ddfce608c..cc5e9bd2985231b422180b59024d4a8a08d5c00b 100644 --- a/.gitlab/ci/setup.gitlab-ci.yml +++ b/.gitlab/ci/setup.gitlab-ci.yml @@ -51,13 +51,14 @@ gitlab_git_test: script: - spec/support/prepare-gitlab-git-test-for-commit --check-for-changes -verify-ruby-3.0: +verify-default-ruby: extends: - .absolutely-predictive-job - - .setup:rules:verify-ruby-3.0 + - .setup:rules:verify-default-ruby stage: prepare script: - - echo 'Please remove label ~"pipeline:run-in-ruby3_1" so we do test against Ruby 3.0 (default version) before merging the merge request' + - echo 'Please remove label ~"pipeline:run-in-ruby3_2" so we do test against default Ruby version before merging the merge request' + - echo 'This does not work yet. See https://gitlab.com/gitlab-org/gitlab/-/issues/428537' - exit 1 verify-tests-yml: diff --git a/doc/development/pipelines/index.md b/doc/development/pipelines/index.md index d22c01972f57676e80d7b268b0cb7ec0de9c8640..77f91300a5744aa88e2f26eea0d70920649bf835 100644 --- a/doc/development/pipelines/index.md +++ b/doc/development/pipelines/index.md @@ -610,15 +610,26 @@ Exceptions to this general guideline should be motivated and documented. ### Ruby versions testing -We're running Ruby 3.0 on GitLab.com, as well as for merge requests and the default branch. -To prepare for the next release, Ruby 3.1, we also run our test suite against Ruby 3.1 on -a dedicated 2-hourly scheduled pipelines. +We're running Ruby 3.0 on GitLab.com, as well as for the default branch. +To prepare for the next Ruby version, we run merge requests in Ruby 3.1. -For merge requests, you can add the `pipeline:run-in-ruby3_1` label to switch -the Ruby version used for running the whole test suite to 3.1. When you do -this, the test suite will no longer run in Ruby 3.0 (default), and an -additional job `verify-ruby-3.0` will also run and always fail to remind us to -remove the label and run in Ruby 3.0 before merging the merge request. +This takes effects at the time when +[Run merge requests in Ruby 3.1 by default](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/134290) +is merged. See +[Ruby 3.1 epic](https://gitlab.com/groups/gitlab-org/-/epics/10034) +for the roadmap to fully make Ruby 3.1 the default. + +To make sure both Ruby versions are working, we also run our test suite +against both Ruby 3.0 and Ruby 3.1 on dedicated 2-hourly scheduled pipelines. + +For merge requests, you can add the `pipeline:run-in-ruby3_0` label to switch +the Ruby version to 3.0. When you do this, the test suite will no longer run +in Ruby 3.1 (default for merge requests). + +When the pipeline is running in a Ruby version not considered default, an +additional job `verify-default-ruby` will also run and always fail to remind +us to remove the label and run in default Ruby before merging the merge +request. At the moment both Ruby 3.0 and Ruby 3.1 are considered default. This should let us: @@ -638,7 +649,7 @@ We also run our test suite against PostgreSQL 13 upon specific database library | Where? | PostgreSQL version | Ruby version | |--------------------------------------------------------------------------------------------------|-------------------------------------------------|-----------------------| -| Merge requests | 14 (default version), 13 for DB library changes | 3.0 (default version) | +| Merge requests | 14 (default version), 13 for DB library changes | 3.1 | | `master` branch commits | 14 (default version), 13 for DB library changes | 3.0 (default version) | | `maintenance` scheduled pipelines for the `master` branch (every even-numbered hour) | 14 (default version), 13 for DB library changes | 3.0 (default version) | | `maintenance` scheduled pipelines for the `ruby3_1` branch (every odd-numbered hour), see below. | 14 (default version), 13 for DB library changes | 3.1 |