Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Cai <jcai@gitlab.com>2023-07-18 18:09:41 +0300
committerJohn Cai <jcai@gitlab.com>2023-07-18 23:37:10 +0300
commite65930a7471c1d1074902f022234807bb7a84ccf (patch)
tree48f39d538e949f65a44a87a0ed956c2e82aa9092
parent20cc8073ae695bd3fcc53f35e4460941caa637d9 (diff)
.gitlab-ci.yml: Use an environment to automatically clean up branchesqmnguyen0711/test-rails-job-env
-rw-r--r--.gitlab-ci.yml20
1 files changed, 20 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 64e13fcb0..efe5eb2cd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -528,6 +528,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
@@ -551,6 +554,23 @@ 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: []
+ 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"
+ rules:
+ - when: manual
+ allow_failure: true
build-package-and-qa:
needs: []