Skip to content
Snippets Groups Projects
Commit ae720cdb authored by Lin Jen-Shin's avatar Lin Jen-Shin :two:
Browse files

Move review-stop to the same level as review-start

For review-start the job is called start-review-app-pipeline.

This should move resource_group out of the child pipeline,
making it impossible to deadlock.
parent 78fbe851
No related branches found
No related tags found
1 merge request!111047Move review-stop to the same level as start-review-app-pipeline
......@@ -100,7 +100,7 @@ review-build-cng:
environment:
name: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # No separator for SCHEDULE_TYPE so it's compatible as before and looks nice without it
url: https://gitlab-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}
on_stop: review-stop
on_stop: trigger-review-stop
review-deploy:
extends:
......@@ -173,12 +173,6 @@ review-deploy-sample-projects:
# because some repos are private and CI_JOB_TOKEN cannot access files.
# See https://gitlab.com/gitlab-org/gitlab/issues/191273
GIT_DEPTH: 1
before_script:
- source ./scripts/utils.sh
- source ./scripts/review_apps/review-apps.sh
- !reference [".use-kube-context", before_script]
script:
- retry delete_helm_release
review-delete-deployment:
extends:
......@@ -186,11 +180,23 @@ review-delete-deployment:
- .review:rules:review-delete-deployment
dependencies: []
stage: prepare
before_script:
- source ./scripts/utils.sh
- source ./scripts/review_apps/review-apps.sh
- !reference [".use-kube-context", before_script]
script:
- retry delete_helm_release
review-stop:
trigger-review-stop:
extends:
- .review-stop-base
- .review:rules:review-stop
resource_group: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # CI_ENVIRONMENT_SLUG is not available here and we want this to be the same as the environment
- .review:rules:trigger-review-stop
stage: deploy
needs: []
before_script:
- source ./scripts/utils.sh
- install_gitlab_gem
script:
- review_stop_job_id="$(scripts/api/get_job_id.rb --pipeline-id "${PARENT_PIPELINE_ID}" --job-name "review-stop")"
- |
curl --request POST --header "Private-Token: ${PROJECT_TOKEN_FOR_CI_SCRIPTS_API_USAGE}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${review_stop_job_id}/play"
......@@ -4,9 +4,12 @@ review-cleanup:
- .review:rules:review-cleanup
image: ${REVIEW_APPS_IMAGE}
stage: prepare
needs: []
environment:
name: review/regular-cleanup
action: access
variables:
GIT_DEPTH: 1
before_script:
- source scripts/utils.sh
- !reference [".use-kube-context", before_script]
......@@ -15,6 +18,21 @@ review-cleanup:
script:
- scripts/review_apps/automated_cleanup.rb || (scripts/slack review-apps-monitoring "☠️ \`${CI_JOB_NAME}\` failed! ☠️ See ${CI_JOB_URL} - <https://gitlab.com/gitlab-org/quality/engineering-productivity/team/-/blob/main/runbooks/review-apps.md#review-cleanup-job-failed|📗 RUNBOOK 📕>" warning "GitLab Bot" && exit 1);
review-stop:
extends:
- review-cleanup
- .review:rules:review-stop
environment:
name: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # No separator for SCHEDULE_TYPE so it's compatible as before and looks nice without it
action: stop
resource_group: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # CI_ENVIRONMENT_SLUG is not available here and we want this to be the same as the environment
before_script:
- source ./scripts/utils.sh
- source ./scripts/review_apps/review-apps.sh
- !reference [".use-kube-context", before_script]
script:
- retry delete_helm_release
.base-review-checks:
extends:
- .default-retry
......
......@@ -2060,7 +2060,7 @@
# The following rules needs to be the same as the one for .review:rules:start-review-app-pipeline
# except that:
# - all rules have `when: manual` and `allow_failure: true` here
.review:rules:review-cleanup:
.review:rules:review-stop-merge-requests:
rules:
- <<: *if-not-ee
when: never
......@@ -2097,9 +2097,20 @@
changes: *code-patterns
when: manual
allow_failure: true
.review:rules:review-cleanup:
rules:
- !reference [".review:rules:review-stop-merge-requests", rules]
- <<: *if-dot-com-ee-schedule-default-branch-maintenance
allow_failure: true
.review:rules:review-stop:
rules:
- !reference [".review:rules:review-stop-merge-requests", rules]
- <<: *if-dot-com-gitlab-org-schedule
when: manual
allow_failure: true
.review:rules:review-k8s-resources-count-checks:
rules:
- <<: *if-dot-com-ee-schedule-default-branch-maintenance
......@@ -2118,7 +2129,7 @@
- "scripts/review_apps/gcp-quotas-checks.rb"
allow_failure: true
.review:rules:review-stop:
.review:rules:trigger-review-stop:
rules:
- when: manual
allow_failure: true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment