From 7ee19559095ad35ea67bad075a70b2cb5eda34a1 Mon Sep 17 00:00:00 2001 From: Alexander Samusev <41779041+alvicsam@users.noreply.github.com> Date: Thu, 11 Aug 2022 08:47:02 +0200 Subject: [PATCH] [ci] improve cancel-pipeline job (#1532) * [ci] improve cancel-pipeline job * fix trigger * fix trigger * add file to trigger * test job fail * fix trigger * fix indent * fix before_script * add comment * remove debuag fail from test-linux-stable --- .gitlab-ci.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1476f03a8e5..9e4b175a53e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,6 +44,19 @@ variables: - cargo +nightly --version - bash --version +# collecting vars for pipeline stopper +# they will be used if the job fails +.pipeline-stopper-vars: &pipeline-stopper-vars + - echo "FAILED_JOB_URL=${CI_JOB_URL}" > pipeline-stopper.env + - echo "FAILED_JOB_NAME=${CI_JOB_NAME}" >> pipeline-stopper.env + - echo "FAILED_JOB_NAME=${CI_JOB_NAME}" >> pipeline-stopper.env + - echo "PR_NUM=${CI_COMMIT_REF_NAME}" >> pipeline-stopper.env + +.pipeline-stopper-artifacts: &pipeline-stopper-artifacts + artifacts: + reports: + dotenv: pipeline-stopper.env + .common-refs: &common-refs # these jobs run always* rules: @@ -88,6 +101,10 @@ test-linux-stable: stage: test <<: *docker-env <<: *common-refs + <<: *pipeline-stopper-artifacts + before_script: + - *rust-info-script + - *pipeline-stopper-vars variables: # Enable debug assertions since we are running optimized builds for testing # but still want to have debug assertions. @@ -355,11 +372,17 @@ cancel-pipeline: stage: .post needs: - job: test-linux-stable - artifacts: false rules: - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs when: on_failure variables: PROJECT_ID: "${CI_PROJECT_ID}" + PROJECT_NAME: "${CI_PROJECT_NAME}" PIPELINE_ID: "${CI_PIPELINE_ID}" - trigger: "parity/infrastructure/ci_cd/pipeline-stopper" + FAILED_JOB_URL: "${FAILED_JOB_URL}" + FAILED_JOB_NAME: "${FAILED_JOB_NAME}" + PR_NUM: "${PR_NUM}" + trigger: + project: "parity/infrastructure/ci_cd/pipeline-stopper" + # remove branch, when pipeline-stopper for substrate and polakdot is updated to the same branch + branch: "as-improve"