# .gitlab-ci.yml # # cumulus # # pipelines can be triggered manually in the web stages: - test - build - benchmarks-build - benchmarks-run - publish - integration-tests - zombienet default: interruptible: true retry: max: 2 when: - runner_system_failure - unknown_failure - api_failure variables: GIT_STRATEGY: fetch GIT_DEPTH: 100 CARGO_INCREMENTAL: 0 CI_IMAGE: "paritytech/ci-linux:production" DOCKER_OS: "debian:stretch" ARCH: "x86_64" ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.37" .collect-artifacts: artifacts: name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" when: on_success expire_in: 1 days paths: - ./artifacts/ # collecting vars for pipeline stopper # they will be used if the job fails .pipeline-stopper-vars: before_script: - !reference [.job-switcher, before_script] - 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: artifacts: reports: dotenv: pipeline-stopper.env .common-refs: # these jobs run always* rules: - if: $CI_PIPELINE_SOURCE == "schedule" - if: $CI_COMMIT_REF_NAME == "master" - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 - if: $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9].*$/ # i.e. release-parachains-v1.0, release-parachains-v2.1rc1, release-parachains-v3000 - if: $CI_COMMIT_REF_NAME =~ /^polkadot-v[0-9]+\.[0-9]+.*$/ # i.e. polkadot-v1.0.99, polkadot-v2.1rc1 .pr-refs: # these jobs run always* rules: - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs .publish-refs: rules: - if: $CI_COMMIT_REF_NAME == "master" - if: $CI_PIPELINE_SOURCE == "schedule" - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 # run benchmarks manually only on release-parachains-v* branch .benchmarks-manual-refs: rules: - if: $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9].*$/ # i.e. release-parachains-v1.0, release-parachains-v2.1rc1, release-parachains-v3000 when: manual # run benchmarks only on release-parachains-v* branch .benchmarks-refs: rules: - if: $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9].*$/ # i.e. release-parachains-v1.0, release-parachains-v2.1rc1, release-parachains-v3000 .zombienet-refs: rules: - if: $CI_PIPELINE_SOURCE == "pipeline" when: never - if: $CI_PIPELINE_SOURCE == "schedule" when: never - if: $CI_COMMIT_REF_NAME == "master" - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs .job-switcher: before_script: - if echo "$CI_DISABLED_JOBS" | grep -xF "$CI_JOB_NAME"; then echo "The job has been cancelled in CI settings"; exit 0; fi .docker-env: image: "${CI_IMAGE}" before_script: - !reference [.job-switcher, before_script] - rustup show - cargo --version - rustup +nightly show - cargo +nightly --version - bash --version tags: - linux-docker-vm-c2 .kubernetes-env: image: "${CI_IMAGE}" before_script: - !reference [.job-switcher, before_script] tags: - kubernetes-parity-build .git-commit-push: script: - git status # Set git config - rm -rf .git/config - git config --global user.email "${GITHUB_EMAIL}" - git config --global user.name "${GITHUB_USER}" - git config remote.origin.url "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/paritytech/${CI_PROJECT_NAME}.git" - git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" # push results to github - git checkout -b $BRANCHNAME - git add parachains/* - git commit -m "[benchmarks] pr with weights" - git push origin $BRANCHNAME include: # test jobs - scripts/ci/gitlab/pipeline/test.yml # # build jobs - scripts/ci/gitlab/pipeline/build.yml # # benchmarks jobs - scripts/ci/gitlab/pipeline/benchmarks.yml # # publish jobs - scripts/ci/gitlab/pipeline/publish.yml # zombienet jobs - scripts/ci/gitlab/pipeline/zombienet.yml #### stage: .post # This job cancels the whole pipeline if any of provided jobs fail. # In a DAG, every jobs chain is executed independently of others. The `fail_fast` principle suggests # to fail the pipeline as soon as possible to shorten the feedback loop. cancel-pipeline: stage: .post needs: - job: test-linux-stable 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}" FAILED_JOB_URL: "${FAILED_JOB_URL}" FAILED_JOB_NAME: "${FAILED_JOB_NAME}" PR_NUM: "${PR_NUM}" trigger: project: "parity/infrastructure/ci_cd/pipeline-stopper" branch: "as-improve" remove-cancel-pipeline-message: stage: .post rules: - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs variables: PROJECT_ID: "${CI_PROJECT_ID}" PROJECT_NAME: "${CI_PROJECT_NAME}" PIPELINE_ID: "${CI_PIPELINE_ID}" FAILED_JOB_URL: "https://gitlab.com" FAILED_JOB_NAME: "nope" PR_NUM: "${CI_COMMIT_REF_NAME}" trigger: project: "parity/infrastructure/ci_cd/pipeline-stopper"