mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 18:41:03 +00:00
40221806d4
* [ci] Improve pipeline stopper * break test-linux-stable * fix test-linux-stable
252 lines
7.8 KiB
YAML
252 lines
7.8 KiB
YAML
# .gitlab-ci.yml
|
|
#
|
|
# polkadot
|
|
#
|
|
# Pipelines can be triggered manually in the web.
|
|
#
|
|
# Please do not add new jobs without "rules:" and "*-env". There are &test-refs for everything,
|
|
# "docker-env" is used for Rust jobs.
|
|
# And "kubernetes-env" for everything else. Please mention "image:" container name to be used
|
|
# with it, as there's no default one.
|
|
|
|
# All jobs are sorted according to their duration using DAG mechanism
|
|
# Currently, test-linux-stable job is the longest one and other jobs are
|
|
# sorted in order to complete during this job and occupy less runners in one
|
|
# moment of time.
|
|
|
|
stages:
|
|
- weights
|
|
- check
|
|
- test
|
|
- build
|
|
- publish
|
|
- zombienet
|
|
- short-benchmarks
|
|
|
|
workflow:
|
|
rules:
|
|
- if: $CI_COMMIT_TAG
|
|
- if: $CI_COMMIT_BRANCH
|
|
|
|
variables:
|
|
GIT_STRATEGY: fetch
|
|
GIT_DEPTH: 100
|
|
CI_SERVER_NAME: "GitLab CI"
|
|
CI_IMAGE: "paritytech/ci-linux:production"
|
|
DOCKER_OS: "debian:stretch"
|
|
ARCH: "x86_64"
|
|
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.2.78"
|
|
PIPELINE_SCRIPTS_TAG: "v0.4"
|
|
|
|
default:
|
|
cache: {}
|
|
|
|
.collect-artifacts:
|
|
artifacts:
|
|
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
|
|
when: on_success
|
|
expire_in: 7 days
|
|
paths:
|
|
- ./artifacts/
|
|
|
|
.collect-artifacts-short:
|
|
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:
|
|
- 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
|
|
|
|
.kubernetes-env:
|
|
retry:
|
|
max: 2
|
|
when:
|
|
- runner_system_failure
|
|
- unknown_failure
|
|
- api_failure
|
|
interruptible: true
|
|
tags:
|
|
- kubernetes-parity-build
|
|
|
|
.docker-env:
|
|
image: "${CI_IMAGE}"
|
|
retry:
|
|
max: 2
|
|
when:
|
|
- runner_system_failure
|
|
- unknown_failure
|
|
- api_failure
|
|
interruptible: true
|
|
tags:
|
|
- linux-docker
|
|
|
|
.compiler-info:
|
|
before_script:
|
|
- rustup show
|
|
- cargo --version
|
|
- sccache -s
|
|
|
|
.test-refs:
|
|
rules:
|
|
- if: $CI_PIPELINE_SOURCE == "web"
|
|
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
- if: $CI_COMMIT_REF_NAME == "master"
|
|
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
|
|
|
|
.common-refs:
|
|
# these jobs run always*
|
|
rules:
|
|
- if: $CI_PIPELINE_SOURCE == "web"
|
|
- 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-v[0-9]+\.[0-9]+.*$/ # i.e. release-v0.9.27
|
|
|
|
.test-pr-refs:
|
|
rules:
|
|
- if: $CI_PIPELINE_SOURCE == "pipeline"
|
|
when: never
|
|
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
|
|
|
|
.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
|
|
|
|
.deploy-testnet-refs:
|
|
rules:
|
|
- if: $CI_PIPELINE_SOURCE == "pipeline"
|
|
when: never
|
|
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
- if: $CI_COMMIT_REF_NAME == "master"
|
|
|
|
.publish-refs:
|
|
rules:
|
|
- if: $CI_PIPELINE_SOURCE == "pipeline"
|
|
when: never
|
|
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
- if: $CI_PIPELINE_SOURCE == "web" &&
|
|
$CI_COMMIT_REF_NAME == "master"
|
|
- if: $CI_COMMIT_REF_NAME == "master"
|
|
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
|
|
|
|
.build-push-image:
|
|
extends:
|
|
- .kubernetes-env
|
|
image: quay.io/buildah/stable:v1.27
|
|
before_script:
|
|
- test -s ./artifacts/VERSION || exit 1
|
|
- test -s ./artifacts/EXTRATAG || exit 1
|
|
- VERSION="$(cat ./artifacts/VERSION)"
|
|
- EXTRATAG="$(cat ./artifacts/EXTRATAG)"
|
|
- echo "Polkadot version = ${VERSION} (EXTRATAG = ${EXTRATAG})"
|
|
script:
|
|
- test "$DOCKER_USER" -a "$DOCKER_PASS" ||
|
|
( echo "no docker credentials provided"; exit 1 )
|
|
- cd ./artifacts
|
|
- buildah bud
|
|
--format=docker
|
|
--build-arg VCS_REF="${CI_COMMIT_SHA}"
|
|
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
|
|
--build-arg IMAGE_NAME="${IMAGE_NAME}"
|
|
--tag "$IMAGE_NAME:$VERSION"
|
|
--tag "$IMAGE_NAME:$EXTRATAG"
|
|
--file ${DOCKERFILE} .
|
|
# The job will success only on the protected branch
|
|
- echo "$DOCKER_PASS" |
|
|
buildah login --username "$DOCKER_USER" --password-stdin docker.io
|
|
- buildah info
|
|
- buildah push --format=v2s2 "$IMAGE_NAME:$VERSION"
|
|
- buildah push --format=v2s2 "$IMAGE_NAME:$EXTRATAG"
|
|
after_script:
|
|
- buildah logout --all
|
|
|
|
include:
|
|
# weights jobs
|
|
- scripts/ci/gitlab/pipeline/weights.yml
|
|
# check jobs
|
|
- scripts/ci/gitlab/pipeline/check.yml
|
|
# test jobs
|
|
- scripts/ci/gitlab/pipeline/test.yml
|
|
# build jobs
|
|
- scripts/ci/gitlab/pipeline/build.yml
|
|
# short-benchmarks jobs
|
|
- scripts/ci/gitlab/pipeline/short-benchmarks.yml
|
|
# publish jobs
|
|
- scripts/ci/gitlab/pipeline/publish.yml
|
|
# zombienet jobs
|
|
- scripts/ci/gitlab/pipeline/zombienet.yml
|
|
|
|
|
|
|
|
#### stage: .post
|
|
|
|
deploy-parity-testnet:
|
|
stage: .post
|
|
extends:
|
|
- .deploy-testnet-refs
|
|
variables:
|
|
POLKADOT_CI_COMMIT_NAME: "${CI_COMMIT_REF_NAME}"
|
|
POLKADOT_CI_COMMIT_REF: "${CI_COMMIT_SHORT_SHA}"
|
|
allow_failure: false
|
|
trigger: "parity/infrastructure/parity-testnet"
|
|
|
|
# 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-template:
|
|
stage: .post
|
|
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"
|
|
branch: "as-improve"
|
|
|
|
cancel-pipeline-test-linux-stable:
|
|
extends: .cancel-pipeline-template
|
|
needs:
|
|
- job: test-linux-stable
|
|
|