Files
pezkuwi-subxt/polkadot/scripts/ci/gitlab/pipeline/publish.yml
T
Chevdor 693a29da1a Publish RC container images (#7556)
* WIP

* Add missing checkout

* Add debuggin

* Fix VAR name

* Bug fix

* Rework jobs

* Revert "Rework jobs"

This reverts commit 2bfa79fd3ae633c17403b838f9a5025f0f7fc3f3.

* Add cache

* Add temp default for testing

* Add missing checkout

* Fix patch

* Comment out the GPG check for now

* Rename polkadot_injected_release into a more appropriate polkadot_injected_debian

* Refactoring / renaming

* Introduce a generic image for binary injection

* Flag files to be deleted and changes to be done

* WIP

* Fix multi binaries images

* Add test build scripts

* Remove old file, add polkadot build-injected script

* Fix doc

* Fix tagging

* Add build of the injected container

* Fix for docker

* Remove the need for TTY

* Handling container publishing

* Fix owner and registry

* Fix vars

* Fix repo

* Fix var naming

* Fix case when there is no tag

* Fix case with no tag

* Handle error

* Fix spacings

* Fix tags

* Remove unnecessary grep that may fail

* Add final check

* Clean up and introduce GPG check

* Add doc

* Add doc

* Update doc/docker.md

Co-authored-by: Mira Ressel <mira@parity.io>

* type

Co-authored-by: Mira Ressel <mira@parity.io>

* Fix used VAR

* Improve doc

* ci: Update .build-push-image jobs to use the new build-injected.sh

* ci: fix path to build-injected.sh script

* Rename the release artifacts folder to prevent confusion due to a similar folder in the gitlab CI

* ci: check out polkadot repo in .build-push-image

This seems far cleaner than copying the entire scripts/ folder into our
job artifacts.

* feat(build-injected.sh): make PROJECT_ROOT configurable

This lets us avoid a dependency on git in our CI image.

* ci: build injected images with buildah

* ci: pass full image names to zombienet

* Add missing ignore

---------

Co-authored-by: Mira Ressel <mira@parity.io>
2023-08-11 15:28:39 +02:00

277 lines
9.2 KiB
YAML

# This file is part of .gitlab-ci.yml
# Here are all jobs that are executed during "publish" stage
# This image is used in testnets
# Release image is handled by the Github Action here:
# .github/workflows/publish-docker-release.yml
publish-polkadot-debug-image:
stage: publish
extends:
- .kubernetes-env
- .build-push-image
rules:
# Don't run when triggered from another pipeline
- if: $CI_PIPELINE_SOURCE == "pipeline"
when: never
- 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
variables:
IMAGE_NAME: "polkadot-debug"
BINARY: "polkadot,polkadot-execute-worker,polkadot-prepare-worker"
needs:
- job: build-linux-stable
artifacts: true
after_script:
- !reference [.build-push-image, after_script]
# pass artifacts to the zombienet-tests job
# https://docs.gitlab.com/ee/ci/multi_project_pipelines.html#with-variable-inheritance
- echo "PARACHAINS_IMAGE_NAME=${IMAGE}" > ./artifacts/parachains.env
- echo "PARACHAINS_IMAGE_TAG=$(cat ./artifacts/EXTRATAG)" >> ./artifacts/parachains.env
artifacts:
reports:
# this artifact is used in zombienet-tests job
dotenv: ./artifacts/parachains.env
expire_in: 1 days
publish-test-collators-image:
# service image for Simnet
stage: publish
extends:
- .kubernetes-env
- .build-push-image
- .zombienet-refs
variables:
IMAGE_NAME: "colander"
BINARY: "adder-collator,undying-collator"
needs:
- job: build-test-collators
artifacts: true
after_script:
- !reference [.build-push-image, after_script]
# pass artifacts to the zombienet-tests job
- echo "COLLATOR_IMAGE_NAME=${IMAGE}" > ./artifacts/collator.env
- echo "COLLATOR_IMAGE_TAG=$(cat ./artifacts/EXTRATAG)" >> ./artifacts/collator.env
artifacts:
reports:
# this artifact is used in zombienet-tests job
dotenv: ./artifacts/collator.env
publish-malus-image:
# service image for Simnet
stage: publish
extends:
- .kubernetes-env
- .build-push-image
- .zombienet-refs
variables:
IMAGE_NAME: "malus"
BINARY: "malus,polkadot-execute-worker,polkadot-prepare-worker"
needs:
- job: build-malus
artifacts: true
after_script:
- !reference [.build-push-image, after_script]
# pass artifacts to the zombienet-tests job
- echo "MALUS_IMAGE_NAME=${IMAGE}" > ./artifacts/malus.env
- echo "MALUS_IMAGE_TAG=$(cat ./artifacts/EXTRATAG)" >> ./artifacts/malus.env
artifacts:
reports:
# this artifact is used in zombienet-tests job
dotenv: ./artifacts/malus.env
publish-staking-miner-image:
stage: publish
extends:
- .kubernetes-env
- .build-push-image
- .publish-refs
variables:
IMAGE_NAME: "staking-miner"
BINARY: "staking-miner"
DOCKER_OWNER: "paritytech"
DOCKER_USER: "${Docker_Hub_User_Parity}"
DOCKER_PASS: "${Docker_Hub_Pass_Parity}"
needs:
- job: build-staking-miner
artifacts: true
publish-polkadot-image-description:
stage: publish
image: paritytech/dockerhub-description
variables:
DOCKER_USERNAME: ${Docker_Hub_User_Parity}
DOCKER_PASSWORD: ${Docker_Hub_Pass_Parity}
DOCKERHUB_REPOSITORY: parity/polkadot
SHORT_DESCRIPTION: "Polkadot Official Docker Image"
README_FILEPATH: $CI_PROJECT_DIR/scripts/ci/dockerfiles/polkadot/polkadot_Dockerfile.README.md
rules:
- if: $CI_COMMIT_REF_NAME == "master"
changes:
- scripts/ci/dockerfiles/polkadot/polkadot_Dockerfile.README.md
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
script:
- cd / && sh entrypoint.sh
tags:
- kubernetes-parity-build
publish-staking-miner-image-description:
stage: publish
image: paritytech/dockerhub-description
variables:
DOCKER_USERNAME: ${Docker_Hub_User_Parity}
DOCKER_PASSWORD: ${Docker_Hub_Pass_Parity}
DOCKERHUB_REPOSITORY: paritytech/staking-miner
SHORT_DESCRIPTION: "Staking-miner Docker Image"
README_FILEPATH: $CI_PROJECT_DIR/scripts/ci/dockerfiles/staking-miner/staking-miner_Dockerfile.README.md
rules:
- if: $CI_COMMIT_REF_NAME == "master"
changes:
- scripts/ci/dockerfiles/staking-miner/staking-miner_Dockerfile.README.md
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
script:
- cd / && sh entrypoint.sh
tags:
- kubernetes-parity-build
publish-s3-release:
stage: publish
extends:
- .kubernetes-env
needs:
- job: build-linux-stable
artifacts: true
variables:
CI_IMAGE: paritytech/awscli:latest
GIT_STRATEGY: none
PREFIX: "builds/polkadot/${ARCH}-${DOCKER_OS}"
rules:
- if: $CI_PIPELINE_SOURCE == "pipeline"
when: never
# publishing binaries nightly
- if: $CI_PIPELINE_SOURCE == "schedule"
before_script:
- !reference [.build-push-image, before_script]
script:
- echo "uploading objects to https://releases.parity.io/${PREFIX}/${VERSION}"
- aws s3 sync --acl public-read ./artifacts/ s3://${AWS_BUCKET}/${PREFIX}/${VERSION}/
- echo "update objects at https://releases.parity.io/${PREFIX}/${EXTRATAG}"
- find ./artifacts -type f | while read file; do
name="${file#./artifacts/}";
aws s3api copy-object
--copy-source ${AWS_BUCKET}/${PREFIX}/${VERSION}/${name}
--bucket ${AWS_BUCKET} --key ${PREFIX}/${EXTRATAG}/${name};
done
- |
cat <<-EOM
|
| polkadot binary paths:
|
| - https://releases.parity.io/${PREFIX}/${EXTRATAG}/polkadot
| - https://releases.parity.io/${PREFIX}/${VERSION}/polkadot
|
EOM
after_script:
- aws s3 ls s3://${AWS_BUCKET}/${PREFIX}/${EXTRATAG}/
--recursive --human-readable --summarize
publish-rustdoc:
stage: publish
extends:
- .kubernetes-env
variables:
CI_IMAGE: paritytech/tools:latest
rules:
- if: $CI_PIPELINE_SOURCE == "pipeline"
when: never
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME == "master"
# `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-implementers-guide
artifacts: true
script:
# Save README and docs
- cp -r ./crate-docs/ /tmp/doc/
- cp -r ./artifacts/book/ /tmp/
# setup ssh
- eval $(ssh-agent)
- ssh-add - <<< ${GITHUB_SSH_PRIV_KEY}
- mkdir ~/.ssh && touch ~/.ssh/known_hosts
- ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
# Set git config
- git config user.email "devops-team@parity.io"
- git config user.name "${GITHUB_USER}"
- git config remote.origin.url "git@github.com:/paritytech/${CI_PROJECT_NAME}.git"
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
- git fetch origin gh-pages
- git checkout gh-pages
# Remove everything and restore generated docs and README
- cp index.html /tmp
- cp README.md /tmp
- rm -rf ./*
# dir for rustdoc
- mkdir -p doc
# dir for implementors guide
- mkdir -p book
- mv /tmp/doc/* doc/
- mv /tmp/book/html/* book/
- mv /tmp/index.html .
- mv /tmp/README.md .
# Upload files
- git add --all --force
# `git commit` has an exit code of > 0 if there is nothing to commit.
# This causes GitLab to exit immediately and marks this job failed.
# 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___"
- git push origin gh-pages --force
- echo "___Rustdoc was successfully published to https://paritytech.github.io/polkadot/___"
after_script:
- rm -rf .git/ ./*
.update-substrate-template-repository:
stage: publish
extends: .kubernetes-env
variables:
GIT_STRATEGY: none
rules:
# The template is only updated for FINAL releases
# i.e. the rule should not cover RC or patch releases
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+$/ # e.g. v1.0
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/ # e.g. v1.0.0
script:
- git clone --depth=1 --branch="$PIPELINE_SCRIPTS_TAG" https://github.com/paritytech/pipeline-scripts
- export POLKADOT_BRANCH="polkadot-$CI_COMMIT_TAG"
- git clone --depth=1 --branch="$POLKADOT_BRANCH" https://github.com/paritytech/"$TEMPLATE_SOURCE"
- cd "$TEMPLATE_SOURCE"
- ../pipeline-scripts/update_substrate_template.sh
--repo-name "$TARGET_REPOSITORY"
--template-path "$TEMPLATE_PATH"
--github-api-token "$GITHUB_TOKEN"
--polkadot-branch "$POLKADOT_BRANCH"
# Ref: https://github.com/paritytech/opstooling/issues/111
update-node-template:
extends: .update-substrate-template-repository
variables:
TARGET_REPOSITORY: substrate-node-template
TEMPLATE_SOURCE: substrate
TEMPLATE_PATH: bin/node-template
# Ref: https://github.com/paritytech/opstooling/issues/111
update-parachain-template:
extends: .update-substrate-template-repository
variables:
TARGET_REPOSITORY: substrate-parachain-template
TEMPLATE_SOURCE: cumulus
TEMPLATE_PATH: parachain-template