Skip to content
Snippets Groups Projects
Commit b67c36d4 authored by Denis_P's avatar Denis_P :field_hockey: Committed by GitHub
Browse files

CI: build an image and trigger simnet (#2643)

* CI: build an image and trigger simnet

* CI: think of a funny name

* CI: fix the artifact

* CI: address the bug with .env

* CI: some explanation
parent 6435296c
Branches
No related merge requests found
......@@ -148,23 +148,6 @@ check-runtime-benchmarks:
- ./scripts/gitlab/check_runtime_benchmarks.sh
- sccache -s
#### stage: build
check-transaction-versions:
image: node:15
stage: build
<<: *rules-test
<<: *docker-env
needs:
- job: test-linux-stable
artifacts: true
before_script:
- apt-get -y update; apt-get -y install jq lsof
- npm install --ignore-scripts -g @polkadot/metadata-cmp
- git fetch origin release
script:
- scripts/gitlab/check_extrinsics_ordering.sh
.pack-artifacts: &pack-artifacts
- mkdir -p ./artifacts
- VERSION="${CI_COMMIT_REF_NAME}" # will be tag or branch name
......@@ -183,7 +166,7 @@ check-transaction-versions:
- cp -r scripts/docker/* ./artifacts
build-linux-release:
stage: build
stage: test
<<: *collect-artifacts
<<: *docker-env
<<: *compiler-info
......@@ -195,14 +178,31 @@ build-linux-release:
variables:
EXTRA_FLAGS: "--features=real-overseer"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
when: manual
allow_failure: true
variables:
EXTRA_FLAGS: "--features=real-overseer"
- when: always
script:
- time cargo build --release --verbose ${EXTRA_FLAGS}
- sccache -s
- *pack-artifacts
#### stage: build
check-transaction-versions:
image: node:15
stage: build
<<: *rules-test
<<: *docker-env
needs:
- job: test-linux-stable
artifacts: true
before_script:
- apt-get -y update; apt-get -y install jq lsof
- npm install --ignore-scripts -g @polkadot/metadata-cmp
- git fetch origin release
script:
- scripts/gitlab/check_extrinsics_ordering.sh
generate-impl-guide:
stage: build
<<: *rules-test
......@@ -213,12 +213,15 @@ generate-impl-guide:
script:
- mdbook build roadmap/implementers-guide
#### stage: publish
.build-push-docker-image: &build-push-docker-image
<<: *kubernetes-env
<<: *collect-artifacts
image: quay.io/buildah/stable
variables:
GIT_STRATEGY: none
# DOCKERFILE: scripts/docker/Dockerfile
IMAGE_NAME: docker.io/parity/polkadot
DOCKER_USER: ${Docker_Hub_User_Parity}
DOCKER_PASS: ${Docker_Hub_Pass_Parity}
before_script: &check-versions
- test -s ./artifacts/VERSION || exit 1
- test -s ./artifacts/EXTRATAG || exit 1
......@@ -226,7 +229,7 @@ generate-impl-guide:
- EXTRATAG="$(cat ./artifacts/EXTRATAG)"
- echo "Polkadot version = ${VERSION} (EXTRATAG ${EXTRATAG})"
script:
- test "$Docker_Hub_User_Parity" -a "$Docker_Hub_Pass_Parity" ||
- test "$DOCKER_USER" -a "$DOCKER_PASS" ||
( echo "no docker credentials provided"; exit 1 )
- cd ./artifacts
- buildah bud
......@@ -236,23 +239,27 @@ generate-impl-guide:
--tag "$IMAGE_NAME:$VERSION"
--tag "$IMAGE_NAME:$EXTRATAG" .
# The job will success only on the protected branch
- echo "$Docker_Hub_Pass_Parity" |
buildah login --username "$Docker_Hub_User_Parity" --password-stdin docker.io
- 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"
# pass artifacts to the trigget-simnet job
# this twist is to match the similar logic in substrate
- echo "VERSION=${EXTRATAG}" > build.env
- echo "TRIGGERER=${CI_PROJECT_NAME}" >> build.env
after_script:
- buildah logout "$IMAGE_NAME"
# only VERSION information is needed for the deployment
- find ./artifacts/ -depth -not -name VERSION -not -name artifacts -delete
artifacts:
reports:
# this artifact is used in trigger-simnet job
# https://docs.gitlab.com/ee/ci/multi_project_pipelines.html#with-variable-inheritance
dotenv: build.env
publish-dockerhub:
stage: publish
stage: build
<<: *build-push-docker-image
variables:
GIT_STRATEGY: none
# DOCKERFILE: scripts/docker/Dockerfile
IMAGE_NAME: docker.io/parity/polkadot
rules:
# Don't run on releases - this is handled by the Github Action here:
# .github/workflows/publish-docker-release.yml
......@@ -261,6 +268,12 @@ publish-dockerhub:
- if: $CI_COMMIT_REF_NAME == "rococo-v1"
variables:
IMAGE_NAME: docker.io/parity/rococo
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
variables:
# image to be tested with Simnet
IMAGE_NAME: docker.io/paritypr/synth-wave
DOCKER_USER: ${PARITYPR_USER}
DOCKER_PASS: ${PARITYPR_PASS}
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_COMMIT_REF_NAME == "master"
......@@ -268,6 +281,8 @@ publish-dockerhub:
- job: build-linux-release
artifacts: true
#### stage: publish
publish-s3-release:
stage: publish
needs:
......@@ -329,3 +344,16 @@ deploy-polkasync-kusama:
POLKADOT_CI_COMMIT_REF: "${CI_COMMIT_REF}"
allow_failure: true
trigger: "parity/infrastructure/parity-testnet"
trigger-simnet:
stage: deploy
<<: *rules-test
needs:
- job: publish-dockerhub
# build.env is passed with an exact VERSION (EXTRATAG here, i.e. 2643-0.8.29-5f689e0a-6b24dc54)
# Simnet uses an image published on PRs with this exact version for triggered runs on commits.
# And parity/rococo:rococo-v1 for runs not launched by this job.
trigger:
project: parity/simnet
branch: master
strategy: depend
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment