Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Automatically format ci pipeline specs with prettier #6783

Merged
merged 2 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.gitlab-ci.yml filter=ci-prettier
/scripts/ci/gitlab/pipeline/*.yml filter=ci-prettier
125 changes: 62 additions & 63 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,38 @@ workflow:
- if: $CI_COMMIT_BRANCH

variables:
GIT_STRATEGY: fetch
GIT_DEPTH: 100
CI_SERVER_NAME: "GitLab CI"
CI_IMAGE: "paritytech/ci-linux:production"
BUILDAH_IMAGE: "quay.io/buildah/stable:v1.27"
DOCKER_OS: "debian:stretch"
ARCH: "x86_64"
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.2.78"
GIT_STRATEGY: fetch
GIT_DEPTH: 100
CI_SERVER_NAME: "GitLab CI"
CI_IMAGE: "paritytech/ci-linux:production"
BUILDAH_IMAGE: "quay.io/buildah/stable:v1.27"
DOCKER_OS: "debian:stretch"
ARCH: "x86_64"
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.2.78"

default:
cache: {}
cache: {}
retry:
max: 2
when:
- runner_system_failure
- unknown_failure
- api_failure
interruptible: true
interruptible: true

.collect-artifacts:
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: on_success
expire_in: 7 days
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
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: on_success
expire_in: 1 days
paths:
- ./artifacts/

Expand All @@ -76,22 +76,22 @@ default:

.pipeline-stopper-artifacts:
artifacts:
reports:
dotenv: pipeline-stopper.env
reports:
dotenv: pipeline-stopper.env

.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

.kubernetes-env:
image: "${CI_IMAGE}"
image: "${CI_IMAGE}"
before_script:
- !reference [.job-switcher, before_script]
tags:
- kubernetes-parity-build

.docker-env:
image: "${CI_IMAGE}"
image: "${CI_IMAGE}"
before_script:
- !reference [.job-switcher, before_script]
tags:
Expand All @@ -108,23 +108,23 @@ default:
- 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 =~ /^[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
- 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
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs

.zombienet-refs:
rules:
Expand All @@ -133,7 +133,7 @@ default:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs

.deploy-testnet-refs:
rules:
Expand All @@ -148,9 +148,9 @@ default:
when: never
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_PIPELINE_SOURCE == "web" &&
$CI_COMMIT_REF_NAME == "master"
$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
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1

.build-push-image:
before_script:
Expand All @@ -162,19 +162,19 @@ default:
- echo "Polkadot version = ${VERSION} (EXTRATAG = ${EXTRATAG})"
script:
- test "$DOCKER_USER" -a "$DOCKER_PASS" ||
( echo "no docker credentials provided"; exit 1 )
( 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} .
--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 login --username "$DOCKER_USER" --password-stdin docker.io
- buildah info
- buildah push --format=v2s2 "$IMAGE_NAME:$VERSION"
- buildah push --format=v2s2 "$IMAGE_NAME:$EXTRATAG"
Expand All @@ -200,50 +200,49 @@ include:
#### stage: .post

deploy-parity-testnet:
stage: .post
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"
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
stage: .post
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- 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}"
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"
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
- 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}"
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"
project: "parity/infrastructure/ci_cd/pipeline-stopper"

cancel-pipeline-test-linux-stable:
extends: .cancel-pipeline-template
extends: .cancel-pipeline-template
needs:
- job: test-linux-stable

- job: test-linux-stable
58 changes: 29 additions & 29 deletions scripts/ci/gitlab/pipeline/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# Here are all jobs that are executed during "build" stage

build-linux-stable:
stage: build
stage: build
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
# the job can be found in check.yml
needs:
- job: job-starter
artifacts: false
- job: job-starter
artifacts: false
extends:
- .docker-env
- .common-refs
Expand Down Expand Up @@ -40,12 +40,12 @@ build-linux-stable:
- cp -r scripts/* ./artifacts

build-test-collators:
stage: build
stage: build
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
# the job can be found in check.yml
needs:
- job: job-starter
artifacts: false
- job: job-starter
artifacts: false
extends:
- .docker-env
- .common-refs
Expand All @@ -65,12 +65,12 @@ build-test-collators:
- cp -r ./scripts/* ./artifacts

build-malus:
stage: build
stage: build
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
# the job can be found in check.yml
needs:
- job: job-starter
artifacts: false
- job: job-starter
artifacts: false
extends:
- .docker-env
- .common-refs
Expand All @@ -87,12 +87,12 @@ build-malus:
- cp -r ./scripts/* ./artifacts

build-staking-miner:
stage: build
stage: build
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
# the job can be found in check.yml
needs:
- job: job-starter
artifacts: false
- job: job-starter
artifacts: false
extends:
- .docker-env
- .common-refs
Expand All @@ -109,23 +109,23 @@ build-staking-miner:
- cp -r ./scripts/* ./artifacts

build-rustdoc:
stage: build
stage: build
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
# the job can be found in test.yml
needs:
- job: test-deterministic-wasm
artifacts: false
- job: test-deterministic-wasm
artifacts: false
extends:
- .docker-env
- .test-refs
variables:
SKIP_WASM_BUILD: 1
SKIP_WASM_BUILD: 1
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}-doc"
when: on_success
expire_in: 1 days
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}-doc"
when: on_success
expire_in: 1 days
paths:
- ./crate-docs/
- ./crate-docs/
script:
# FIXME: it fails with `RUSTDOCFLAGS="-Dwarnings"` and `--all-features`
# FIXME: return to stable when https://github.com/rust-lang/rust/issues/96937 gets into stable
Expand All @@ -137,33 +137,33 @@ build-rustdoc:
- echo "<meta http-equiv=refresh content=0;url=polkadot_service/index.html>" > ./crate-docs/index.html

build-implementers-guide:
stage: build
stage: build
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
# the job can be found in test.yml
needs:
- job: test-deterministic-wasm
artifacts: false
- job: test-deterministic-wasm
artifacts: false
extends:
- .kubernetes-env
- .test-refs
- .collect-artifacts-short
# git depth is set on purpose: https://github.com/paritytech/polkadot/issues/6284
variables:
GIT_STRATEGY: clone
GIT_DEPTH: 0
CI_IMAGE: paritytech/mdbook-utils:e14aae4a-20221123
GIT_STRATEGY: clone
GIT_DEPTH: 0
CI_IMAGE: paritytech/mdbook-utils:e14aae4a-20221123
script:
- mdbook build ./roadmap/implementers-guide
- mkdir -p artifacts
- mv roadmap/implementers-guide/book artifacts/

build-short-benchmark:
stage: build
stage: build
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
# the job can be found in check.yml
needs:
- job: job-starter
artifacts: false
- job: job-starter
artifacts: false
extends:
- .docker-env
- .test-refs
Expand Down
Loading