refactor CI (#6176)

* fix (ci): hotfix Docker release

* test (ci): run full ci  [skip ci]

* change (ci): check stage; add default variables because they were overriden; test-dep-rules goes k8s

* change (ci): move companion job to another stage

* change (ci): no good way to avoid artifacts downloads without dependencies

* fix (ci): typo

* change (ci): all CI images were moved to paritytech registry

* fix (ci): return to the prev image, new needs more testing
This commit is contained in:
Denis Pisarev
2020-06-02 17:23:13 +02:00
committed by GitHub
parent 0eec4bb795
commit ffea161765
+112 -80
View File
@@ -10,7 +10,7 @@
# #
# my-example-job: # my-example-job:
# stage: test # One of the stages listed below this job (required) # stage: test # One of the stages listed below this job (required)
# image: parity/tools:latest # Any docker image (required) # image: paritytech/tools:latest # Any docker image (required)
# allow_failure: true # Allow the pipeline to continue if this job fails (default: false) # allow_failure: true # Allow the pipeline to continue if this job fails (default: false)
# dependencies: # dependencies:
# - build-rust-doc-release # Any jobs that are required to run before this job (optional) # - build-rust-doc-release # Any jobs that are required to run before this job (optional)
@@ -22,6 +22,7 @@
# - ./.maintain/gitlab/my_amazing_script.sh # - ./.maintain/gitlab/my_amazing_script.sh
stages: stages:
- check
- test - test
- build - build
- post-build-test - post-build-test
@@ -29,21 +30,18 @@ stages:
- kubernetes - kubernetes
- flaming-fir - flaming-fir
variables: variables: &default-vars
GIT_STRATEGY: fetch GIT_STRATEGY: fetch
GIT_DEPTH: 100 GIT_DEPTH: 100
SCCACHE_DIR: "/ci-cache/${CI_PROJECT_NAME}/sccache"
CARGO_INCREMENTAL: 0 CARGO_INCREMENTAL: 0
CI_SERVER_NAME: "GitLab CI"
DOCKER_OS: "debian:stretch" DOCKER_OS: "debian:stretch"
ARCH: "x86_64" ARCH: "x86_64"
# FIXME set to release # FIXME set to release
CARGO_UNLEASH_INSTALL_PARAMS: "--version 1.0.0-alpha.10" CARGO_UNLEASH_INSTALL_PARAMS: "--version 1.0.0-alpha.10"
CARGO_UNLEASH_PKG_DEF: "--skip node node-* pallet-template pallet-example pallet-example-* subkey chain-spec-builder" CARGO_UNLEASH_PKG_DEF: "--skip node node-* pallet-template pallet-example pallet-example-* subkey chain-spec-builder"
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER: "wasm-bindgen-test-runner"
WASM_BINDGEN_TEST_TIMEOUT: 120
CHROMEDRIVER_ARGS: "--log-level=INFO --whitelisted-ips=127.0.0.1"
default:
cache: {}
.collect-artifacts: &collect-artifacts .collect-artifacts: &collect-artifacts
artifacts: artifacts:
@@ -77,7 +75,6 @@ variables:
- runner_system_failure - runner_system_failure
- unknown_failure - unknown_failure
- api_failure - api_failure
dependencies: []
interruptible: true interruptible: true
tags: tags:
- linux-docker - linux-docker
@@ -92,7 +89,7 @@ variables:
#### stage: .pre #### stage: .pre
skip-if-draft: skip-if-draft:
image: parity/tools:latest image: paritytech/tools:latest
<<: *kubernetes-build <<: *kubernetes-build
stage: .pre stage: .pre
only: only:
@@ -100,51 +97,53 @@ skip-if-draft:
script: script:
- ./.maintain/gitlab/skip_if_draft.sh - ./.maintain/gitlab/skip_if_draft.sh
#### stage: test #### stage: check
check-runtime: check-runtime:
stage: test stage: check
image: parity/tools:latest image: paritytech/tools:latest
<<: *kubernetes-build <<: *kubernetes-build
only: only:
- /^[0-9]+$/ - /^[0-9]+$/
variables: variables:
<<: *default-vars
GITLAB_API: "https://gitlab.parity.io/api/v4" GITLAB_API: "https://gitlab.parity.io/api/v4"
GITHUB_API_PROJECT: "parity%2Finfrastructure%2Fgithub-api" GITHUB_API_PROJECT: "parity%2Finfrastructure%2Fgithub-api"
script: script:
- ./.maintain/gitlab/check_runtime.sh - ./.maintain/gitlab/check_runtime.sh
interruptible: true
allow_failure: true allow_failure: true
check-signed-tag: check-signed-tag:
stage: test stage: check
image: parity/tools:latest image: paritytech/tools:latest
<<: *kubernetes-build <<: *kubernetes-build
only: only:
- /^ci-release-.*$/ - /^ci-release-.*$/
- /^v[0-9]+\.[0-9]+\.[0-9]+.*$/ - /^v[0-9]+\.[0-9]+\.[0-9]+.*$/
script: script:
- ./.maintain/gitlab/check_signed.sh - ./.maintain/gitlab/check_signed.sh
allow_failure: false
check-line-width: check-line-width:
stage: test stage: check
image: parity/tools:latest image: paritytech/tools:latest
<<: *kubernetes-build <<: *kubernetes-build
only: only:
- /^[0-9]+$/ - /^[0-9]+$/
script: script:
- ./.maintain/gitlab/check_line_width.sh - ./.maintain/gitlab/check_line_width.sh
interruptible: true
allow_failure: true allow_failure: true
check-polkadot-companion-build: test-dependency-rules:
stage: build stage: check
<<: *docker-env image: paritytech/tools:latest
<<: *kubernetes-build
except:
variables:
- $DEPLOY_TAG
script: script:
- ./.maintain/gitlab/check_polkadot_companion_build.sh - .maintain/ensure-deps.sh
interruptible: true
allow_failure: true #### stage: test
cargo-audit: cargo-audit:
stage: test stage: test
@@ -193,9 +192,11 @@ test-linux-stable: &test-linux
stage: test stage: test
<<: *docker-env <<: *docker-env
variables: variables:
<<: *default-vars
# Enable debug assertions since we are running optimized builds for testing # Enable debug assertions since we are running optimized builds for testing
# but still want to have debug assertions. # but still want to have debug assertions.
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
RUST_BACKTRACE: 1
except: except:
variables: variables:
- $DEPLOY_TAG - $DEPLOY_TAG
@@ -203,15 +204,6 @@ test-linux-stable: &test-linux
- WASM_BUILD_NO_COLOR=1 time cargo test --all --release --verbose --locked - WASM_BUILD_NO_COLOR=1 time cargo test --all --release --verbose --locked
- sccache -s - sccache -s
test-dependency-rules:
stage: test
<<: *docker-env
except:
variables:
- $DEPLOY_TAG
script:
- .maintain/ensure-deps.sh
unleash-check: unleash-check:
stage: test stage: test
<<: *docker-env <<: *docker-env
@@ -223,9 +215,11 @@ unleash-check:
- cargo unleash check ${CARGO_UNLEASH_PKG_DEF} - cargo unleash check ${CARGO_UNLEASH_PKG_DEF}
test-frame-staking: test-frame-staking:
# into one job
stage: test stage: test
<<: *docker-env <<: *docker-env
variables: variables:
<<: *default-vars
# Enable debug assertions since we are running optimized builds for testing # Enable debug assertions since we are running optimized builds for testing
# but still want to have debug assertions. # but still want to have debug assertions.
RUSTFLAGS: -Cdebug-assertions=y RUSTFLAGS: -Cdebug-assertions=y
@@ -239,9 +233,11 @@ test-frame-staking:
- sccache -s - sccache -s
test-frame-examples-compile-to-wasm: test-frame-examples-compile-to-wasm:
# into one job
stage: test stage: test
<<: *docker-env <<: *docker-env
variables: variables:
<<: *default-vars
# Enable debug assertions since we are running optimized builds for testing # Enable debug assertions since we are running optimized builds for testing
# but still want to have debug assertions. # but still want to have debug assertions.
RUSTFLAGS: -Cdebug-assertions=y RUSTFLAGS: -Cdebug-assertions=y
@@ -260,6 +256,7 @@ test-wasmtime:
stage: test stage: test
<<: *docker-env <<: *docker-env
variables: variables:
<<: *default-vars
# Enable debug assertions since we are running optimized builds for testing # Enable debug assertions since we are running optimized builds for testing
# but still want to have debug assertions. # but still want to have debug assertions.
RUSTFLAGS: -Cdebug-assertions=y RUSTFLAGS: -Cdebug-assertions=y
@@ -273,9 +270,11 @@ test-wasmtime:
- sccache -s - sccache -s
test-runtime-benchmarks: test-runtime-benchmarks:
# into one job
stage: test stage: test
<<: *docker-env <<: *docker-env
variables: variables:
<<: *default-vars
# Enable debug assertions since we are running optimized builds for testing # Enable debug assertions since we are running optimized builds for testing
# but still want to have debug assertions. # but still want to have debug assertions.
RUSTFLAGS: -Cdebug-assertions=y RUSTFLAGS: -Cdebug-assertions=y
@@ -298,7 +297,8 @@ test-linux-stable-int:
script: script:
- echo "___Logs will be partly shown at the end in case of failure.___" - echo "___Logs will be partly shown at the end in case of failure.___"
- echo "___Full log will be saved to the job artifacts only in case of failure.___" - echo "___Full log will be saved to the job artifacts only in case of failure.___"
- WASM_BUILD_NO_COLOR=1 RUST_LOG=sync=trace,consensus=trace,client=trace,state-db=trace,db=trace,forks=trace,state_db=trace,storage_cache=trace - WASM_BUILD_NO_COLOR=1
RUST_LOG=sync=trace,consensus=trace,client=trace,state-db=trace,db=trace,forks=trace,state_db=trace,storage_cache=trace
time cargo test -p node-cli --release --verbose --locked -- --ignored time cargo test -p node-cli --release --verbose --locked -- --ignored
&> ${CI_COMMIT_SHORT_SHA}_int_failure.log &> ${CI_COMMIT_SHORT_SHA}_int_failure.log
- sccache -s - sccache -s
@@ -334,6 +334,7 @@ test-full-crypto-feature:
stage: test stage: test
<<: *docker-env <<: *docker-env
variables: variables:
<<: *default-vars
# Enable debug assertions since we are running optimized builds for testing # Enable debug assertions since we are running optimized builds for testing
# but still want to have debug assertions. # but still want to have debug assertions.
RUSTFLAGS: -Cdebug-assertions=y RUSTFLAGS: -Cdebug-assertions=y
@@ -350,6 +351,7 @@ test-full-crypto-feature:
cargo-check-macos: cargo-check-macos:
stage: test stage: test
# shell runner on mac ignores the image set in *docker-env
<<: *docker-env <<: *docker-env
script: script:
- BUILD_DUMMY_WASM_BINARY=1 time cargo check --release - BUILD_DUMMY_WASM_BINARY=1 time cargo check --release
@@ -359,12 +361,36 @@ cargo-check-macos:
#### stage: build #### stage: build
check-polkadot-companion-status:
stage: build
image: paritytech/tools:latest
<<: *kubernetes-build
only:
- /^[0-9]+$/ # PRs
script:
- ./.maintain/gitlab/check_polkadot_companion_status.sh
check-polkadot-companion-build:
stage: build
<<: *docker-env
needs:
- job: test-linux-stable-int
artifacts: false
script:
- ./.maintain/gitlab/check_polkadot_companion_build.sh
allow_failure: true
test-browser-node: test-browser-node:
stage: build stage: build
<<: *docker-env <<: *docker-env
needs: needs:
- job: check-web-wasm - job: check-web-wasm
artifacts: false artifacts: false
variables:
<<: *default-vars
CHROMEDRIVER_ARGS: "--log-level=INFO --whitelisted-ips=127.0.0.1"
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER: "wasm-bindgen-test-runner"
WASM_BINDGEN_TEST_TIMEOUT: 120
script: script:
- cargo +nightly test --target wasm32-unknown-unknown -p node-browser-testing -Z features=itarget - cargo +nightly test --target wasm32-unknown-unknown -p node-browser-testing -Z features=itarget
@@ -373,6 +399,9 @@ build-linux-substrate: &build-binary
<<: *collect-artifacts <<: *collect-artifacts
<<: *docker-env <<: *docker-env
<<: *build-only <<: *build-only
needs:
- job: test-linux-stable
artifacts: false
before_script: before_script:
- mkdir -p ./artifacts/substrate/ - mkdir -p ./artifacts/substrate/
except: except:
@@ -398,6 +427,9 @@ build-linux-substrate: &build-binary
build-linux-subkey: &build-subkey build-linux-subkey: &build-subkey
<<: *build-binary <<: *build-binary
needs:
- job: cargo-check-subkey
artifacts: false
before_script: before_script:
- mkdir -p ./artifacts/subkey - mkdir -p ./artifacts/subkey
script: script:
@@ -434,23 +466,16 @@ build-rust-doc-release:
<<: *build-only <<: *build-only
script: script:
- rm -f ./crate-docs/index.html # use it as an indicator if the job succeeds - rm -f ./crate-docs/index.html # use it as an indicator if the job succeeds
- BUILD_DUMMY_WASM_BINARY=1 RUSTDOCFLAGS="--html-in-header $(pwd)/.maintain/rustdoc-header.html" time cargo +nightly doc --release --all --verbose - BUILD_DUMMY_WASM_BINARY=1 RUSTDOCFLAGS="--html-in-header $(pwd)/.maintain/rustdoc-header.html"
time cargo +nightly doc --release --all --verbose
- cp -R ./target/doc ./crate-docs - cp -R ./target/doc ./crate-docs
- echo "<meta http-equiv=refresh content=0;url=sc_service/index.html>" > ./crate-docs/index.html - echo "<meta http-equiv=refresh content=0;url=sc_service/index.html>" > ./crate-docs/index.html
- sccache -s - sccache -s
check-polkadot-companion-status: #### stage: post-build-test
stage: post-build-test
image: parity/tools:latest
<<: *kubernetes-build
only:
- /^[0-9]+$/
script:
- ./.maintain/gitlab/check_polkadot_companion_status.sh
trigger-contracts-ci: trigger-contracts-ci:
stage: publish stage: post-build-test
needs: needs:
- job: build-linux-substrate - job: build-linux-substrate
artifacts: false artifacts: false
@@ -466,12 +491,19 @@ trigger-contracts-ci:
#### stage: publish #### stage: publish
.publish-docker-release: &publish-docker-release .build-push-docker-image: &build-push-docker-image
<<: *build-only <<: *build-only
<<: *kubernetes-build <<: *kubernetes-build
image: docker:stable image: docker:stable
services: services:
- docker:dind - docker:dind
variables: &docker-build-vars
<<: *default-vars
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2
GIT_STRATEGY: none
DOCKERFILE: $PRODUCT.Dockerfile
CONTAINER_IMAGE: parity/$PRODUCT
before_script: before_script:
- test "$Docker_Hub_User_Parity" -a "$Docker_Hub_Pass_Parity" - test "$Docker_Hub_User_Parity" -a "$Docker_Hub_Pass_Parity"
|| ( echo "no docker credentials provided"; exit 1 ) || ( echo "no docker credentials provided"; exit 1 )
@@ -493,18 +525,15 @@ trigger-contracts-ci:
publish-docker-substrate: publish-docker-substrate:
stage: publish stage: publish
<<: *publish-docker-release <<: *build-push-docker-image
# collect VERSION artifact here to pass it on to kubernetes # collect VERSION artifact here to pass it on to kubernetes
<<: *collect-artifacts <<: *collect-artifacts
dependencies: needs:
- build-linux-substrate - job: build-linux-substrate
artifacts: true
variables: variables:
DOCKER_HOST: tcp://localhost:2375 <<: *docker-build-vars
DOCKER_DRIVER: overlay2
GIT_STRATEGY: none
PRODUCT: substrate PRODUCT: substrate
DOCKERFILE: $PRODUCT.Dockerfile
CONTAINER_IMAGE: parity/$PRODUCT
after_script: after_script:
- docker logout - docker logout
# only VERSION information is needed for the deployment # only VERSION information is needed for the deployment
@@ -512,16 +541,13 @@ publish-docker-substrate:
publish-docker-subkey: publish-docker-subkey:
stage: publish stage: publish
<<: *publish-docker-release <<: *build-push-docker-image
dependencies: needs:
- build-linux-subkey - job: build-linux-subkey
artifacts: true
variables: variables:
DOCKER_HOST: tcp://localhost:2375 <<: *docker-build-vars
DOCKER_DRIVER: overlay2
GIT_STRATEGY: none
PRODUCT: subkey PRODUCT: subkey
DOCKERFILE: $PRODUCT.Dockerfile
CONTAINER_IMAGE: parity/$PRODUCT
after_script: after_script:
- docker logout - docker logout
@@ -529,10 +555,12 @@ publish-s3-release:
stage: publish stage: publish
<<: *build-only <<: *build-only
<<: *kubernetes-build <<: *kubernetes-build
dependencies: needs:
- build-linux-substrate - job: build-linux-substrate
- build-linux-subkey artifacts: true
image: parity/awscli:latest - job: build-linux-subkey
artifacts: true
image: paritytech/awscli:latest
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
BUCKET: "releases.parity.io" BUCKET: "releases.parity.io"
@@ -548,11 +576,11 @@ publish-s3-release:
publish-s3-doc: publish-s3-doc:
stage: publish stage: publish
image: parity/awscli:latest image: paritytech/awscli:latest
allow_failure: true allow_failure: true
dependencies: needs:
- build-rust-doc-release - job: build-rust-doc-release
cache: {} artifacts: true
<<: *build-only <<: *build-only
<<: *kubernetes-build <<: *kubernetes-build
variables: variables:
@@ -572,13 +600,12 @@ publish-s3-doc:
publish-draft-release: publish-draft-release:
stage: publish stage: publish
image: parity/tools:latest image: paritytech/tools:latest
only: only:
- /^ci-release-.*$/ - /^ci-release-.*$/
- /^v[0-9]+\.[0-9]+\.[0-9]+.*$/ - /^v[0-9]+\.[0-9]+\.[0-9]+.*$/
script: script:
- ./.maintain/gitlab/publish_draft_release.sh - ./.maintain/gitlab/publish_draft_release.sh
interruptible: true
allow_failure: true allow_failure: true
publish-to-crates-io: publish-to-crates-io:
@@ -590,14 +617,13 @@ publish-to-crates-io:
script: script:
- cargo install cargo-unleash ${CARGO_UNLEASH_INSTALL_PARAMS} - cargo install cargo-unleash ${CARGO_UNLEASH_INSTALL_PARAMS}
- cargo unleash em-dragons --no-check ${CARGO_UNLEASH_PKG_DEF} - cargo unleash em-dragons --no-check ${CARGO_UNLEASH_PKG_DEF}
interruptible: true
allow_failure: true allow_failure: true
.deploy-template: &deploy .deploy-template: &deploy
stage: kubernetes stage: kubernetes
when: manual when: manual
retry: 1 retry: 1
image: parity/kubetools:latest image: paritytech/kubetools:latest
<<: *build-only <<: *build-only
tags: tags:
# this is the runner that is used to deploy it # this is the runner that is used to deploy it
@@ -630,8 +656,9 @@ publish-to-crates-io:
.deploy-cibuild: &deploy-cibuild .deploy-cibuild: &deploy-cibuild
<<: *deploy <<: *deploy
dependencies: needs:
- publish-docker-substrate - job: publish-docker-substrate
artifacts: false
.deploy-tag: &deploy-tag .deploy-tag: &deploy-tag
<<: *deploy <<: *deploy
@@ -662,14 +689,16 @@ deploy-ue1-tag:
name: parity-prod-ue1 name: parity-prod-ue1
.validator-deploy: &validator-deploy .validator-deploy: &validator-deploy
# script will fail if there is no artifacts/substrate/VERSION
<<: *build-only <<: *build-only
stage: flaming-fir stage: flaming-fir
dependencies: needs:
- build-linux-substrate # script will fail if there is no artifacts/substrate/VERSION
- job: publish-docker-substrate
artifacts: true
image: parity/azure-ansible:v1 image: parity/azure-ansible:v1
allow_failure: true allow_failure: true
when: manual when: manual
interruptible: true
tags: tags:
- linux-docker - linux-docker
@@ -677,14 +706,17 @@ validator 1 4:
<<: *validator-deploy <<: *validator-deploy
script: script:
- ./.maintain/flamingfir-deploy.sh flamingfir-validator1 - ./.maintain/flamingfir-deploy.sh flamingfir-validator1
validator 2 4: validator 2 4:
<<: *validator-deploy <<: *validator-deploy
script: script:
- ./.maintain/flamingfir-deploy.sh flamingfir-validator2 - ./.maintain/flamingfir-deploy.sh flamingfir-validator2
validator 3 4: validator 3 4:
<<: *validator-deploy <<: *validator-deploy
script: script:
- ./.maintain/flamingfir-deploy.sh flamingfir-validator3 - ./.maintain/flamingfir-deploy.sh flamingfir-validator3
validator 4 4: validator 4 4:
<<: *validator-deploy <<: *validator-deploy
script: script: