From b3b511c974f2d0279d10a46f8937cbb29a36c8c4 Mon Sep 17 00:00:00 2001 From: gabriel klawitter Date: Wed, 4 Sep 2019 00:29:40 +0200 Subject: [PATCH] Disable merge test enable kusama nightly staging test (#412) * remove merge-test and set up kusama-nightly-staging * refactor .gitlab-ci.yml * kusama-nightly-staging typo i * kusama-nightly-staging typo and cond --locked --- polkadot/.gitlab-ci.yml | 87 +++++++------- .../scripts/gitlab/check_merge_conflict.sh | 110 ------------------ 2 files changed, 47 insertions(+), 150 deletions(-) delete mode 100755 polkadot/scripts/gitlab/check_merge_conflict.sh diff --git a/polkadot/.gitlab-ci.yml b/polkadot/.gitlab-ci.yml index 0df10f59ad..3547cf6a3d 100644 --- a/polkadot/.gitlab-ci.yml +++ b/polkadot/.gitlab-ci.yml @@ -7,7 +7,6 @@ stages: - - merge-test - test - build - publish @@ -32,12 +31,16 @@ variables: paths: - artifacts/ -.kubernetes-build: &kubernetes-build +.kubernetes-env: &kubernetes-env tags: - kubernetes-parity-build environment: name: parity-build +.docker-env: &docker-env + tags: + - linux-docker + .compiler_info: &compiler_info before_script: - rustup show @@ -45,26 +48,38 @@ variables: - sccache -s -#### stage: merge-test -check-merge-conflict: - stage: merge-test - image: parity/tools:latest - cache: {} - <<: *kubernetes-build +.build-refs: &build-refs only: + - master + - schedules + - web + - /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 + - kusama-nightly-staging + except: + variables: + - $DEPLOY_TAG + +.test-refs: &test-refs + only: + - master + - schedules + - web + - /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 + - kusama-nightly-staging - /^[0-9]+$/ - variables: - GITHUB_API: "https://api.github.com" - GITLAB_API: "https://gitlab.parity.io/api/v4" - GITHUB_API_PROJECT: "parity%2Finfrastructure%2Fgithub-api" - script: - - ./scripts/gitlab/check_merge_conflict.sh + except: + variables: + - $DEPLOY_TAG + + test-linux-stable: &test stage: test + <<: *test-refs + <<: *docker-env <<: *compiler_info variables: RUST_TOOLCHAIN: stable @@ -72,40 +87,29 @@ test-linux-stable: &test # but still want to have debug assertions. RUSTFLAGS: -Cdebug-assertions=y TARGET: native - tags: - - linux-docker - only: - - tags - - master - - schedules - - web - - /^[0-9]+$/ - except: - variables: - - $DEPLOY_TAG script: - - time cargo test --all --release --verbose --locked + - | + test "${CI_COMMIT_TAG}" = "kusama-nightly-staging" && ( + echo "kusama-nightly-staging: change Cargo.toml to build against substrate:kusama-nightly-staging" + find . -name Cargo.toml -exec sed -i -r -e ':github.com/paritytech/substrate: { s:branch = "polkadot-master":tag = "kusama-nightly-staging":; s:github.com/paritytech/substrate:gitlab.parity.io/parity/substrate.git:}' '{}' \; + time cargo test --all --release --verbose) || \ + time cargo test --all --release --verbose --locked - sccache -s -.build-only: &build-only - only: - - master - - tags - - web build-linux-release: &build stage: build <<: *collect-artifacts - <<: *build-only + <<: *build-refs + <<: *docker-env <<: *compiler_info - except: - variables: - - $DEPLOY_TAG - tags: - - linux-docker script: + - | + test "${CI_COMMIT_TAG}" = "kusama-nightly-staging" && ( + echo "kusama-nightly-staging: change Cargo.toml to build against substrate:kusama-nightly-staging"; + find . -name Cargo.toml -exec sed -i -r -e ':github.com/paritytech/substrate: { s:branch = "polkadot-master":tag = "kusama-nightly-staging":; s:github.com/paritytech/substrate:gitlab.parity.io/parity/substrate.git:}' '{}' \;) - time cargo build --release --verbose - mkdir -p ./artifacts - mv ./target/release/polkadot ./artifacts/. @@ -129,8 +133,8 @@ build-linux-release: &build dependencies: - build-linux-release cache: {} - <<: *build-only - <<: *kubernetes-build + <<: *build-refs + <<: *kubernetes-env @@ -206,7 +210,7 @@ publish-s3-release: cache: {} retry: 1 image: parity/kubetools:latest - <<: *build-only + <<: *build-refs tags: # this is the runner that is used to deploy it - kubernetes-parity-build @@ -245,6 +249,9 @@ publish-s3-release: only: variables: - $DEPLOY_TAG + except: + variables: + - $DEPLOY_TAG == "" diff --git a/polkadot/scripts/gitlab/check_merge_conflict.sh b/polkadot/scripts/gitlab/check_merge_conflict.sh deleted file mode 100755 index 8738340e71..0000000000 --- a/polkadot/scripts/gitlab/check_merge_conflict.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/sh -# -# check if there is a merge conflict with this pull request only about wasm -# binary blobs. if so trigger a rebuild of it and push it on the feature -# branch if owned by paritytech -# - -set -e # fail on any error - -NODE_RUNTIME_COMPACT="runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm" -NODE_RUNTIME="runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.wasm" - - - -jsonfile="$(mktemp)" - -attemptno="1" -while ( ! test -s ${jsonfile} ) \ - || ( [ "$(jq -r .mergeable ${jsonfile})" = "null" ] \ - && [ "${attemptno}" -lt 5 ] ) -do - echo "| checking pull request status (attempt no ${attemptno})" - curl -sS -o ${jsonfile} -H "Accept: application/vnd.github.v3+json" \ - "${GITHUB_API}/repos/paritytech/polkadot/pulls/${CI_COMMIT_REF_NAME}" - sleep 3 - attemptno="$(( ${attemptno} + 1 ))" -done - - - -baseref="$(jq -r .head.ref ${jsonfile})" -baserepo="$(jq -r .head.repo.full_name ${jsonfile})" -mergeable="$(jq -r .mergeable ${jsonfile})" - -rm -f ${jsonfile} - - -cat <<-EOT -| -| pr is of feature branch ${baseref} on ${baserepo} -| -| tell me github is this branch mergeable into the master branch? -| -EOT - -test "${mergeable}" = "true" && echo "| yes, it is." && exit 0 - -if [ "${baseref}" = "null" -a "${baserepo}" = "null" ] -then - echo "| either connectivity issues with github or pull request not existant" - exit 3 -fi - -cat <<-EOT -| not mergeable -| -| github sees a conflict - check if it's only about the following wasm blobs -| -| - ${NODE_RUNTIME_COMPACT} -| - ${NODE_RUNTIME} -| -EOT - -git fetch origin master -git config --global user.email "devops-team+polkadot-ci-merge-conflict@parity.io" -git config --global user.name "I shall never commit to anything" - -cat <<-EOT -| -| trying to merge with the master branch to see if there is a conflict about -| the wasm files only -| -EOT - -if git merge --no-commit --no-ff origin/master | grep '^CONFLICT ' \ - | grep -v -e ${NODE_RUNTIME_COMPACT} -e ${NODE_RUNTIME} -then - git merge --abort - echo "| there are more conflicting files than the wasm blobs" - exit 1 -fi -git merge --abort - - -cat <<-EOT -| -| only wasm blobs block the merge. -| -| triggering rebuild of wasm blobs which will be pushed onto the feature -| branch of this pull request upon success. -| -| see: -| -EOT - - - -curl -sS -X POST \ - -F "token=${CI_JOB_TOKEN}" \ - -F "ref=master" \ - -F "variables[REBUILD_WASM]=\"${baserepo}:${baseref}\"" \ - ${GITLAB_API}/projects/${GITHUB_API_PROJECT}/trigger/pipeline \ - | jq -r .web_url - -# fail as there will be another commit on top of that feature branch that will -# be tested anyway. -exit 1 - - -# vim: noexpandtab