From 4a9db7dcec9ea94f89a881edf9c693bfbec67d99 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin <jen-shin@gitlab.com> Date: Mon, 30 Oct 2023 17:54:38 +0000 Subject: [PATCH] Run merge requests in Ruby 3.1 by default When label ~"pipeline:run-in-ruby3_0" is provided, run in Ruby 3.0 instead. --- .gitlab-ci.yml | 10 +++++----- .gitlab/ci/cng/main.gitlab-ci.yml | 2 ++ .gitlab/ci/rules.gitlab-ci.yml | 10 ++++++++-- .gitlab/ci/setup.gitlab-ci.yml | 7 ++++--- doc/development/pipelines/index.md | 29 ++++++++++++++++++++--------- 5 files changed, 39 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d7759cdbedc21..ee611d4b92adb 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 d27a4ef4b0874..1ecbbbd47adf7 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 9dc489ab3c4d2..336e2df80f72d 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 b652ac5e30be6..cc5e9bd298523 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 d22c01972f576..77f91300a5744 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 | -- GitLab