diff options
author | Justin Tobler <jtobler@gitlab.com> | 2023-07-19 23:51:52 +0300 |
---|---|---|
committer | Justin Tobler <jtobler@gitlab.com> | 2023-07-19 23:51:52 +0300 |
commit | 427ec7838b1a63d65a2b37b2f0b862eddbf861ca (patch) | |
tree | 6962d04298bf791a2d8019583a57429a41282f6a /.gitlab-ci.yml | |
parent | 119bc72eed2618fa5fbd21f35c290c6106275301 (diff) | |
parent | 214f41afdaa2f63ba9b3f9a8224282f080f89b0f (diff) |
Merge branch 'jc/rails-job-env' into 'master'
.gitlab-ci.yml: Use environment to clean up branch
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6065
Merged-by: Justin Tobler <jtobler@gitlab.com>
Approved-by: Lin Jen-Shin <jen-shin@gitlab.com>
Approved-by: Justin Tobler <jtobler@gitlab.com>
Reviewed-by: Lin Jen-Shin <jen-shin@gitlab.com>
Reviewed-by: Quang-Minh Nguyen <qmnguyen@gitlab.com>
Co-authored-by: John Cai <jcai@gitlab.com>
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 97258b6ee..b3bf8abc6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -529,6 +529,9 @@ start-rails-specs: --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 + environment: + name: merge-requests/$CI_MERGE_REQUEST_IID + on_stop: rails-specs-cleanup rules: - when: manual allow_failure: true @@ -552,6 +555,20 @@ rails-specs-cleanup: - | curl --request DELETE --header "PRIVATE-TOKEN: $GITLAB_PROJECT_TOKEN" \ "https://gitlab.com/api/v4/projects/278964/repository/branches/$RAILS_BRANCH_FOR_MERGE_REQUEST" + environment: + name: merge-requests/$CI_MERGE_REQUEST_IID + action: stop + +cleanup-rails-spec-test-env: + needs: ["rails-specs-cleanup"] + stage: qa + before_script: + - apt update + - apt install -y jq + script: + - | + ENV_ID=$(curl -s --request GET --header "PRIVATE-TOKEN: $GITALY_PROJECT_TOKEN" "https://gitlab.com/api/v4/projects/2009901/environments?name=merge-requests%2F$CI_MERGE_REQUEST_IID" | jq '.[0].id') + curl -s --request DELETE --header "PRIVATE-TOKEN: $GITALY_PROJECT_TOKEN" "https://gitlab.com/api/v4/projects/2009901/environments/$ENV_ID" build-package-and-qa: needs: [] |