Automatically format ci pipeline specs with prettier (#13441)

* [ci] Deduplicate variables: sections in pipeline specs

The prettier yaml parser doesn't like these.

* [ci] provide git clean filter to format pipeline specs

* [ci] Reformat pipeline specs with prettier
This commit is contained in:
Mira Ressel
2023-02-24 16:02:30 +01:00
committed by GitHub
parent 941288c6d0
commit 84638524e7
8 changed files with 396 additions and 396 deletions
@@ -1,16 +1,15 @@
# This file is part of .gitlab-ci.yml
# Here are all jobs that are executed during "publish" stage
.build-push-docker-image-common:
extends:
- .kubernetes-env
stage: publish
stage: publish
variables:
CI_IMAGE: $BUILDAH_IMAGE
GIT_STRATEGY: none
DOCKERFILE: $PRODUCT.Dockerfile
IMAGE_NAME: docker.io/$IMAGE_PATH
CI_IMAGE: $BUILDAH_IMAGE
GIT_STRATEGY: none
DOCKERFILE: $PRODUCT.Dockerfile
IMAGE_NAME: docker.io/$IMAGE_PATH
before_script:
- !reference [.kubernetes-env, before_script]
- cd ./artifacts/$PRODUCT/
@@ -19,17 +18,17 @@
- test -z "${VERSION}" && exit 1
script:
- test "$DOCKER_USER" -a "$DOCKER_PASS" ||
( echo "no docker credentials provided"; exit 1 )
( echo "no docker credentials provided"; exit 1 )
- 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_PATH}"
--tag "$IMAGE_NAME:$VERSION"
--tag "$IMAGE_NAME:latest"
--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_PATH}"
--tag "$IMAGE_NAME:$VERSION"
--tag "$IMAGE_NAME:latest"
--file "$DOCKERFILE" .
- 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:latest"
@@ -45,25 +44,25 @@
- .publish-refs
- .build-push-docker-image-common
variables:
IMAGE_PATH: parity/$PRODUCT
DOCKER_USER: $Docker_Hub_User_Parity
DOCKER_PASS: $Docker_Hub_Pass_Parity
IMAGE_PATH: parity/$PRODUCT
DOCKER_USER: $Docker_Hub_User_Parity
DOCKER_PASS: $Docker_Hub_Pass_Parity
.push-docker-image-description:
stage: publish
stage: publish
extends:
- .kubernetes-env
- .publish-refs
variables:
CI_IMAGE: paritytech/dockerhub-description
DOCKERHUB_REPOSITORY: parity/$PRODUCT
DOCKER_USERNAME: $Docker_Hub_User_Parity
DOCKER_PASSWORD: $Docker_Hub_Pass_Parity
README_FILEPATH: $CI_PROJECT_DIR/scripts/ci/docker/$PRODUCT.Dockerfile.README.md
CI_IMAGE: paritytech/dockerhub-description
DOCKERHUB_REPOSITORY: parity/$PRODUCT
DOCKER_USERNAME: $Docker_Hub_User_Parity
DOCKER_PASSWORD: $Docker_Hub_Pass_Parity
README_FILEPATH: $CI_PROJECT_DIR/scripts/ci/docker/$PRODUCT.Dockerfile.README.md
rules:
- if: $CI_COMMIT_REF_NAME == "master"
changes:
- scripts/ci/docker/$PRODUCT.Dockerfile.README.md
- if: $CI_COMMIT_REF_NAME == "master"
changes:
- scripts/ci/docker/$PRODUCT.Dockerfile.README.md
script:
- cd / && sh entrypoint.sh
@@ -73,94 +72,94 @@
- .build-refs
- .build-push-docker-image-common
variables:
IMAGE_PATH: paritypr/$PRODUCT
DOCKER_USER: $PARITYPR_USER
DOCKER_PASS: $PARITYPR_PASS
IMAGE_PATH: paritypr/$PRODUCT
DOCKER_USER: $PARITYPR_USER
DOCKER_PASS: $PARITYPR_PASS
publish-docker-substrate:
extends: .build-push-docker-image
extends: .build-push-docker-image
needs:
- job: build-linux-substrate
artifacts: true
- job: build-linux-substrate
artifacts: true
variables:
PRODUCT: substrate
PRODUCT: substrate
publish-docker-description-substrate:
extends: .push-docker-image-description
extends: .push-docker-image-description
variables:
PRODUCT: substrate
SHORT_DESCRIPTION: "Substrate Docker Image."
PRODUCT: substrate
SHORT_DESCRIPTION: "Substrate Docker Image."
publish-docker-substrate-temporary:
extends: .build-push-image-temporary
extends: .build-push-image-temporary
needs:
- job: build-linux-substrate
artifacts: true
- job: build-linux-substrate
artifacts: true
variables:
PRODUCT: substrate
PRODUCT: substrate
artifacts:
reports:
# this artifact is used in zombienet-tests job
# https://docs.gitlab.com/ee/ci/multi_project_pipelines.html#with-variable-inheritance
dotenv: ./artifacts/$PRODUCT/build.env
expire_in: 24h
expire_in: 24h
publish-docker-subkey:
extends: .build-push-docker-image
extends: .build-push-docker-image
needs:
- job: build-subkey-linux
artifacts: true
- job: build-subkey-linux
artifacts: true
variables:
PRODUCT: subkey
PRODUCT: subkey
publish-docker-description-subkey:
extends: .push-docker-image-description
extends: .push-docker-image-description
variables:
PRODUCT: subkey
SHORT_DESCRIPTION: "The subkey program is a key management utility for Substrate-based blockchains."
PRODUCT: subkey
SHORT_DESCRIPTION: "The subkey program is a key management utility for Substrate-based blockchains."
publish-s3-release:
stage: publish
stage: publish
extends:
- .publish-refs
- .kubernetes-env
needs:
- job: build-linux-substrate
artifacts: true
- job: build-subkey-linux
artifacts: true
image: paritytech/awscli:latest
- job: build-linux-substrate
artifacts: true
- job: build-subkey-linux
artifacts: true
image: paritytech/awscli:latest
variables:
GIT_STRATEGY: none
BUCKET: "releases.parity.io"
PREFIX: "substrate/${ARCH}-${DOCKER_OS}"
GIT_STRATEGY: none
BUCKET: "releases.parity.io"
PREFIX: "substrate/${ARCH}-${DOCKER_OS}"
script:
- aws s3 sync ./artifacts/ s3://${BUCKET}/${PREFIX}/$(cat ./artifacts/substrate/VERSION)/
- echo "update objects in latest path"
- aws s3 sync s3://${BUCKET}/${PREFIX}/$(cat ./artifacts/substrate/VERSION)/ s3://${BUCKET}/${PREFIX}/latest/
after_script:
- aws s3 ls s3://${BUCKET}/${PREFIX}/latest/
--recursive --human-readable --summarize
--recursive --human-readable --summarize
publish-rustdoc:
stage: publish
extends: .kubernetes-env
stage: publish
extends: .kubernetes-env
variables:
CI_IMAGE: node:16
GIT_DEPTH: 100
RUSTDOCS_DEPLOY_REFS: "master"
CI_IMAGE: node:16
GIT_DEPTH: 100
RUSTDOCS_DEPLOY_REFS: "master"
rules:
- if: $CI_PIPELINE_SOURCE == "pipeline"
when: never
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^monthly-20[0-9]{2}-[0-9]{2}.*$/ # to support: monthly-2021-09+1
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- if: $CI_COMMIT_REF_NAME =~ /^monthly-20[0-9]{2}-[0-9]{2}.*$/ # to support: monthly-2021-09+1
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
# `needs:` can be removed after CI image gets nonroot. In this case `needs:` stops other
# artifacts from being dowloaded by this job.
needs:
- job: build-rustdoc
artifacts: true
- job: build-rustdoc
artifacts: true
script:
# If $CI_COMMIT_REF_NAME doesn't match one of $RUSTDOCS_DEPLOY_REFS space-separated values, we
# exit immediately.
@@ -196,75 +195,75 @@ publish-rustdoc:
# We don't want to mark the entire job failed if there's nothing to
# publish though, hence the `|| true`.
- git commit -m "___Updated docs for ${CI_COMMIT_REF_NAME}___" ||
echo "___Nothing to commit___"
echo "___Nothing to commit___"
- git push origin gh-pages --force
after_script:
- rm -rf .git/ ./*
publish-draft-release:
stage: publish
image: paritytech/tools:latest
stage: publish
image: paritytech/tools:latest
rules:
- if: $CI_COMMIT_REF_NAME =~ /^ci-release-.*$/
- 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
script:
- ./scripts/ci/gitlab/publish_draft_release.sh
allow_failure: true
allow_failure: true
.publish-crates-template:
stage: publish
stage: publish
extends:
- .crates-publishing-template
- .crates-publishing-pipeline
# We don't want multiple jobs racing to publish crates as it's redundant and they might overwrite
# the releases of one another. Use resource_group to ensure that at most one instance of this job
# is running at any given time.
resource_group: crates-publishing
resource_group: crates-publishing
# crates.io currently rate limits crate publishing at 1 per minute:
# https://github.com/paritytech/release-engineering/issues/123#issuecomment-1335509748
# Taking into account the 202 (as of Dec 07, 2022) publishable Substrate crates, in the worst
# case, due to the rate limits alone, we'd have to wait through at least 202 minutes of delay.
# Taking into account also the verification steps and extra synchronization delays after
# publishing the crate, the job needs to have a much higher timeout than average.
timeout: 9h
timeout: 9h
# A custom publishing environment is used for us to be able to set up protected secrets
# specifically for it
environment: publish-crates
environment: publish-crates
script:
- rusty-cachier snapshot create
- git clone
--depth 1
--branch "$RELENG_SCRIPTS_BRANCH"
https://github.com/paritytech/releng-scripts.git
--depth 1
--branch "$RELENG_SCRIPTS_BRANCH"
https://github.com/paritytech/releng-scripts.git
- CRATESIO_TARGET_INSTANCE=default ./releng-scripts/publish-crates
- rusty-cachier cache upload
publish-crates:
extends: .publish-crates-template
extends: .publish-crates-template
# publish-crates should only be run if publish-crates-locally passes
needs:
- job: check-crate-publishing
artifacts: false
- job: check-crate-publishing
artifacts: false
publish-crates-manual:
extends: .publish-crates-template
when: manual
interruptible: false
extends: .publish-crates-template
when: manual
interruptible: false
check-crate-publishing:
stage: publish
stage: publish
extends:
- .test-refs
- .crates-publishing-template
# When lots of crates are taken into account (for example on master where all crates are tested)
# the job might take a long time, as evidenced by:
# https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2269364
timeout: 4h
timeout: 4h
script:
- rusty-cachier snapshot create
- git clone
--depth 1
--branch "$RELENG_SCRIPTS_BRANCH"
https://github.com/paritytech/releng-scripts.git
--depth 1
--branch "$RELENG_SCRIPTS_BRANCH"
https://github.com/paritytech/releng-scripts.git
- CRATESIO_TARGET_INSTANCE=local ./releng-scripts/publish-crates
- rusty-cachier cache upload