diff options
author | John Cai <jcai@gitlab.com> | 2023-06-16 22:37:53 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2023-07-10 22:36:54 +0300 |
commit | 9b1ef44c4f46e7e79658bb0bac0d65bee40ad45a (patch) | |
tree | a50fa42c5ecdc239777d841c6135b22e098ccc9d | |
parent | 92e441aabf41c0793da9cb0ea1be58175f990f80 (diff) |
.gitlab-ci.yml: Add rails job
Adding a job to run the full rails suite of tests. This allows
developers to trigger the job to see if their changes pass the rails
test suite.
We have three jobs to accomplish this. First, start-rails-specs will
create a branch and modify the GITALY_SERVER_VERSION on it. Then,
rails-specs will run the Rails test suite on that branch. Finally,
rails-specs-cleanup will delete that branch.
-rw-r--r-- | .gitlab-ci.yml | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 02d6550dd..80af9ef9a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -39,6 +39,7 @@ variables: # chosen as a semi-random value so as to not interfer with any preexisting # users. TEST_UID: 9999 + RAILS_BRANCH_FOR_MERGE_REQUEST: "gitaly-merge-requests-$CI_MERGE_REQUEST_IID" include: - template: Security/License-Scanning.gitlab-ci.yml @@ -514,6 +515,45 @@ pages: rules: - *rules_run_on_merge +start-rails-specs: + needs: [] + stage: qa + script: + - | + curl --request POST --header "PRIVATE-TOKEN: $GITLAB_PROJECT_TOKEN" \ + "https://gitlab.com/api/v4/projects/278964/repository/branches?branch=$RAILS_BRANCH_FOR_MERGE_REQUEST&ref=master" + - | + curl --request PUT --header "PRIVATE-TOKEN: $GITLAB_PROJECT_TOKEN" \ + --data "branch=$RAILS_BRANCH_FOR_MERGE_REQUEST" \ + --data "content=$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA" \ + --data "commit_message=Updating GITALY_SERVER_VERSION to $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA" \ + https://gitlab.com/api/v4/projects/278964/repository/files/GITALY_SERVER_VERSION + rules: + - *rules_run_on_merge + +rails-specs: + needs: ["start-rails-specs"] + stage: qa + trigger: + project: gitlab-org/gitlab + branch: "gitaly-merge-requests-$CI_MERGE_REQUEST_IID" + strategy: depend + variables: + GITALY_TEST: "true" + FORCE_GITLAB_CI: "true" + rules: + - allow_failure: true + +rails-specs-cleanup: + stage: qa + needs: ["rails-specs"] + script: + - | + curl --request DELETE --header "PRIVATE-TOKEN: $GITLAB_PROJECT_TOKEN" \ + "https://gitlab.com/api/v4/projects/278964/repository/branches/$RAILS_BRANCH_FOR_MERGE_REQUEST" + rules: + - allow_failure: true + build-package-and-qa: needs: [] stage: qa |