diff options
author | John McDonnell <jmcdonnell@gitlab.com> | 2023-12-07 17:53:11 +0300 |
---|---|---|
committer | John McDonnell <jmcdonnell@gitlab.com> | 2023-12-07 18:33:15 +0300 |
commit | 3b490768c41410d2271d86b6879d8b9a8b519af5 (patch) | |
tree | 8e6e8f03ce9bb29c87dd5f77d166a8b3869b8d4e | |
parent | 094c978014400e933e0a07ad0f4447e287559337 (diff) |
Allow configuring target repo for rails-specsjmd/allow-configurable-project-rails-specs
In some situations we will want to run the rails-specs job against
a repository other than the default gitlab-org/gitlab. Examples of
this may be against security release.
We can allow a default value canbe set, but when the need arises,
an ENV can be set to target the job against the relevant repo.
Fixes https://gitlab.com/gitlab-org/gitaly/-/issues/5727
-rw-r--r-- | .gitlab-ci.yml | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 178c7a3b4..04b8e9f97 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,6 +55,8 @@ variables: # users. TEST_UID: 9999 RAILS_BRANCH_FOR_JOB: "gitaly-ci-jobs-$CI_PIPELINE_IID" + TARGET_GITLAB_ORG_GITLAB_REPO: "$TARGET_GITLAB_ORG_GITLAB_REPO:-gitlab-org/gitlab" + TARGET_GITLAB_RAILS_SPEC_PROJECT: "$TARGET_GITLAB_RAILS_SPEC_PROJECT:-https://gitlab.com/api/v4/projects/278964" include: - template: Security/License-Scanning.gitlab-ci.yml @@ -493,13 +495,13 @@ start-rails-specs: script: - | curl --fail --request POST --header "PRIVATE-TOKEN: $GITLAB_PROJECT_TOKEN" \ - "https://gitlab.com/api/v4/projects/278964/repository/branches?ref=master&branch=$RAILS_BRANCH_FOR_JOB" + "${TARGET_GITLAB_RAILS_SPEC_PROJECT}/repository/branches?ref=master&branch=$RAILS_BRANCH_FOR_JOB" - | curl --fail --request PUT --header "PRIVATE-TOKEN: $GITLAB_PROJECT_TOKEN" \ --data "branch=$RAILS_BRANCH_FOR_JOB" \ --data "content=$CI_COMMIT_SHA" \ --data "commit_message=Updating GITALY_SERVER_VERSION to $CI_COMMIT_SHA" \ - "https://gitlab.com/api/v4/projects/278964/repository/files/GITALY_SERVER_VERSION" + "${TARGET_GITLAB_RAILS_SPEC_PROJECT}/repository/files/GITALY_SERVER_VERSION" environment: name: merge-requests/$RAILS_BRANCH_FOR_JOB on_stop: rails-specs-cleanup @@ -511,7 +513,7 @@ rails-specs: needs: ["start-rails-specs"] stage: qa trigger: - project: gitlab-org/gitlab + project: "${TARGET_GITLAB_ORG_GITLAB_REPO}" branch: "gitaly-ci-jobs-$CI_PIPELINE_IID" # Using $RAILS_BRANCH_FOR_JOB directly fails strategy: depend variables: @@ -527,7 +529,7 @@ rails-specs-cleanup: script: - | curl --fail --request DELETE --header "PRIVATE-TOKEN: $GITLAB_PROJECT_TOKEN" \ - "https://gitlab.com/api/v4/projects/278964/repository/branches/$RAILS_BRANCH_FOR_JOB" + "${TARGET_GITLAB_RAILS_SPEC_PROJECT}/repository/branches/$RAILS_BRANCH_FOR_JOB" environment: name: merge-requests/$RAILS_BRANCH_FOR_JOB action: stop |