From 728f0393c719b12c4559eb4ed51b771e6a676cc6 Mon Sep 17 00:00:00 2001 From: gabriel klawitter Date: Tue, 2 Apr 2019 12:19:52 +0200 Subject: [PATCH] ci: remove ci for automated wasm rebuilds (#2168) --- substrate/.gitlab-ci.yml | 15 --- .../scripts/gitlab/check_merge_conflict.sh | 110 ------------------ substrate/scripts/gitlab/check_runtime.sh | 38 ++---- 3 files changed, 9 insertions(+), 154 deletions(-) delete mode 100755 substrate/scripts/gitlab/check_merge_conflict.sh diff --git a/substrate/.gitlab-ci.yml b/substrate/.gitlab-ci.yml index 191075794a..3068547966 100644 --- a/substrate/.gitlab-ci.yml +++ b/substrate/.gitlab-ci.yml @@ -7,7 +7,6 @@ stages: - - merge-test - test - build - publish @@ -37,20 +36,6 @@ variables: environment: name: parity-build -#### stage: merge-test - -check-merge-conflict: - stage: merge-test - image: parity/tools:latest - <<: *kubernetes-build - only: - - /^[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 #### stage: test diff --git a/substrate/scripts/gitlab/check_merge_conflict.sh b/substrate/scripts/gitlab/check_merge_conflict.sh deleted file mode 100755 index dd677ff762..0000000000 --- a/substrate/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 - -TEST_RUNTIME="core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm" -NODE_RUNTIME="node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.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/substrate/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" -o "${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 -| -| - ${TEST_RUNTIME} -| - ${NODE_RUNTIME} -| -EOT - -git fetch origin master -git config --global user.email "devops-team+substrate-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 ${TEST_RUNTIME} -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 diff --git a/substrate/scripts/gitlab/check_runtime.sh b/substrate/scripts/gitlab/check_runtime.sh index fe8cbf450f..03c4660136 100755 --- a/substrate/scripts/gitlab/check_runtime.sh +++ b/substrate/scripts/gitlab/check_runtime.sh @@ -3,8 +3,8 @@ # # check for any changes in the node/src/runtime, srml/ and core/sr_* trees. if # there are any changes found, it should mark the PR breaksconsensus and -# "auto-fail" the PR in some way unless a) the runtime is rebuilt and b) there -# isn't a change in the runtime/src/lib.rs file that alters the version. +# "auto-fail" the PR if there isn't a change in the runtime/src/lib.rs file +# that alters the version. set -e # fail on any error @@ -61,30 +61,15 @@ then github_label "B2-breaksapi" - if git diff --name-only origin/master...${CI_COMMIT_SHA} \ - | grep -q "${RUNTIME}" - then - cat <<-EOT - - changes to the runtime sources and changes in the spec version. Wasm - binary blob is rebuilt. Looks good. + cat <<-EOT - spec_version: ${sub_spec_version} -> ${add_spec_version} - - EOT - exit 0 - else - cat <<-EOT - - changes to the runtime sources and changes in the spec version. Wasm - binary blob needs rebuilding! - - spec_version: ${sub_spec_version} -> ${add_spec_version} - - EOT + changes to the runtime sources and changes in the spec version. + + spec_version: ${sub_spec_version} -> ${add_spec_version} + + EOT + exit 0 - # drop through into pushing `gotissues` and exit 1... - fi else # check for impl_version updates: if only the impl versions changed, we assume # there is no consensus-critical logic that has changed. @@ -122,11 +107,6 @@ else versions file: ${VERSIONS_FILE} - note: if the master branch was merged in as automated wasm rebuilds do it - might be the case that a {spec,impl}_version has been changed. but for pull - requests that involve wasm source file changes a version has to be changed - in the pull request itself. - EOT # drop through into pushing `gotissues` and exit 1...