Skip to content

Commit

Permalink
Prepare for merge queues (#2)
Browse files Browse the repository at this point in the history
* Prepare for merge queues

* fix condition

* more zombienet jobs

* fail test in mq

* fix image tag

* fix cancel pipeline

* fix ref

* upd zombienet

* add gsh trigger
  • Loading branch information
alvicsam authored Nov 14, 2023
1 parent 1cc122e commit 1628a97
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/check-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ name: Check labels
on:
pull_request:
types: [labeled, opened, synchronize, unlabeled]
merge_group:

jobs:
check-labels:
runs-on: ubuntu-latest
steps:
- name: Skip merge queue
if: ${{ contains(github.ref, 'gh-readonly-queue') }}
run: exit 0
- name: Pull image
env:
IMAGE: paritytech/ruled_labels:0.4.0
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check-licenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Check licenses

on:
pull_request:
merge_group:

permissions:
packages: read
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- ".github/workflows/check-links.yml"
- ".config/lychee.toml"
types: [opened, synchronize, reopened, ready_for_review]
merge_group:

permissions:
packages: read
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/check-markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Check Markdown
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
merge_group:

permissions:
packages: read
Expand All @@ -23,8 +24,8 @@ jobs:

- name: Install tooling
run: |
npm install -g markdownlint-cli
markdownlint --version
npm install -g markdownlint-cli
markdownlint --version
- name: Check Markdown
env:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/check-prdoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Check PRdoc
on:
pull_request:
types: [labeled, opened, synchronize, unlabeled]
merge_group:

env:
IMAGE: paritytech/prdoc:v0.0.5
Expand All @@ -17,6 +18,9 @@ jobs:
check-prdoc:
runs-on: ubuntu-latest
steps:
- name: Skip merge queue
if: ${{ contains(github.ref, 'gh-readonly-queue') }}
run: exit 0
- name: Pull image
run: |
echo "Pulling $IMAGE"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
merge_group:

jobs:
check-publish:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/fmt-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
merge_group:

jobs:
quick_check:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/gitspiegel-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- unlocked
- ready_for_review
- reopened
merge_group:

jobs:
sync:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pr-custom-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ on:
- ready_for_review
- converted_to_draft
pull_request_review:
merge_group:

jobs:
pr-custom-review:
runs-on: ubuntu-latest
steps:
- name: Skip merge queue
if: ${{ contains(github.ref, 'gh-readonly-queue') }}
run: exit 0
- name: Skip if pull request is in Draft
# `if: github.event.pull_request.draft == true` should be kept here, at
# the step level, rather than at the job level. The latter is not
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/review-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
runs-on: ubuntu-latest
environment: master
steps:
- name: Skip merge queue
if: ${{ contains(github.ref, 'gh-readonly-queue') }}
run: exit 0
- name: Extract content of artifact
id: number
uses: Bullrich/[email protected]
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/review-trigger.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Review-Trigger

on:
on:
pull_request_target:
types:
- opened
Expand All @@ -10,13 +10,17 @@ on:
- review_request_removed
- ready_for_review
pull_request_review:
merge_group:

jobs:
trigger-review-bot:
if: github.event.pull_request.draft != true
runs-on: ubuntu-latest
name: trigger review bot
steps:
- name: Skip merge queue
if: ${{ contains(github.ref, 'gh-readonly-queue') }}
run: exit 0
- name: Get PR number
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
Expand Down
12 changes: 10 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
NEXTEST_FAILURE_OUTPUT: immediate-final
NEXTEST_SUCCESS_OUTPUT: final
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.79"
DOCKER_IMAGES_VERSION: "${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}"
DOCKER_IMAGES_VERSION: "${CI_COMMIT_SHA}"

default:
retry:
Expand Down Expand Up @@ -136,11 +136,13 @@ default:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/ # merge queues
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1

.test-pr-refs:
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/ # merge queues

# handle the specific case where benches could store incorrect bench data because of the downstream staging runs
# exclude cargo-check-benches from such runs
Expand All @@ -152,6 +154,7 @@ default:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/ # merge queues
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1

.test-refs-no-trigger:
Expand All @@ -162,6 +165,7 @@ default:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/ # merge queues
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- if: $CI_COMMIT_REF_NAME =~ /^ci-release-.*$/

Expand All @@ -172,6 +176,7 @@ default:
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/ # merge queues

.publish-refs:
rules:
Expand All @@ -192,6 +197,7 @@ default:
- 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 =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/ # merge queues

.zombienet-refs:
extends: .build-refs
Expand Down Expand Up @@ -225,6 +231,8 @@ include:
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
when: on_failure
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/ # merge queues
when: on_failure
variables:
PROJECT_ID: "${CI_PROJECT_ID}"
PROJECT_NAME: "${CI_PROJECT_NAME}"
Expand Down Expand Up @@ -320,7 +328,7 @@ cancel-pipeline-cargo-check-each-crate-6:
needs:
- job: "cargo-check-each-crate 6/6"

cancel-pipeline-cargo-check-each-crate-macos:
.cancel-pipeline-cargo-check-each-crate-macos:
extends: .cancel-pipeline-template
needs:
- job: cargo-check-each-crate-macos
Expand Down
4 changes: 2 additions & 2 deletions .gitlab/pipeline/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ publish-rustdoc:
DOCKERFILE: "" # docker/path-to.Dockerfile
IMAGE_NAME: "" # docker.io/paritypr/image_name
script:
# - test "$PARITYPR_USER" -a "$PARITYPR_PASS" ||
# ( echo "no docker credentials provided"; exit 1 )
# Exit if the job is not running in a merge queue
- if [[ $CI_COMMIT_REF_NAME != *"gh-readonly-queue"* ]]; then echo "I will run only in a merge queue"; exit 0; fi
- $BUILDAH_COMMAND build
--format=docker
--build-arg VCS_REF="${CI_COMMIT_SHA}"
Expand Down
8 changes: 6 additions & 2 deletions .gitlab/pipeline/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ test-linux-stable:
- echo "Node index - ${CI_NODE_INDEX}. Total amount - ${CI_NODE_TOTAL}"
# add experimental to features after https://github.com/paritytech/substrate/pull/14502 is merged
# "upgrade_version_checks_should_work" is currently failing
# ------------DEBUG: FAIL in MQ------------------
- if [[ $CI_COMMIT_REF_NAME == *"gh-readonly-queue"* ]]; then exit 1; else exit 0; fi
# -----------------------------------------------
- |
time cargo nextest run \
--workspace \
Expand Down Expand Up @@ -447,7 +450,8 @@ cargo-check-each-crate:
- PYTHONUNBUFFERED=x time .gitlab/check-each-crate.py "$CI_NODE_INDEX" "$CI_NODE_TOTAL"
parallel: 6

cargo-check-each-crate-macos:
# ENABLE ME AFTER DEBUG!
.cargo-check-each-crate-macos:
stage: test
extends:
- .docker-env
Expand Down Expand Up @@ -520,6 +524,6 @@ test-syscalls:
- ./list-syscalls.rb ../../../target/x86_64-unknown-linux-musl/production/polkadot-prepare-worker --only-used-syscalls | diff -u prepare-worker-syscalls -
after_script:
- if [[ "$CI_JOB_STATUS" == "failed" ]]; then
printf "The x86_64 syscalls used by the worker binaries have changed. Please review if this is expected and update polkadot/scripts/list-syscalls/*-worker-syscalls as needed.\n";
printf "The x86_64 syscalls used by the worker binaries have changed. Please review if this is expected and update polkadot/scripts/list-syscalls/*-worker-syscalls as needed.\n";
fi
allow_failure: true # TODO: remove this once we have an idea how often the syscall lists will change
2 changes: 2 additions & 0 deletions .gitlab/pipeline/zombienet/cumulus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

.zombienet-before-script:
before_script:
# Exit if the job is not merge queue
- if [[ $CI_COMMIT_REF_NAME != *"gh-readonly-queue"* ]]; then echo "I will run only in a merge queue"; exit 0; fi
- echo "Zombie-net Tests Config"
- echo "${ZOMBIENET_IMAGE}"
- echo "${POLKADOT_IMAGE}"
Expand Down
18 changes: 13 additions & 5 deletions .gitlab/pipeline/zombienet/polkadot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# common settings for all zombienet jobs
.zombienet-polkadot-common:
before_script:
# Exit if the job is not merge queue
- if [[ $CI_COMMIT_REF_NAME != *"gh-readonly-queue"* ]]; then echo "I will run only in a merge queue"; exit 0; fi
- export BUILD_RELEASE_VERSION="$(cat ./artifacts/BUILD_RELEASE_VERSION)" # from build-linux-stable job
- export DEBUG=zombie,zombie::network-node
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="${POLKADOT_IMAGE}":${PIPELINE_IMAGE_TAG}
Expand All @@ -12,12 +14,12 @@
- export MALUS_IMAGE="${MALUS_IMAGE}":${PIPELINE_IMAGE_TAG}
- IMAGE_AVAILABLE=$(curl -o /dev/null -w "%{http_code}" -I -L -s https://registry.hub.docker.com/v2/repositories/parity/polkadot/tags/${BUILD_RELEASE_VERSION})
- if [ $IMAGE_AVAILABLE -eq 200 ]; then
export ZOMBIENET_INTEGRATION_TEST_SECONDARY_IMAGE="docker.io/parity/polkadot:${BUILD_RELEASE_VERSION}";
export ZOMBIENET_INTEGRATION_TEST_SECONDARY_IMAGE="docker.io/parity/polkadot:${BUILD_RELEASE_VERSION}";
else
echo "Getting the image to use as SECONDARY, using ${BUILD_RELEASE_VERSION} as base";
VERSIONS=$(curl -L -s 'https://registry.hub.docker.com/v2/repositories/parity/polkadot/tags/' | jq -r '.results[].name'| grep -E "v[0-9]" |grep -vE "[0-9]-");
VERSION_TO_USE=$(echo "${BUILD_RELEASE_VERSION}\n$VERSIONS"|sort -r|grep -A1 "${BUILD_RELEASE_VERSION}"|tail -1);
export ZOMBIENET_INTEGRATION_TEST_SECONDARY_IMAGE="docker.io/parity/polkadot:${VERSION_TO_USE}";
echo "Getting the image to use as SECONDARY, using ${BUILD_RELEASE_VERSION} as base";
VERSIONS=$(curl -L -s 'https://registry.hub.docker.com/v2/repositories/parity/polkadot/tags/' | jq -r '.results[].name'| grep -E "v[0-9]" |grep -vE "[0-9]-");
VERSION_TO_USE=$(echo "${BUILD_RELEASE_VERSION}\n$VERSIONS"|sort -r|grep -A1 "${BUILD_RELEASE_VERSION}"|tail -1);
export ZOMBIENET_INTEGRATION_TEST_SECONDARY_IMAGE="docker.io/parity/polkadot:${VERSION_TO_USE}";
fi
- echo "Zombienet Tests Config"
- echo "gh-dir ${GH_DIR}"
Expand Down Expand Up @@ -117,6 +119,8 @@ zombienet-polkadot-smoke-0001-parachains-smoke-test:
extends:
- .zombienet-polkadot-common
before_script:
# Exit if the job is not merge queue
- if [[ $CI_COMMIT_REF_NAME != *"gh-readonly-queue"* ]]; then echo "I will run only in a merge queue"; exit 0; fi
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="${POLKADOT_IMAGE}":${PIPELINE_IMAGE_TAG}
- export COL_IMAGE="${COLANDER_IMAGE}":${PIPELINE_IMAGE_TAG}
- echo "Zombienet Tests Config"
Expand All @@ -134,6 +138,8 @@ zombienet-polkadot-smoke-0002-parachains-parachains-upgrade-smoke:
extends:
- .zombienet-polkadot-common
before_script:
# Exit if the job is not merge queue
- if [[ $CI_COMMIT_REF_NAME != *"gh-readonly-queue"* ]]; then echo "I will run only in a merge queue"; exit 0; fi
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="${POLKADOT_IMAGE}":${PIPELINE_IMAGE_TAG}
- export CUMULUS_IMAGE="docker.io/paritypr/polkadot-parachain-debug:${DOCKER_IMAGES_VERSION}"
- echo "Zombienet Tests Config"
Expand Down Expand Up @@ -176,6 +182,8 @@ zombienet-polkadot-misc-0002-upgrade-node:
- job: build-linux-stable
artifacts: true
before_script:
# Exit if the job is not merge queue
- if [[ $CI_COMMIT_REF_NAME != *"gh-readonly-queue"* ]]; then echo "I will run only in a merge queue"; exit 0; fi
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/parity/polkadot:latest"
- echo "Overrided poladot image ${ZOMBIENET_INTEGRATION_TEST_IMAGE}"
- export COL_IMAGE="${COLANDER_IMAGE}":${PIPELINE_IMAGE_TAG}
Expand Down
3 changes: 3 additions & 0 deletions .gitlab/pipeline/zombienet/substrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
# common settings for all zombienet jobs
.zombienet-substrate-common:
before_script:
# Exit if the job is not merge queue
- if [[ $CI_COMMIT_REF_NAME != *"gh-readonly-queue"* ]]; then echo "I will run only in a merge queue"; exit 0; fi
- echo "Zombienet Tests Config"
- echo "${ZOMBIENET_IMAGE}"
- echo "${GH_DIR}"
- echo "${LOCAL_DIR}"
- export DEBUG=zombie,zombie::network-node
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="${SUBSTRATE_IMAGE}":${SUBSTRATE_IMAGE_TAG}
- echo "${ZOMBIENET_INTEGRATION_TEST_IMAGE}"

stage: zombienet
image: "${ZOMBIENET_IMAGE}"
needs:
Expand Down

0 comments on commit 1628a97

Please sign in to comment.