From 06f9c271c8865b411e6e2b204f9f057263c94fd3 Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Mon, 29 Aug 2022 12:46:44 +0200 Subject: [PATCH 01/53] Add rules and specs --- scripts/ci/github/check_labels_new.sh | 15 ++ scripts/ci/ruled_labels/specs.yaml | 220 ++++++++++++++++++++++++++ scripts/ci/ruled_labels/test.sh | 11 ++ scripts/ci/ruled_labels/tests.yaml | 23 +++ 4 files changed, 269 insertions(+) create mode 100755 scripts/ci/github/check_labels_new.sh create mode 100644 scripts/ci/ruled_labels/specs.yaml create mode 100755 scripts/ci/ruled_labels/test.sh create mode 100644 scripts/ci/ruled_labels/tests.yaml diff --git a/scripts/ci/github/check_labels_new.sh b/scripts/ci/github/check_labels_new.sh new file mode 100755 index 00000000000..c4484d94b71 --- /dev/null +++ b/scripts/ci/github/check_labels_new.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +DIR=$(dirname -- "$0") + +# This is the new version using `ruled-labels` +repo="$GITHUB_REPOSITORY" +pr="$GITHUB_PR" + +pushd "$DIR/../ruled_labels" > /dev/null + +# TODO: Fetch the labels for the PR under test +labels=("B0-Silent" "X1-Runtime" "P1" "D1-audited 👍") + +ruled-labels --version +ruled-labels check --labels "${labels[@]}" diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml new file mode 100644 index 00000000000..441380e9873 --- /dev/null +++ b/scripts/ci/ruled_labels/specs.yaml @@ -0,0 +1,220 @@ +--- +name: paritytech/cumulus +description: Import from paritytech/cumulus +version: 0.0.1 +labels: + - name: A0-please_review + description: Pull request needs code review. + color: "666666" + - name: A1-needs_burnin + description: Pull request needs to be tested on a live validator node before merge. DevOps is notified via matrix + color: c7def8 + - name: A2-insubstantial + description: "Pull request requires no code review (e.g., a sub-repository hash update)." + color: C6C7F8 + - name: A3-in_progress + description: Pull request is in progress. No review needed at this stage. + color: DBC6F8 + - name: A4-companion + description: A PR that should be considered alongside another (usually more comprehensive and detailed) PR. + color: F8C5E7 + - name: A5-stale + description: Pull request did not receive any updates in a long time. No review needed at this stage. Close it. + color: F2C5F8 + - name: A6-backport + description: Pull request is already reviewed well in another branch. + color: F8C5E7 + - name: B0-silent + description: Changes should not be mentioned in any release notes + color: F8C4D0 + - name: B1-note_worthy + description: Changes should be noted in the release notes + color: f9d0c4 + - name: C1-low + description: "Elevates a release containing this PR to \"low priority\"." + color: fcdfc3 + - name: C3-medium + description: "Elevates a release containing this PR to \"medium priority\"." + color: FFE9C0 + - name: C5-high + description: "Elevates a release containing this PR to \"high priority\"." + color: fef2c0 + - name: C7-critical + description: "Elevates a release containing this PR to \"critical priority\"." + color: fef2c0 + - name: D1-audited 👍 + description: PR contains changes to fund-managing logic that has been properly reviewed and externally audited. + color: C0E7CC + - name: D2-notlive 💤 + description: PR contains changes in a runtime directory that is not deployed to a chain that requires an audit. + color: C209B4 + - name: D3-trivial 🧸 + description: PR contains trivial changes in a runtime directory that do not require an audit + color: 5EDFEE + - name: D5-nicetohaveaudit ⚠️ + description: PR contains trivial changes to logic that should be properly reviewed. + color: c5def5 + - name: D9-needsaudit 👮 + description: PR contains changes to fund-managing logic that should be properly reviewed and externally audited + color: C3EDC0 + - name: E0-runtime_migration + description: PR introduces code that might require downstream chains to run a runtime upgrade. + color: c2e0c6 + - name: E1-database_migration + description: PR introduces code that does a one-way migration of the database. + color: f4f5f9 + - name: E2-dependencies + description: Pull requests that update a dependency file. + color: f2f9f2 + - name: E3-host_functions + description: PR adds new host functions which requires a node release before a runtime upgrade. + color: f9f2f2 + - name: E4-node_first_update + description: This is a runtime change that will require all nodes to be update BEFORE the runtime upgrade. + color: e8d7d7 + - name: F0-breaks_everything + description: "This change breaks the underlying networking, sync or related and thus will cause a fork." + color: bdadad + - name: F1-breaks_authoring + description: This change breaks authorities or authoring code. + color: e99695 + - name: F2-breaks_consensus + description: This change breaks consensus or consensus code. + color: "5319e7" + - name: F3-breaks_API + description: This PR changes public API; next release should be major. + color: cdadad + - name: I0-consensus + description: Issue can lead to a consensus failure. + color: f6d9e9 + - name: I1-panic + description: The node panics and exits without proper error handling. + color: 17b25d + - name: I10-enhancement + description: An additional feature request. + color: c2e0c6 + - name: I11-meta + description: A specific issue for grouping tasks or bugs of a specific category. + color: a2eeef + - name: I12-unconfirmed + description: "Issue might be valid, but it's not yet known." + color: "000000" + - name: I13-intended + description: Issue describes a behavior which turns out to work as intended. Closer should explain why. + color: b10d11 + - name: I14-duplicate + description: Issue is a duplicate. Closer should comment with a link to the duplicate. + color: D62209 + - name: I15-wont_fix + description: "Issue is in principle valid, but this project will not address it. Closer should explain why." + color: FB3701 + - name: I16-invalid + description: Issue is invalid. Closer should comment why. + color: F76E02 + - name: I2-security + description: "The node fails to follow expected, security-sensitive, behaviour." + color: d93f0b + - name: I3-bug + description: The node fails to follow expected behavior. + color: "249899" + - name: I4-annoyance + description: "The node behaves within expectations, however this “expected behaviour” itself is at issue." + color: D6075D + - name: I5-tests + description: "Tests need fixing, improving or augmenting." + color: 6C9C98 + - name: I6-documentation + description: "Documentation needs fixing, improving or augmenting." + color: f48a75 + - name: I7-refactor + description: Code needs refactoring. + color: 0075ca + - name: I8-footprint + description: "An enhancement to provide a smaller (system load, memory, network or disk) footprint." + color: "000000" + - name: I9-optimisation + description: An enhancement to provide better overall performance in terms of time-to-completion for a task. + color: c5def5 + - name: S0-design + description: Issue is in the design stage. + color: f3a603 + - name: S1-implement + description: Issue is in the implementation stage. + color: fbca04 + - name: S2-test/monitor + description: Issue is in the testing stage. + color: dbea04 + - name: S3-deploy + description: Issue is in the deployment stage + color: 34C302 + - name: S4-blocked + description: "Issue is blocked, see comments for further information." + color: "122381" + - name: T0-polkadot + description: This PR/Issue is related to Polkadot. + color: ffeeee + - name: T1-smart_contracts + description: This PR/Issue is related to smart contracts. + color: 0C7BAD + - name: T2-parachains + description: This PR/Issue is related to Parachains. + color: 0052cc + - name: T3-release + description: This PR/Issue is related to topics touching the release notes. + color: 0052cc + - name: T4-statemint + description: This PR/Issue is related to Statemint + color: 86e62a + - name: T5-CGP + description: This PR/Issue is related to Common Good Parachains. + color: BFDADC + - name: T6-XCM + description: This PR/Issue is related to XCM. + color: d4c5f9 + - name: T7-substrate + description: This is an issue that needs to be implemented upstream in Substrate. + color: 1d76db + - name: U0-drop_everything + description: Everyone should address the issue now. + color: "5319e7" + - name: U1-asap + description: "No need to stop dead in your tracks, however issue should be addressed as soon as possible." + color: fff4ed + - name: U2-some_time_soon + description: Issue is worth doing soon. + color: b60205 + - name: U3-nice_to_have + description: Issue is worth doing eventually. + color: FFF7ED + - name: U4-some_day_maybe + description: Issue might be worth doing eventually. + color: fffbed + - name: X0-node + description: This PR/Issue is related to the topic “node”. + color: fbffe0 + - name: X1-runtime + description: This PR/Issue is related to the topic “runtime”. + color: F5FCE6 + - name: X2-API + description: This PR/Issue is related to APIs. + color: 009B40 + +rules: + - name: Require a release label (B) + spec: + require: !one_of [ B* ] + + - name: Runtimes require an audit Label + when: !one_of [ X1 ] + spec: + require: !one_of [ D* ] + + - name: Release need priorities + when: !one_of [ B1 ] + spec: + require: !one_of [ P* ] + + - name: Release require some topics + when: !one_of [ B1 ] + spec: + require: !some_of [ X* ] diff --git a/scripts/ci/ruled_labels/test.sh b/scripts/ci/ruled_labels/test.sh new file mode 100755 index 00000000000..200f0927330 --- /dev/null +++ b/scripts/ci/ruled_labels/test.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +DIR=$(dirname -- "$0") +unset RUST_LOG + +pushd "$DIR" > /dev/null + +ruled-labels --version +ruled-labels test + +popd > /dev/null diff --git a/scripts/ci/ruled_labels/tests.yaml b/scripts/ci/ruled_labels/tests.yaml new file mode 100644 index 00000000000..d1b4c05bbd9 --- /dev/null +++ b/scripts/ci/ruled_labels/tests.yaml @@ -0,0 +1,23 @@ +name: Cumulus ruled-labels test cases +spec_file: specs.yaml + +specs: + - name: Pass - Pass all + labels: [ B1, P1, D1, X1 ] + expected: true + + - name: Fail - Require release label + labels: [ A1 ] + expected: false + + - name: Fail - Runtimes require an audit Label + labels: [ X1, B1, P1 ] + expected: false + + - name: Fail - Release need priorities + labels: [ B1, X1, D1 ] + expected: false + + - name: Fail - Release require some topics + labels: [ B1, P1, D1 ] + expected: false From 1b9bd116fa3fd90c553f2ad83f67016a0367f071 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Tue, 30 Aug 2022 18:03:53 +0200 Subject: [PATCH 02/53] add labels --- scripts/ci/github/check_labels_new.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/ci/github/check_labels_new.sh b/scripts/ci/github/check_labels_new.sh index c4484d94b71..6e41287661e 100755 --- a/scripts/ci/github/check_labels_new.sh +++ b/scripts/ci/github/check_labels_new.sh @@ -3,13 +3,14 @@ DIR=$(dirname -- "$0") # This is the new version using `ruled-labels` +api_base="https://api.github.com/repos" repo="$GITHUB_REPOSITORY" -pr="$GITHUB_PR" +pr_id="$GITHUB_PR" pushd "$DIR/../ruled_labels" > /dev/null -# TODO: Fetch the labels for the PR under test -labels=("B0-Silent" "X1-Runtime" "P1" "D1-audited 👍") +# Fetch the labels for the PR under test +labels=$(curl -H "Authorization: token $GITHUB_PR_TOKEN" -s "$api_base/$repo/pulls/$pr_id" | jq ".labels | .[] " | grep '"name":' | tr -d ',' | sed 's/ "name": //g' | tr -d '"' | awk '{ORS=" "} {print$NF}') ruled-labels --version -ruled-labels check --labels "${labels[@]}" +ruled-labels check --labels "${labels}" From ca08d7e98543a70c7a82f05325f72e4b1fa9e3cb Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Wed, 31 Aug 2022 15:49:30 +0200 Subject: [PATCH 03/53] Add new checks --- scripts/ci/ruled_labels/specs.yaml | 43 +++++++++++++++++++++++++++++- scripts/ci/ruled_labels/tests.yaml | 7 ++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index 441380e9873..61c9c88f4c2 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -200,21 +200,62 @@ labels: color: 009B40 rules: - - name: Require a release label (B) + - name: Require a single Release (B) label + id: single_b + tags: [ PR ] spec: require: !one_of [ B* ] + - name: Require a single Crticality (C) label + id: single_c + tags: [ PR ] + spec: + when: !some_of [ C* ] + require: !one_of [ C* ] + + - name: Require a single Auditing (D) label + id: single_d + tags: [ PR ] + spec: + when: !some_of [ D* ] + require: !one_of [ D* ] + + - name: Require a single issue status (S) label + id: single_s + tags: [ issue ] + spec: + when: !some_of [ S* ] + require: !one_of [ S* ] + + - name: Require a single Urgency status (U) label + id: single_u + tags: [ issue ] + spec: + when: !some_of [ U* ] + require: !one_of [ U* ] + - name: Runtimes require an audit Label + id: require_one_d_when_x1 + tags: [ PR ] when: !one_of [ X1 ] spec: require: !one_of [ D* ] - name: Release need priorities + id: require_one_p_when_b1 + tags: [ PR ] when: !one_of [ B1 ] spec: require: !one_of [ P* ] + - name: Release need topics + tags: [ PR ] + when: !one_of [ B1 ] + spec: + require: !some_of [ T* ] + - name: Release require some topics + tags: [ PR ] when: !one_of [ B1 ] spec: require: !some_of [ X* ] diff --git a/scripts/ci/ruled_labels/tests.yaml b/scripts/ci/ruled_labels/tests.yaml index d1b4c05bbd9..63dde0a597e 100644 --- a/scripts/ci/ruled_labels/tests.yaml +++ b/scripts/ci/ruled_labels/tests.yaml @@ -3,7 +3,12 @@ spec_file: specs.yaml specs: - name: Pass - Pass all - labels: [ B1, P1, D1, X1 ] + # Not supported yet: see https://github.com/chevdor/ruled_labels/issues/5 + filter: + id: single_.* + tags: [ PR ] + name: .*Urgency.* + labels: [ B1, P1, D1, X1, T4 ] expected: true - name: Fail - Require release label From 485bab8ad729b5b958374ffe42728f804af10eb7 Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Wed, 31 Aug 2022 16:43:15 +0200 Subject: [PATCH 04/53] Fix criticality check --- scripts/ci/ruled_labels/specs.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index 61c9c88f4c2..6c6a96d8710 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -206,13 +206,6 @@ rules: spec: require: !one_of [ B* ] - - name: Require a single Crticality (C) label - id: single_c - tags: [ PR ] - spec: - when: !some_of [ C* ] - require: !one_of [ C* ] - - name: Require a single Auditing (D) label id: single_d tags: [ PR ] @@ -259,3 +252,10 @@ rules: when: !one_of [ B1 ] spec: require: !some_of [ X* ] + + - name: Release needs criticality (C) + id: when_b1_require_one_c + tags: [ PR ] + when: !one_of [ B1 ] + spec: + require: !one_of [ C* ] From 0d395c17fc080e032f84d09bc48f29dd194b9ed9 Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 2 Sep 2022 12:59:07 +0200 Subject: [PATCH 05/53] Use the new rule filter introduced in ruled-labels v0.3.0 to better target tests --- scripts/ci/ruled_labels/specs.yaml | 2 ++ scripts/ci/ruled_labels/tests.yaml | 21 ++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index 6c6a96d8710..6e565b6a7e6 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -242,12 +242,14 @@ rules: require: !one_of [ P* ] - name: Release need topics + id: b_needs_t tags: [ PR ] when: !one_of [ B1 ] spec: require: !some_of [ T* ] - name: Release require some topics + id: b_needs_x tags: [ PR ] when: !one_of [ B1 ] spec: diff --git a/scripts/ci/ruled_labels/tests.yaml b/scripts/ci/ruled_labels/tests.yaml index 63dde0a597e..9cc7b19a796 100644 --- a/scripts/ci/ruled_labels/tests.yaml +++ b/scripts/ci/ruled_labels/tests.yaml @@ -3,26 +3,37 @@ spec_file: specs.yaml specs: - name: Pass - Pass all - # Not supported yet: see https://github.com/chevdor/ruled_labels/issues/5 filter: - id: single_.* - tags: [ PR ] - name: .*Urgency.* + id: [ single_b, single_d, single_u, single_s] labels: [ B1, P1, D1, X1, T4 ] expected: true - name: Fail - Require release label + filter: + id: [ single_b ] labels: [ A1 ] expected: false - name: Fail - Runtimes require an audit Label + filter: + id: [ require_one_d_when_x1 ] labels: [ X1, B1, P1 ] expected: false - name: Fail - Release need priorities + filter: + id: [ require_one_p_when_b1 ] labels: [ B1, X1, D1 ] expected: false - - name: Fail - Release require some topics + - name: Fail - Release require some T topics + filter: + id: [ b_needs_t ] + labels: [ B1, P1, D1 ] + expected: false + + - name: Fail - Release require some X topics + filter: + id: [ b_needs_x ] labels: [ B1, P1, D1 ] expected: false From 2b76ad38c4b7abcae72d0f1f963a1c48c8c29893 Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 2 Sep 2022 15:34:47 +0200 Subject: [PATCH 06/53] Add workflow to tests label rules --- .github/workflows/check-label-rules.yaml | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/check-label-rules.yaml diff --git a/.github/workflows/check-label-rules.yaml b/.github/workflows/check-label-rules.yaml new file mode 100644 index 00000000000..b595bfaeeaa --- /dev/null +++ b/.github/workflows/check-label-rules.yaml @@ -0,0 +1,27 @@ +name: Check label Rules + +on: + pull_request: + types: [labeled, opened, synchronize, unlabeled] + push: + paths: + - scripts/ci/ruled_labels/** + +jobs: + check-label-rules: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + + - name: Check label Rules + env: + IMAGE: chevdor/ruled-labels:latest + MOUNT: /work + TEST_SPECS: tests.yaml + run: | + docker run --rm -i --pull=always -v $PWD/scripts/ci/ruled_labels/:$MOUNT $IMAGE test $MOUNT/$TEST_SPECS From 22fa2f3f9ad7f745d3015f2906b49a4d94b2cad1 Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 2 Sep 2022 15:41:18 +0200 Subject: [PATCH 07/53] Fix trigger --- .github/workflows/check-label-rules.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/check-label-rules.yaml b/.github/workflows/check-label-rules.yaml index b595bfaeeaa..14d3315e2a9 100644 --- a/.github/workflows/check-label-rules.yaml +++ b/.github/workflows/check-label-rules.yaml @@ -1,8 +1,6 @@ name: Check label Rules on: - pull_request: - types: [labeled, opened, synchronize, unlabeled] push: paths: - scripts/ci/ruled_labels/** From 3fd9f9bed67e5ade03df16f1e13027bc630267eb Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 2 Sep 2022 15:53:30 +0200 Subject: [PATCH 08/53] Add new GH Workflow --- .github/workflows/check-labels-new.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/check-labels-new.yml diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml new file mode 100644 index 00000000000..a24ee97ee9f --- /dev/null +++ b/.github/workflows/check-labels-new.yml @@ -0,0 +1,24 @@ +name: Check labels (new) + +on: + pull_request: + types: [labeled, opened, synchronize, unlabeled] + +jobs: + check-labels: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - name: Check labels + run: | + bash ${{ github.workspace }}/scripts/ci/github/check_labels_new.sh || true + env: + GITHUB_PR: ${{ github.event.pull_request.number }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + BASE_SHA: ${{ github.event.pull_request.base.sha }} From e06eb5831eebfc1270442ec5d664c9a42e2bc10e Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 2 Sep 2022 16:23:10 +0200 Subject: [PATCH 09/53] Don't swallow failures but allow them --- .github/workflows/check-labels-new.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index a24ee97ee9f..2026e9d7f82 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -15,8 +15,9 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} - name: Check labels + continue-on-error: true run: | - bash ${{ github.workspace }}/scripts/ci/github/check_labels_new.sh || true + bash ${{ github.workspace }}/scripts/ci/github/check_labels_new.sh env: GITHUB_PR: ${{ github.event.pull_request.number }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 93432e29c403e651f7bb70d58c089b3e7441a862 Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 2 Sep 2022 17:18:05 +0200 Subject: [PATCH 10/53] Fix new script --- scripts/ci/github/check_labels_new.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/ci/github/check_labels_new.sh b/scripts/ci/github/check_labels_new.sh index 6e41287661e..3c3fcb2323f 100755 --- a/scripts/ci/github/check_labels_new.sh +++ b/scripts/ci/github/check_labels_new.sh @@ -7,10 +7,18 @@ api_base="https://api.github.com/repos" repo="$GITHUB_REPOSITORY" pr_id="$GITHUB_PR" +echo "repo: $repo" +echo "pr_ir: $pr_id" + pushd "$DIR/../ruled_labels" > /dev/null # Fetch the labels for the PR under test -labels=$(curl -H "Authorization: token $GITHUB_PR_TOKEN" -s "$api_base/$repo/pulls/$pr_id" | jq ".labels | .[] " | grep '"name":' | tr -d ',' | sed 's/ "name": //g' | tr -d '"' | awk '{ORS=" "} {print$NF}') +labels="$(curl -H "Authorization: token $GITHUB_PR_TOKEN" -s "$api_base/$repo/pulls/$pr_id" | jq ".labels | .[] | .name" | tr '\n' ' ')" + +echo "labels: $labels" ruled-labels --version -ruled-labels check --labels "${labels}" +cmd='ruled-labels check --labels '${labels[@]} +echo "cmd: $cmd" +bash -c "$cmd" +# ruled-labels check --labels ${labels[@]} From aeb4d43c83bb5c537af7df70b45446ee043a3c5a Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 2 Sep 2022 17:28:50 +0200 Subject: [PATCH 11/53] Simplify check --- .github/workflows/check-labels-new.yml | 19 +++++++++++++++++-- scripts/ci/github/check_labels_new.sh | 24 ------------------------ 2 files changed, 17 insertions(+), 26 deletions(-) delete mode 100755 scripts/ci/github/check_labels_new.sh diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 2026e9d7f82..2cca4d1e702 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -14,12 +14,27 @@ jobs: fetch-depth: 0 ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} + - name: Check labels continue-on-error: true - run: | - bash ${{ github.workspace }}/scripts/ci/github/check_labels_new.sh env: + IMAGE: chevdor/ruled-labels:latest + MOUNT: /work + CHECK_SPECS: tests.yaml GITHUB_PR: ${{ github.event.pull_request.number }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} HEAD_SHA: ${{ github.event.pull_request.head.sha }} BASE_SHA: ${{ github.event.pull_request.base.sha }} + API_BASE: https://api.github.com/repos + REPO: ${{ github.repository }} + PR_ID: ${{github.event.number}} + run: | + echo "repo: $REPO" + echo "pr_ir: $PR_ID" + + # Fetch the labels for the PR under test + labels="$(curl -H "Authorization: token $GITHUB_PR_TOKEN" -s "$API_BASE/$repo/pulls/$PR_ID" | jq ".labels | .[] | .name" | tr '\n' ' ')" + + docker pull $IMAGE + docker run --rm -i $IMAGE --version + docker run --rm -i -v $PWD/scripts/ci/ruled_labels/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels diff --git a/scripts/ci/github/check_labels_new.sh b/scripts/ci/github/check_labels_new.sh deleted file mode 100755 index 3c3fcb2323f..00000000000 --- a/scripts/ci/github/check_labels_new.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -DIR=$(dirname -- "$0") - -# This is the new version using `ruled-labels` -api_base="https://api.github.com/repos" -repo="$GITHUB_REPOSITORY" -pr_id="$GITHUB_PR" - -echo "repo: $repo" -echo "pr_ir: $pr_id" - -pushd "$DIR/../ruled_labels" > /dev/null - -# Fetch the labels for the PR under test -labels="$(curl -H "Authorization: token $GITHUB_PR_TOKEN" -s "$api_base/$repo/pulls/$pr_id" | jq ".labels | .[] | .name" | tr '\n' ' ')" - -echo "labels: $labels" - -ruled-labels --version -cmd='ruled-labels check --labels '${labels[@]} -echo "cmd: $cmd" -bash -c "$cmd" -# ruled-labels check --labels ${labels[@]} From d8025e0dcfc52dccc515b4bc7f535ed459aa0b0b Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 2 Sep 2022 18:05:19 +0200 Subject: [PATCH 12/53] Fix Workflow --- .github/workflows/check-labels-new.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 2cca4d1e702..c8644afb55b 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -23,18 +23,16 @@ jobs: CHECK_SPECS: tests.yaml GITHUB_PR: ${{ github.event.pull_request.number }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - HEAD_SHA: ${{ github.event.pull_request.head.sha }} - BASE_SHA: ${{ github.event.pull_request.base.sha }} API_BASE: https://api.github.com/repos REPO: ${{ github.repository }} PR_ID: ${{github.event.number}} run: | - echo "repo: $REPO" - echo "pr_ir: $PR_ID" + echo "REPO: $REPO" + echo "PR_ID: $PR_ID" # Fetch the labels for the PR under test - labels="$(curl -H "Authorization: token $GITHUB_PR_TOKEN" -s "$API_BASE/$repo/pulls/$PR_ID" | jq ".labels | .[] | .name" | tr '\n' ' ')" + labels=($( curl -H "Authorization: token $GITHUB_PR_TOKEN" -s "$API_BASE/$REPO/pulls/$PR_ID" | jq '.labels | .[] | .name' | tr '\n' ' ')) docker pull $IMAGE docker run --rm -i $IMAGE --version - docker run --rm -i -v $PWD/scripts/ci/ruled_labels/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels + echo $labels | xargs -I{} docker run --rm -i -v $PWD/scripts/ci/ruled_labels/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels {} From 40b009d3551795039214ea8cf1b40a20e92ded19 Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 2 Sep 2022 18:08:17 +0200 Subject: [PATCH 13/53] Remove dup var --- .github/workflows/check-labels-new.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index c8644afb55b..3099e2aa4e2 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -25,13 +25,12 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} API_BASE: https://api.github.com/repos REPO: ${{ github.repository }} - PR_ID: ${{github.event.number}} run: | echo "REPO: $REPO" - echo "PR_ID: $PR_ID" + echo "GITHUB_PR: $GITHUB_PR" # Fetch the labels for the PR under test - labels=($( curl -H "Authorization: token $GITHUB_PR_TOKEN" -s "$API_BASE/$REPO/pulls/$PR_ID" | jq '.labels | .[] | .name' | tr '\n' ' ')) + labels=($( curl -H "Authorization: token $GITHUB_PR_TOKEN" -s "$API_BASE/$REPO/pulls/$GITHUB_PR" | jq '.labels | .[] | .name' | tr '\n' ' ')) docker pull $IMAGE docker run --rm -i $IMAGE --version From b627874406494702cd5b688a73603666875f9709 Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 2 Sep 2022 18:12:18 +0200 Subject: [PATCH 14/53] Fix vars --- .github/workflows/check-labels-new.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 3099e2aa4e2..cfa8d125c0c 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -20,7 +20,7 @@ jobs: env: IMAGE: chevdor/ruled-labels:latest MOUNT: /work - CHECK_SPECS: tests.yaml + CHECK_SPECS: specs.yaml GITHUB_PR: ${{ github.event.pull_request.number }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} API_BASE: https://api.github.com/repos @@ -30,7 +30,7 @@ jobs: echo "GITHUB_PR: $GITHUB_PR" # Fetch the labels for the PR under test - labels=($( curl -H "Authorization: token $GITHUB_PR_TOKEN" -s "$API_BASE/$REPO/pulls/$GITHUB_PR" | jq '.labels | .[] | .name' | tr '\n' ' ')) + labels=($( curl -H "Authorization: token $GITHUB_TOKEN" -s "$API_BASE/$REPO/pulls/$GITHUB_PR" | jq '.labels | .[] | .name' | tr '\n' ' ')) docker pull $IMAGE docker run --rm -i $IMAGE --version From b650e2c9cd7292ab3e66ed5147d80b9680a6190c Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 2 Sep 2022 18:14:18 +0200 Subject: [PATCH 15/53] Move pull image to separate step --- .github/workflows/check-labels-new.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index cfa8d125c0c..cff0b295696 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -15,6 +15,11 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} + - name: Pull image + env: + IMAGE: chevdor/ruled-labels:latest + run: docker pull $IMAGE + - name: Check labels continue-on-error: true env: @@ -32,6 +37,5 @@ jobs: # Fetch the labels for the PR under test labels=($( curl -H "Authorization: token $GITHUB_TOKEN" -s "$API_BASE/$REPO/pulls/$GITHUB_PR" | jq '.labels | .[] | .name' | tr '\n' ' ')) - docker pull $IMAGE docker run --rm -i $IMAGE --version echo $labels | xargs -I{} docker run --rm -i -v $PWD/scripts/ci/ruled_labels/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels {} From 2f603e290e0646b9c0688b3668bf91cf4fa0277d Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 2 Sep 2022 18:15:16 +0200 Subject: [PATCH 16/53] Remove continue on error --- .github/workflows/check-labels-new.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index cff0b295696..251f04ce76c 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -21,7 +21,7 @@ jobs: run: docker pull $IMAGE - name: Check labels - continue-on-error: true + # continue-on-error: true env: IMAGE: chevdor/ruled-labels:latest MOUNT: /work From 7272cba79526f8b8fe2525eeba3e3df77435fe4d Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 2 Sep 2022 18:17:59 +0200 Subject: [PATCH 17/53] Show input list of labels --- .github/workflows/check-labels-new.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 251f04ce76c..7becb6e8004 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -36,6 +36,7 @@ jobs: # Fetch the labels for the PR under test labels=($( curl -H "Authorization: token $GITHUB_TOKEN" -s "$API_BASE/$REPO/pulls/$GITHUB_PR" | jq '.labels | .[] | .name' | tr '\n' ' ')) + printf "Checking labels: %s" $labels docker run --rm -i $IMAGE --version echo $labels | xargs -I{} docker run --rm -i -v $PWD/scripts/ci/ruled_labels/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels {} From 78cdc3c20a51bf48e506b5754d43d3d814fc6c89 Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Thu, 6 Oct 2022 19:26:03 +0200 Subject: [PATCH 18/53] Fix check-labels workflow --- .github/workflows/check-labels-new.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 7becb6e8004..5bd23dd4c43 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -18,7 +18,9 @@ jobs: - name: Pull image env: IMAGE: chevdor/ruled-labels:latest - run: docker pull $IMAGE + run: | + docker pull $IMAGE + docker run --rm -it $IMAGE --version - name: Check labels # continue-on-error: true @@ -35,8 +37,9 @@ jobs: echo "GITHUB_PR: $GITHUB_PR" # Fetch the labels for the PR under test - labels=($( curl -H "Authorization: token $GITHUB_TOKEN" -s "$API_BASE/$REPO/pulls/$GITHUB_PR" | jq '.labels | .[] | .name' | tr '\n' ' ')) - printf "Checking labels: %s" $labels + labels=$( curl -H "Authorization: token $GITHUB_TOKEN" -s "$API_BASE/$REPO/pulls/$GITHUB_PR" | jq '.labels | .[] | .name' | tr "\n" ",") + labels_args=${labels: :-1} + printf "Checking labels: %s\n" "$labels_args" - docker run --rm -i $IMAGE --version - echo $labels | xargs -I{} docker run --rm -i -v $PWD/scripts/ci/ruled_labels/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels {} + # --dev is more useful to debug mode to debug + docker run --rm -i -e labels_args -v $PWD/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --dev --labels $labels_args From 068a6aaa21dd4b618ca23919d0fcf802bc5bb4ca Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Thu, 6 Oct 2022 19:29:22 +0200 Subject: [PATCH 19/53] Remove Docker -it flags --- .github/workflows/check-labels-new.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 5bd23dd4c43..0ebec48e4a7 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -20,7 +20,7 @@ jobs: IMAGE: chevdor/ruled-labels:latest run: | docker pull $IMAGE - docker run --rm -it $IMAGE --version + docker run --rm $IMAGE --version - name: Check labels # continue-on-error: true @@ -42,4 +42,4 @@ jobs: printf "Checking labels: %s\n" "$labels_args" # --dev is more useful to debug mode to debug - docker run --rm -i -e labels_args -v $PWD/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --dev --labels $labels_args + docker run --rm -e labels_args -v $PWD/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --dev --labels $labels_args From fbeb7fc977684391939c74193652ad0d5abaf743 Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Thu, 6 Oct 2022 19:44:08 +0200 Subject: [PATCH 20/53] Prevent shell from splitting on spaces --- .github/workflows/check-labels-new.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 0ebec48e4a7..452db59382f 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -41,5 +41,7 @@ jobs: labels_args=${labels: :-1} printf "Checking labels: %s\n" "$labels_args" + # Prevent the shell from splitting labels with spaces + IFS="," # --dev is more useful to debug mode to debug docker run --rm -e labels_args -v $PWD/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --dev --labels $labels_args From 36fea895f87bd2ba7e339a1f9d1cf5f1a0c3c6ba Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Thu, 6 Oct 2022 19:46:51 +0200 Subject: [PATCH 21/53] Fix rules path --- .github/workflows/check-labels-new.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 452db59382f..5b007067ab9 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -32,6 +32,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} API_BASE: https://api.github.com/repos REPO: ${{ github.repository }} + RULES_PATH: scripts/ci/ruled_labels run: | echo "REPO: $REPO" echo "GITHUB_PR: $GITHUB_PR" @@ -44,4 +45,4 @@ jobs: # Prevent the shell from splitting labels with spaces IFS="," # --dev is more useful to debug mode to debug - docker run --rm -e labels_args -v $PWD/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --dev --labels $labels_args + docker run --rm -e labels_args -v $PWD/$RULES_PATH:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --dev --labels $labels_args From 2747a66f9aa47cfed8d0812247bdd5b2fc62491c Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Thu, 6 Oct 2022 19:49:53 +0200 Subject: [PATCH 22/53] Comment out rules related to labels not present in the repo --- scripts/ci/ruled_labels/specs.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index 6e565b6a7e6..ff5b95a3211 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -234,12 +234,13 @@ rules: spec: require: !one_of [ D* ] - - name: Release need priorities - id: require_one_p_when_b1 - tags: [ PR ] - when: !one_of [ B1 ] - spec: - require: !one_of [ P* ] + # We don't have those P labels yet + # - name: Release need priorities + # id: require_one_p_when_b1 + # tags: [ PR ] + # when: !one_of [ B1 ] + # spec: + # require: !one_of [ P* ] - name: Release need topics id: b_needs_t From a8a58029ae80235220e2590f178c9029a694daa6 Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Thu, 6 Oct 2022 19:53:06 +0200 Subject: [PATCH 23/53] Fix tests --- scripts/ci/ruled_labels/tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci/ruled_labels/tests.yaml b/scripts/ci/ruled_labels/tests.yaml index 9cc7b19a796..1fc60e5f839 100644 --- a/scripts/ci/ruled_labels/tests.yaml +++ b/scripts/ci/ruled_labels/tests.yaml @@ -21,6 +21,7 @@ specs: expected: false - name: Fail - Release need priorities + skip: true filter: id: [ require_one_p_when_b1 ] labels: [ B1, X1, D1 ] From f5eaa51f82aab5277d31eeeb9155d54b3254ce7a Mon Sep 17 00:00:00 2001 From: Joyce Siqueira Date: Fri, 7 Oct 2022 17:06:24 +0200 Subject: [PATCH 24/53] Fix labels specs and tests --- scripts/ci/ruled_labels/specs.yaml | 107 +++++++++++++---------------- scripts/ci/ruled_labels/tests.yaml | 24 +++---- 2 files changed, 58 insertions(+), 73 deletions(-) diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index ff5b95a3211..7a1c2d8ba94 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -90,27 +90,6 @@ labels: - name: I1-panic description: The node panics and exits without proper error handling. color: 17b25d - - name: I10-enhancement - description: An additional feature request. - color: c2e0c6 - - name: I11-meta - description: A specific issue for grouping tasks or bugs of a specific category. - color: a2eeef - - name: I12-unconfirmed - description: "Issue might be valid, but it's not yet known." - color: "000000" - - name: I13-intended - description: Issue describes a behavior which turns out to work as intended. Closer should explain why. - color: b10d11 - - name: I14-duplicate - description: Issue is a duplicate. Closer should comment with a link to the duplicate. - color: D62209 - - name: I15-wont_fix - description: "Issue is in principle valid, but this project will not address it. Closer should explain why." - color: FB3701 - - name: I16-invalid - description: Issue is invalid. Closer should comment why. - color: F76E02 - name: I2-security description: "The node fails to follow expected, security-sensitive, behaviour." color: d93f0b @@ -135,6 +114,27 @@ labels: - name: I9-optimisation description: An enhancement to provide better overall performance in terms of time-to-completion for a task. color: c5def5 + - name: J0-enhancement + description: An additional feature request. + color: c2e0c6 + - name: J1-meta + description: A specific issue for grouping tasks or bugs of a specific category. + color: a2eeef + - name: J2-unconfirmed + description: "Issue might be valid, but it's not yet known." + color: "000000" + - name: J3-intended + description: Issue describes a behavior which turns out to work as intended. Closer should explain why. + color: b10d11 + - name: J4-duplicate + description: Issue is a duplicate. Closer should comment with a link to the duplicate. + color: D62209 + - name: J5-wont_fix + description: "Issue is in principle valid, but this project will not address it. Closer should explain why." + color: FB3701 + - name: J6-invalid + description: Issue is invalid. Closer should comment why. + color: F76E02 - name: S0-design description: Issue is in the design stage. color: f3a603 @@ -206,59 +206,44 @@ rules: spec: require: !one_of [ B* ] - - name: Require a single Auditing (D) label - id: single_d + - name: Release mentions need criticality (C) + id: require_one_c_when_b1 tags: [ PR ] spec: - when: !some_of [ D* ] - require: !one_of [ D* ] + when: !one_of [ B1 ] + require: !one_of [ C* ] + + - name: Release mentions need a topic (X) + id: require_one_x_when_b1 + tags: [ PR ] + spec: + when: !one_of [ B1 ] + require: !one_of [ X* ] - - name: Require a single issue status (S) label + - name: One single issue status (S) label allowed id: single_s - tags: [ issue ] + tags: spec: when: !some_of [ S* ] require: !one_of [ S* ] - - name: Require a single Urgency status (U) label + - name: One single urgency status (U) label allowed id: single_u - tags: [ issue ] + tags: spec: when: !some_of [ U* ] require: !one_of [ U* ] - - name: Runtimes require an audit Label - id: require_one_d_when_x1 - tags: [ PR ] - when: !one_of [ X1 ] + - name: One single criticality (C) label allowed + id: single_c + tags: spec: - require: !one_of [ D* ] - - # We don't have those P labels yet - # - name: Release need priorities - # id: require_one_p_when_b1 - # tags: [ PR ] - # when: !one_of [ B1 ] - # spec: - # require: !one_of [ P* ] - - - name: Release need topics - id: b_needs_t - tags: [ PR ] - when: !one_of [ B1 ] - spec: - require: !some_of [ T* ] - - - name: Release require some topics - id: b_needs_x - tags: [ PR ] - when: !one_of [ B1 ] - spec: - require: !some_of [ X* ] - - - name: Release needs criticality (C) - id: when_b1_require_one_c + when: !some_of [ C* ] + require: !one_of [ C* ] + + - name: One single audit (D) label allowed + id: single_d tags: [ PR ] - when: !one_of [ B1 ] spec: - require: !one_of [ C* ] + when: !some_of [ D* ] + require: !one_of [ D* ] \ No newline at end of file diff --git a/scripts/ci/ruled_labels/tests.yaml b/scripts/ci/ruled_labels/tests.yaml index 1fc60e5f839..3c534c66c60 100644 --- a/scripts/ci/ruled_labels/tests.yaml +++ b/scripts/ci/ruled_labels/tests.yaml @@ -5,7 +5,7 @@ specs: - name: Pass - Pass all filter: id: [ single_b, single_d, single_u, single_s] - labels: [ B1, P1, D1, X1, T4 ] + labels: [ B1, C1, D1, X1, T4 ] expected: true - name: Fail - Require release label @@ -14,27 +14,27 @@ specs: labels: [ A1 ] expected: false - - name: Fail - Runtimes require an audit Label + - name: Fail - Only one audit label allowed filter: id: [ require_one_d_when_x1 ] - labels: [ X1, B1, P1 ] + labels: [ D1, B1, D4 ] expected: false - - name: Fail - Release need priorities - skip: true + + - name: Fail - Release need criticality filter: - id: [ require_one_p_when_b1 ] + id: [ require_one_c_when_b1 ] labels: [ B1, X1, D1 ] expected: false - - name: Fail - Release require some T topics + - name: Fail - Release require one X topics filter: - id: [ b_needs_t ] - labels: [ B1, P1, D1 ] + id: [ require_one_x_when_b1 ] + labels: [ B1, T0, D1 ] expected: false - - name: Fail - Release require some X topics + - name: Fail - Only one criticality label allowed filter: - id: [ b_needs_x ] - labels: [ B1, P1, D1 ] + id: [ single_c ] + labels: [ B1, C1, C3 ] expected: false From 480ff656d9114242fa03118fb635bc86d0ce2802 Mon Sep 17 00:00:00 2001 From: joyce Date: Tue, 11 Oct 2022 10:13:15 +0100 Subject: [PATCH 25/53] fix test --- scripts/ci/ruled_labels/tests.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/ci/ruled_labels/tests.yaml b/scripts/ci/ruled_labels/tests.yaml index 3c534c66c60..10f27a5da28 100644 --- a/scripts/ci/ruled_labels/tests.yaml +++ b/scripts/ci/ruled_labels/tests.yaml @@ -16,11 +16,10 @@ specs: - name: Fail - Only one audit label allowed filter: - id: [ require_one_d_when_x1 ] + id: [ single_d ] labels: [ D1, B1, D4 ] expected: false - - name: Fail - Release need criticality filter: id: [ require_one_c_when_b1 ] From bef76f970c0129d0473cadf3146e5929ed699086 Mon Sep 17 00:00:00 2001 From: Joyce Siqueira <98593770+the-right-joyce@users.noreply.github.com> Date: Mon, 31 Oct 2022 09:57:30 +0100 Subject: [PATCH 26/53] new label description and rules --- scripts/ci/ruled_labels/specs.yaml | 42 +++++++++++++++--------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index 7a1c2d8ba94..0a020e0a8b5 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -31,17 +31,17 @@ labels: description: Changes should be noted in the release notes color: f9d0c4 - name: C1-low - description: "Elevates a release containing this PR to \"low priority\"." - color: fcdfc3 + description: "PR touches the given topic and has a low impact on builders." + color: EBF7B3 - name: C3-medium - description: "Elevates a release containing this PR to \"medium priority\"." - color: FFE9C0 + description: "PR touches the given topic and has a medium impact on builders.." + color: FEF2C0 - name: C5-high - description: "Elevates a release containing this PR to \"high priority\"." - color: fef2c0 + description: "PR touches the given topic and has a high impact on builders." + color: D4C5F9 - name: C7-critical - description: "Elevates a release containing this PR to \"critical priority\"." - color: fef2c0 + description: "PR touches the given topic and has a critical impact on builders." + color: E99695 - name: D1-audited 👍 description: PR contains changes to fund-managing logic that has been properly reviewed and externally audited. color: C0E7CC @@ -150,28 +150,28 @@ labels: - name: S4-blocked description: "Issue is blocked, see comments for further information." color: "122381" - - name: T0-polkadot - description: This PR/Issue is related to Polkadot. + - name: T3-relay_chain + description: This PR/Issue is related to the relay chain. color: ffeeee - - name: T1-smart_contracts + - name: T4-smart_contracts description: This PR/Issue is related to smart contracts. color: 0C7BAD - - name: T2-parachains + - name: T5-parachains description: This PR/Issue is related to Parachains. color: 0052cc - - name: T3-release + - name: T10-release description: This PR/Issue is related to topics touching the release notes. color: 0052cc - - name: T4-statemint + - name: T7-statemint description: This PR/Issue is related to Statemint color: 86e62a - - name: T5-CGP + - name: T8-CGP description: This PR/Issue is related to Common Good Parachains. color: BFDADC - name: T6-XCM description: This PR/Issue is related to XCM. color: d4c5f9 - - name: T7-substrate + - name: T9-substrate description: This is an issue that needs to be implemented upstream in Substrate. color: 1d76db - name: U0-drop_everything @@ -189,13 +189,13 @@ labels: - name: U4-some_day_maybe description: Issue might be worth doing eventually. color: fffbed - - name: X0-node + - name: T0-node description: This PR/Issue is related to the topic “node”. color: fbffe0 - - name: X1-runtime + - name: T1-runtime description: This PR/Issue is related to the topic “runtime”. color: F5FCE6 - - name: X2-API + - name: T2-API description: This PR/Issue is related to APIs. color: 009B40 @@ -213,12 +213,12 @@ rules: when: !one_of [ B1 ] require: !one_of [ C* ] - - name: Release mentions need a topic (X) + - name: Release mentions need a topic (T) id: require_one_x_when_b1 tags: [ PR ] spec: when: !one_of [ B1 ] - require: !one_of [ X* ] + require: !one_of [ T* ] - name: One single issue status (S) label allowed id: single_s From 790010b21fcc5d1ca9df2a3872ff0fe8e1ce81ee Mon Sep 17 00:00:00 2001 From: Joyce Siqueira <98593770+the-right-joyce@users.noreply.github.com> Date: Mon, 31 Oct 2022 10:32:17 +0100 Subject: [PATCH 27/53] fix tests --- scripts/ci/ruled_labels/specs.yaml | 2 +- scripts/ci/ruled_labels/tests.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index 0a020e0a8b5..723ca92ab11 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -214,7 +214,7 @@ rules: require: !one_of [ C* ] - name: Release mentions need a topic (T) - id: require_one_x_when_b1 + id: require_one_t_when_b1 tags: [ PR ] spec: when: !one_of [ B1 ] diff --git a/scripts/ci/ruled_labels/tests.yaml b/scripts/ci/ruled_labels/tests.yaml index 10f27a5da28..f7c1e4fae7e 100644 --- a/scripts/ci/ruled_labels/tests.yaml +++ b/scripts/ci/ruled_labels/tests.yaml @@ -23,13 +23,13 @@ specs: - name: Fail - Release need criticality filter: id: [ require_one_c_when_b1 ] - labels: [ B1, X1, D1 ] + labels: [ B1, T1, D1 ] expected: false - - name: Fail - Release require one X topics + - name: Fail - Release require one T topics filter: - id: [ require_one_x_when_b1 ] - labels: [ B1, T0, D1 ] + id: [ require_one_t_when_b1 ] + labels: [ B1, D1 ] expected: false - name: Fail - Only one criticality label allowed From f4a1c60b2d336879b195f8ae2e299baeff99461d Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 9 Nov 2022 11:14:44 +0100 Subject: [PATCH 28/53] use ruled_labels as crate --- .github/workflows/check-labels-new.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 5b007067ab9..219fa533af8 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -15,12 +15,19 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Pull image - env: - IMAGE: chevdor/ruled-labels:latest - run: | - docker pull $IMAGE - docker run --rm $IMAGE --version + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + override: true + components: ruled-labels + + # - name: Pull image + # env: + # IMAGE: chevdor/ruled-labels:latest + # run: | + # docker pull $IMAGE + # docker run --rm $IMAGE --version - name: Check labels # continue-on-error: true @@ -42,7 +49,9 @@ jobs: labels_args=${labels: :-1} printf "Checking labels: %s\n" "$labels_args" + cd $RULES_PATH # Prevent the shell from splitting labels with spaces IFS="," + ruled-labels check --labels $labels_args --dev # --dev is more useful to debug mode to debug - docker run --rm -e labels_args -v $PWD/$RULES_PATH:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --dev --labels $labels_args + # docker run --rm -e labels_args -v $PWD/$RULES_PATH:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --dev --labels $labels_args From 03445dbdc9808b17531ec22e997c6be4a93ea468 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 9 Nov 2022 11:20:11 +0100 Subject: [PATCH 29/53] fix toolchain --- .github/workflows/check-labels-new.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 219fa533af8..5a5fabc487d 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -18,8 +18,7 @@ jobs: - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - profile: minimal - override: true + toolchain: stable components: ruled-labels # - name: Pull image From fcc1be99931f7bcb03a69b83ecae90379a0f8f5a Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 9 Nov 2022 11:24:58 +0100 Subject: [PATCH 30/53] fix component --- .github/workflows/check-labels-new.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 5a5fabc487d..6776334687e 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -19,7 +19,6 @@ jobs: uses: actions-rs/toolchain@v1 with: toolchain: stable - components: ruled-labels # - name: Pull image # env: @@ -40,6 +39,7 @@ jobs: REPO: ${{ github.repository }} RULES_PATH: scripts/ci/ruled_labels run: | + cargo install ruled-labels --version 0.3.1 echo "REPO: $REPO" echo "GITHUB_PR: $GITHUB_PR" From 768e5d77935bbb57813d7aad1c0d7bea237acad2 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 9 Nov 2022 11:45:08 +0100 Subject: [PATCH 31/53] move from docker to crate --- .github/workflows/check-label-rules.yaml | 12 ++++--- .github/workflows/check-labels-new.yml | 22 ++++--------- scripts/ci/ruled_labels/specs.yaml | 40 ++++++++++++------------ 3 files changed, 34 insertions(+), 40 deletions(-) diff --git a/.github/workflows/check-label-rules.yaml b/.github/workflows/check-label-rules.yaml index 14d3315e2a9..199fe8432a8 100644 --- a/.github/workflows/check-label-rules.yaml +++ b/.github/workflows/check-label-rules.yaml @@ -16,10 +16,14 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Check label Rules env: - IMAGE: chevdor/ruled-labels:latest - MOUNT: /work - TEST_SPECS: tests.yaml + RULES_PATH: scripts/ci/ruled_labels run: | - docker run --rm -i --pull=always -v $PWD/scripts/ci/ruled_labels/:$MOUNT $IMAGE test $MOUNT/$TEST_SPECS + cargo install ruled-labels --version 0.3.1 + ruled-labels ${RULES_PATH}/specs.yaml diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 6776334687e..ea43eb6c260 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -20,18 +20,9 @@ jobs: with: toolchain: stable - # - name: Pull image - # env: - # IMAGE: chevdor/ruled-labels:latest - # run: | - # docker pull $IMAGE - # docker run --rm $IMAGE --version - - name: Check labels # continue-on-error: true env: - IMAGE: chevdor/ruled-labels:latest - MOUNT: /work CHECK_SPECS: specs.yaml GITHUB_PR: ${{ github.event.pull_request.number }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -40,17 +31,16 @@ jobs: RULES_PATH: scripts/ci/ruled_labels run: | cargo install ruled-labels --version 0.3.1 - echo "REPO: $REPO" - echo "GITHUB_PR: $GITHUB_PR" + echo "REPO: ${REPO}" + echo "GITHUB_PR: ${GITHUB_PR}" # Fetch the labels for the PR under test - labels=$( curl -H "Authorization: token $GITHUB_TOKEN" -s "$API_BASE/$REPO/pulls/$GITHUB_PR" | jq '.labels | .[] | .name' | tr "\n" ",") + labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",") labels_args=${labels: :-1} - printf "Checking labels: %s\n" "$labels_args" + printf "Checking labels: %s\n" "${labels_args}" - cd $RULES_PATH # Prevent the shell from splitting labels with spaces IFS="," - ruled-labels check --labels $labels_args --dev + # --dev is more useful to debug mode to debug - # docker run --rm -e labels_args -v $PWD/$RULES_PATH:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --dev --labels $labels_args + ruled-labels check --labels ${labels_args} --dev ${RULES_PATH}/${CHECK_SPECS} diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index 723ca92ab11..cd307ec6f49 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -202,48 +202,48 @@ labels: rules: - name: Require a single Release (B) label id: single_b - tags: [ PR ] + tags: [PR] spec: - require: !one_of [ B* ] + require: !one_of [B*] - name: Release mentions need criticality (C) id: require_one_c_when_b1 - tags: [ PR ] + tags: [PR] spec: - when: !one_of [ B1 ] - require: !one_of [ C* ] + when: !one_of [B1] + require: !one_of [C*] - name: Release mentions need a topic (T) id: require_one_t_when_b1 - tags: [ PR ] + tags: [PR] spec: - when: !one_of [ B1 ] - require: !one_of [ T* ] + when: !one_of [B1] + require: !one_of [T*] - name: One single issue status (S) label allowed id: single_s tags: spec: - when: !some_of [ S* ] - require: !one_of [ S* ] + when: !some_of [S*] + require: !one_of [S*] - name: One single urgency status (U) label allowed id: single_u - tags: + tags: spec: - when: !some_of [ U* ] - require: !one_of [ U* ] + when: !some_of [U*] + require: !one_of [U*] - name: One single criticality (C) label allowed id: single_c - tags: + tags: spec: - when: !some_of [ C* ] - require: !one_of [ C* ] - + when: !some_of [C*] + require: !one_of [C*] + - name: One single audit (D) label allowed id: single_d - tags: [ PR ] + tags: [PR] spec: - when: !some_of [ D* ] - require: !one_of [ D* ] \ No newline at end of file + when: !some_of [D*] + require: !one_of [D*] From fa42ebb6b68759a53f57acc75669e3729bcbd03b Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 9 Nov 2022 11:52:36 +0100 Subject: [PATCH 32/53] fix test --- .github/workflows/check-label-rules.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-label-rules.yaml b/.github/workflows/check-label-rules.yaml index 199fe8432a8..bd8c707cfd2 100644 --- a/.github/workflows/check-label-rules.yaml +++ b/.github/workflows/check-label-rules.yaml @@ -26,4 +26,4 @@ jobs: RULES_PATH: scripts/ci/ruled_labels run: | cargo install ruled-labels --version 0.3.1 - ruled-labels ${RULES_PATH}/specs.yaml + ruled-labels test ${RULES_PATH}/specs.yaml From d5c0018afbe16d1fbe45f74ed9481d8cfbf61e31 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 9 Nov 2022 12:40:17 +0100 Subject: [PATCH 33/53] fail without labels --- .github/workflows/check-labels-new.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index ea43eb6c260..b70b0cd8605 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -36,7 +36,7 @@ jobs: # Fetch the labels for the PR under test labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",") - labels_args=${labels: :-1} + labels_args=${labels: :-1} || echo "Please set labels"; exit 1 printf "Checking labels: %s\n" "${labels_args}" # Prevent the shell from splitting labels with spaces From 7dc0a98250abe1a652f4f54a516b7f63405fc410 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 9 Nov 2022 12:43:16 +0100 Subject: [PATCH 34/53] add cache --- .github/workflows/check-label-rules.yaml | 3 +++ .github/workflows/check-labels-new.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/check-label-rules.yaml b/.github/workflows/check-label-rules.yaml index bd8c707cfd2..61afb8ab894 100644 --- a/.github/workflows/check-label-rules.yaml +++ b/.github/workflows/check-label-rules.yaml @@ -21,6 +21,9 @@ jobs: with: toolchain: stable + - name: Rust Cache + uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd # v2.1.0 + - name: Check label Rules env: RULES_PATH: scripts/ci/ruled_labels diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index b70b0cd8605..f9467691a11 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -20,6 +20,9 @@ jobs: with: toolchain: stable + - name: Rust Cache + uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd # v2.1.0 + - name: Check labels # continue-on-error: true env: From 04397d05639a1c1f2251e198d45581d7fcc69c61 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 9 Nov 2022 12:54:59 +0100 Subject: [PATCH 35/53] fix check no labels --- .github/workflows/check-labels-new.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index f9467691a11..932df5a3569 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -39,7 +39,8 @@ jobs: # Fetch the labels for the PR under test labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",") - labels_args=${labels: :-1} || echo "Please set labels"; exit 1 + [ -z "${labels}" ] && echo "Please add labels"; exit 1 + labels_args=${labels: :-1} printf "Checking labels: %s\n" "${labels_args}" # Prevent the shell from splitting labels with spaces From aa8be5b1cbc3e22da9b81cc50e561668d7789c08 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 9 Nov 2022 13:40:41 +0100 Subject: [PATCH 36/53] add D-labels check --- .github/workflows/check-D-labels.yml | 53 ++++++++++++++++++++++++ .github/workflows/check-label-rules.yaml | 3 -- .github/workflows/check-labels-new.yml | 8 ++-- scripts/ci/ruled_labels/specs-D.yaml | 26 ++++++++++++ 4 files changed, 82 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/check-D-labels.yml create mode 100644 scripts/ci/ruled_labels/specs-D.yaml diff --git a/.github/workflows/check-D-labels.yml b/.github/workflows/check-D-labels.yml new file mode 100644 index 00000000000..8e259f21d8d --- /dev/null +++ b/.github/workflows/check-D-labels.yml @@ -0,0 +1,53 @@ +name: Check D labels + +on: + pull_request: + types: [labeled, opened, synchronize, unlabeled] + paths: + - runtime/common/** + - runtime/polkadot/** + - runtime/kusama/** + - primitives/src/** + +jobs: + check-labels: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - name: Check labels + # continue-on-error: true + env: + GITHUB_PR: ${{ github.event.pull_request.number }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + API_BASE: https://api.github.com/repos + REPO: ${{ github.repository }} + RULES_PATH: scripts/ci/ruled_labels + CHECK_SPECS: specs-D.yaml + run: | + cargo install ruled-labels --version 0.3.1 + echo "REPO: ${REPO}" + echo "GITHUB_PR: ${GITHUB_PR}" + + # Fetch the labels for the PR under test + labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",") + + [ -z "${labels}" ] && echo "No labels found. Please add D label"; exit 1 + labels_args=${labels: :-1} + printf "Checking labels: %s\n" "${labels_args}" + + # Prevent the shell from splitting labels with spaces + IFS="," + + # --dev is more useful to debug mode to debug + ruled-labels check --labels ${labels_args} --dev ${RULES_PATH}/${CHECK_SPECS} diff --git a/.github/workflows/check-label-rules.yaml b/.github/workflows/check-label-rules.yaml index 61afb8ab894..bd8c707cfd2 100644 --- a/.github/workflows/check-label-rules.yaml +++ b/.github/workflows/check-label-rules.yaml @@ -21,9 +21,6 @@ jobs: with: toolchain: stable - - name: Rust Cache - uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd # v2.1.0 - - name: Check label Rules env: RULES_PATH: scripts/ci/ruled_labels diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 932df5a3569..cf4b846d46b 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -20,18 +20,15 @@ jobs: with: toolchain: stable - - name: Rust Cache - uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd # v2.1.0 - - name: Check labels # continue-on-error: true env: - CHECK_SPECS: specs.yaml GITHUB_PR: ${{ github.event.pull_request.number }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} API_BASE: https://api.github.com/repos REPO: ${{ github.repository }} RULES_PATH: scripts/ci/ruled_labels + CHECK_SPECS: specs.yaml run: | cargo install ruled-labels --version 0.3.1 echo "REPO: ${REPO}" @@ -39,7 +36,8 @@ jobs: # Fetch the labels for the PR under test labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",") - [ -z "${labels}" ] && echo "Please add labels"; exit 1 + + [ -z "${labels}" ] && echo "No labels found. Please add labels A, B and C labels"; exit 1 labels_args=${labels: :-1} printf "Checking labels: %s\n" "${labels_args}" diff --git a/scripts/ci/ruled_labels/specs-D.yaml b/scripts/ci/ruled_labels/specs-D.yaml new file mode 100644 index 00000000000..0f6f21c81f0 --- /dev/null +++ b/scripts/ci/ruled_labels/specs-D.yaml @@ -0,0 +1,26 @@ +--- +name: paritytech/cumulus +description: Import from paritytech/cumulus +version: 0.0.1 +labels: + - name: D1-audited 👍 + description: PR contains changes to fund-managing logic that has been properly reviewed and externally audited. + color: C0E7CC + - name: D2-notlive 💤 + description: PR contains changes in a runtime directory that is not deployed to a chain that requires an audit. + color: C209B4 + - name: D3-trivial 🧸 + description: PR contains trivial changes in a runtime directory that do not require an audit + color: 5EDFEE + - name: D5-nicetohaveaudit ⚠️ + description: PR contains trivial changes to logic that should be properly reviewed. + color: c5def5 + - name: D9-needsaudit 👮 + description: PR contains changes to fund-managing logic that should be properly reviewed and externally audited + color: C3EDC0 +rules: + - name: Require single audit (D) label allowed + id: single_d + tags: [PR] + spec: + require: !one_of [D*] From efac3a0e94eb1ce1b58e1ac5ef5baa55ffe634b3 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 9 Nov 2022 13:54:31 +0100 Subject: [PATCH 37/53] fix emtpy label check --- .github/workflows/check-D-labels.yml | 6 +++++- .github/workflows/check-labels-new.yml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-D-labels.yml b/.github/workflows/check-D-labels.yml index 8e259f21d8d..b9c9fc60c78 100644 --- a/.github/workflows/check-D-labels.yml +++ b/.github/workflows/check-D-labels.yml @@ -42,7 +42,11 @@ jobs: # Fetch the labels for the PR under test labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",") - [ -z "${labels}" ] && echo "No labels found. Please add D label"; exit 1 + if [ -z "${labels}" ]; then + echo "No labels found. Please add labels D labels" + exit 1 + fi + labels_args=${labels: :-1} printf "Checking labels: %s\n" "${labels_args}" diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index cf4b846d46b..9fbe89175e2 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -37,7 +37,11 @@ jobs: # Fetch the labels for the PR under test labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",") - [ -z "${labels}" ] && echo "No labels found. Please add labels A, B and C labels"; exit 1 + if [ -z "${labels}" ]; then + echo "No labels found. Please add labels A, B and C labels" + exit 1 + fi + labels_args=${labels: :-1} printf "Checking labels: %s\n" "${labels_args}" From 66f7475de04f96115f803c472f83ace5c06ba3c6 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Thu, 10 Nov 2022 12:53:18 +0100 Subject: [PATCH 38/53] try docker --- .github/workflows/check-labels-new.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 9fbe89175e2..d3a5c63d20f 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -15,14 +15,16 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable + - name: Pull image + env: + IMAGE: paritytech/ruled_labels:0.3.1 + run: docker pull $IMAGE - name: Check labels # continue-on-error: true env: + IMAGE: paritytech/ruled_labels:0.3.1 + MOUNT: /work GITHUB_PR: ${{ github.event.pull_request.number }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} API_BASE: https://api.github.com/repos @@ -30,7 +32,6 @@ jobs: RULES_PATH: scripts/ci/ruled_labels CHECK_SPECS: specs.yaml run: | - cargo install ruled-labels --version 0.3.1 echo "REPO: ${REPO}" echo "GITHUB_PR: ${GITHUB_PR}" @@ -49,4 +50,4 @@ jobs: IFS="," # --dev is more useful to debug mode to debug - ruled-labels check --labels ${labels_args} --dev ${RULES_PATH}/${CHECK_SPECS} + docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels ${labels_args} From 86401c9846c8fd18adfc831171abcaa667b7d412 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Thu, 10 Nov 2022 13:42:10 +0100 Subject: [PATCH 39/53] fix specs --- .github/workflows/check-D-labels.yml | 14 +++---- .github/workflows/check-label-rules.yaml | 14 ++++--- .github/workflows/check-labels-new.yml | 3 +- scripts/ci/ruled_labels/specs-D.yaml | 4 +- scripts/ci/ruled_labels/specs.yaml | 49 +++++++----------------- 5 files changed, 32 insertions(+), 52 deletions(-) diff --git a/.github/workflows/check-D-labels.yml b/.github/workflows/check-D-labels.yml index b9c9fc60c78..30feba6367e 100644 --- a/.github/workflows/check-D-labels.yml +++ b/.github/workflows/check-D-labels.yml @@ -20,14 +20,15 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable + - name: Pull image + env: + IMAGE: paritytech/ruled_labels:0.3.1 + run: docker pull $IMAGE - name: Check labels - # continue-on-error: true env: + IMAGE: paritytech/ruled_labels:0.3.1 + MOUNT: /work GITHUB_PR: ${{ github.event.pull_request.number }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} API_BASE: https://api.github.com/repos @@ -35,7 +36,6 @@ jobs: RULES_PATH: scripts/ci/ruled_labels CHECK_SPECS: specs-D.yaml run: | - cargo install ruled-labels --version 0.3.1 echo "REPO: ${REPO}" echo "GITHUB_PR: ${GITHUB_PR}" @@ -54,4 +54,4 @@ jobs: IFS="," # --dev is more useful to debug mode to debug - ruled-labels check --labels ${labels_args} --dev ${RULES_PATH}/${CHECK_SPECS} + docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels ${labels_args} --dev diff --git a/.github/workflows/check-label-rules.yaml b/.github/workflows/check-label-rules.yaml index bd8c707cfd2..0cf9d4d5b04 100644 --- a/.github/workflows/check-label-rules.yaml +++ b/.github/workflows/check-label-rules.yaml @@ -16,14 +16,16 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable + - name: Pull image + env: + IMAGE: paritytech/ruled_labels:0.3.1 + run: docker pull $IMAGE - name: Check label Rules env: + IMAGE: paritytech/ruled_labels:0.3.1 + MOUNT: /work RULES_PATH: scripts/ci/ruled_labels run: | - cargo install ruled-labels --version 0.3.1 - ruled-labels test ${RULES_PATH}/specs.yaml + docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE test ${MOUNT}/specs.yaml + docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE test ${MOUNT}/specs-D.yaml diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index d3a5c63d20f..f706fa4a8f9 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -21,7 +21,6 @@ jobs: run: docker pull $IMAGE - name: Check labels - # continue-on-error: true env: IMAGE: paritytech/ruled_labels:0.3.1 MOUNT: /work @@ -50,4 +49,4 @@ jobs: IFS="," # --dev is more useful to debug mode to debug - docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels ${labels_args} + docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels ${labels_args} --dev diff --git a/scripts/ci/ruled_labels/specs-D.yaml b/scripts/ci/ruled_labels/specs-D.yaml index 0f6f21c81f0..85154d421c1 100644 --- a/scripts/ci/ruled_labels/specs-D.yaml +++ b/scripts/ci/ruled_labels/specs-D.yaml @@ -21,6 +21,6 @@ labels: rules: - name: Require single audit (D) label allowed id: single_d - tags: [PR] + tags: [ PR ] spec: - require: !one_of [D*] + require: !one_of [ D* ] diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index cd307ec6f49..3ea530f8ebb 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -42,21 +42,6 @@ labels: - name: C7-critical description: "PR touches the given topic and has a critical impact on builders." color: E99695 - - name: D1-audited 👍 - description: PR contains changes to fund-managing logic that has been properly reviewed and externally audited. - color: C0E7CC - - name: D2-notlive 💤 - description: PR contains changes in a runtime directory that is not deployed to a chain that requires an audit. - color: C209B4 - - name: D3-trivial 🧸 - description: PR contains trivial changes in a runtime directory that do not require an audit - color: 5EDFEE - - name: D5-nicetohaveaudit ⚠️ - description: PR contains trivial changes to logic that should be properly reviewed. - color: c5def5 - - name: D9-needsaudit 👮 - description: PR contains changes to fund-managing logic that should be properly reviewed and externally audited - color: C3EDC0 - name: E0-runtime_migration description: PR introduces code that might require downstream chains to run a runtime upgrade. color: c2e0c6 @@ -202,48 +187,42 @@ labels: rules: - name: Require a single Release (B) label id: single_b - tags: [PR] + tags: [ PR ] spec: - require: !one_of [B*] + require: !one_of [ B* ] - name: Release mentions need criticality (C) id: require_one_c_when_b1 - tags: [PR] + tags: [ PR ] spec: - when: !one_of [B1] - require: !one_of [C*] + when: !one_of [ B1 ] + require: !one_of [ C* ] - name: Release mentions need a topic (T) id: require_one_t_when_b1 - tags: [PR] + tags: [ PR ] spec: - when: !one_of [B1] - require: !one_of [T*] + when: !one_of [ B1 ] + require: !one_of [ T* ] - name: One single issue status (S) label allowed id: single_s tags: spec: - when: !some_of [S*] - require: !one_of [S*] + when: !some_of [ S* ] + require: !one_of [ S* ] - name: One single urgency status (U) label allowed id: single_u tags: spec: - when: !some_of [U*] - require: !one_of [U*] + when: !some_of [ U* ] + require: !one_of [ U* ] - name: One single criticality (C) label allowed id: single_c tags: spec: - when: !some_of [C*] - require: !one_of [C*] + when: !some_of [ C* ] + require: !one_of [ C* ] - - name: One single audit (D) label allowed - id: single_d - tags: [PR] - spec: - when: !some_of [D*] - require: !one_of [D*] From d27a373720db3ff5b6b4cc90793b7fe2bcd174b5 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Thu, 10 Nov 2022 14:01:58 +0100 Subject: [PATCH 40/53] test D label --- .github/workflows/check-D-labels.yml | 5 +---- primitives/core/Cargo.toml | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-D-labels.yml b/.github/workflows/check-D-labels.yml index 30feba6367e..a9315d7864e 100644 --- a/.github/workflows/check-D-labels.yml +++ b/.github/workflows/check-D-labels.yml @@ -4,10 +4,7 @@ on: pull_request: types: [labeled, opened, synchronize, unlabeled] paths: - - runtime/common/** - - runtime/polkadot/** - - runtime/kusama/** - - primitives/src/** + - primitives/** jobs: check-labels: diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 9a67cac16c5..016e6b7bff5 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -30,3 +30,4 @@ std = [ "polkadot-parachain/std", "polkadot-primitives/std", ] + From f4b6e7ef9d104be098598bc211811f1a7aa1d35f Mon Sep 17 00:00:00 2001 From: alvicsam Date: Thu, 10 Nov 2022 14:10:35 +0100 Subject: [PATCH 41/53] revert Cargo.toml --- primitives/core/Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 016e6b7bff5..9a67cac16c5 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -30,4 +30,3 @@ std = [ "polkadot-parachain/std", "polkadot-primitives/std", ] - From b1fb7aa12fe10d253e3dc15e8be90dfeca419228 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Thu, 10 Nov 2022 14:35:52 +0100 Subject: [PATCH 42/53] use tags for ruled_labels --- .github/workflows/check-D-labels.yml | 2 +- primitives/core/Cargo.toml | 1 + scripts/ci/ruled_labels/specs-D.yaml | 26 --------------- scripts/ci/ruled_labels/specs.yaml | 48 ++++++++++++++++++++-------- 4 files changed, 36 insertions(+), 41 deletions(-) delete mode 100644 scripts/ci/ruled_labels/specs-D.yaml diff --git a/.github/workflows/check-D-labels.yml b/.github/workflows/check-D-labels.yml index a9315d7864e..e0a7f34c768 100644 --- a/.github/workflows/check-D-labels.yml +++ b/.github/workflows/check-D-labels.yml @@ -51,4 +51,4 @@ jobs: IFS="," # --dev is more useful to debug mode to debug - docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels ${labels_args} --dev + docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels ${labels_args} --dev --tags audit diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 9a67cac16c5..251fcc73786 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -30,3 +30,4 @@ std = [ "polkadot-parachain/std", "polkadot-primitives/std", ] +# diff --git a/scripts/ci/ruled_labels/specs-D.yaml b/scripts/ci/ruled_labels/specs-D.yaml deleted file mode 100644 index 85154d421c1..00000000000 --- a/scripts/ci/ruled_labels/specs-D.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -name: paritytech/cumulus -description: Import from paritytech/cumulus -version: 0.0.1 -labels: - - name: D1-audited 👍 - description: PR contains changes to fund-managing logic that has been properly reviewed and externally audited. - color: C0E7CC - - name: D2-notlive 💤 - description: PR contains changes in a runtime directory that is not deployed to a chain that requires an audit. - color: C209B4 - - name: D3-trivial 🧸 - description: PR contains trivial changes in a runtime directory that do not require an audit - color: 5EDFEE - - name: D5-nicetohaveaudit ⚠️ - description: PR contains trivial changes to logic that should be properly reviewed. - color: c5def5 - - name: D9-needsaudit 👮 - description: PR contains changes to fund-managing logic that should be properly reviewed and externally audited - color: C3EDC0 -rules: - - name: Require single audit (D) label allowed - id: single_d - tags: [ PR ] - spec: - require: !one_of [ D* ] diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index 3ea530f8ebb..b286cd4f6ad 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -42,6 +42,21 @@ labels: - name: C7-critical description: "PR touches the given topic and has a critical impact on builders." color: E99695 + - name: D1-audited 👍 + description: PR contains changes to fund-managing logic that has been properly reviewed and externally audited. + color: C0E7CC + - name: D2-notlive 💤 + description: PR contains changes in a runtime directory that is not deployed to a chain that requires an audit. + color: C209B4 + - name: D3-trivial 🧸 + description: PR contains trivial changes in a runtime directory that do not require an audit + color: 5EDFEE + - name: D5-nicetohaveaudit ⚠️ + description: PR contains trivial changes to logic that should be properly reviewed. + color: c5def5 + - name: D9-needsaudit 👮 + description: PR contains changes to fund-managing logic that should be properly reviewed and externally audited + color: C3EDC0 - name: E0-runtime_migration description: PR introduces code that might require downstream chains to run a runtime upgrade. color: c2e0c6 @@ -187,42 +202,47 @@ labels: rules: - name: Require a single Release (B) label id: single_b - tags: [ PR ] + tags: [PR] spec: - require: !one_of [ B* ] + require: !one_of [B*] - name: Release mentions need criticality (C) id: require_one_c_when_b1 - tags: [ PR ] + tags: [PR] spec: - when: !one_of [ B1 ] - require: !one_of [ C* ] + when: !one_of [B1] + require: !one_of [C*] - name: Release mentions need a topic (T) id: require_one_t_when_b1 - tags: [ PR ] + tags: [PR] spec: - when: !one_of [ B1 ] - require: !one_of [ T* ] + when: !one_of [B1] + require: !one_of [T*] - name: One single issue status (S) label allowed id: single_s tags: spec: - when: !some_of [ S* ] - require: !one_of [ S* ] + when: !some_of [S*] + require: !one_of [S*] - name: One single urgency status (U) label allowed id: single_u tags: spec: - when: !some_of [ U* ] - require: !one_of [ U* ] + when: !some_of [U*] + require: !one_of [U*] - name: One single criticality (C) label allowed id: single_c tags: spec: - when: !some_of [ C* ] - require: !one_of [ C* ] + when: !some_of [C*] + require: !one_of [C*] + - name: Require single audit (D) label allowed + id: single_d + tags: [ audit ] + spec: + require: !one_of [ D* ] \ No newline at end of file From 4be19540a12016a5a65dbf2ac2a3131c6af12d8a Mon Sep 17 00:00:00 2001 From: alvicsam Date: Thu, 10 Nov 2022 14:40:04 +0100 Subject: [PATCH 43/53] fix rules --- .github/workflows/check-D-labels.yml | 2 +- primitives/core/Cargo.toml | 1 - scripts/ci/ruled_labels/specs.yaml | 5 +++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-D-labels.yml b/.github/workflows/check-D-labels.yml index e0a7f34c768..b85e1de6499 100644 --- a/.github/workflows/check-D-labels.yml +++ b/.github/workflows/check-D-labels.yml @@ -31,7 +31,7 @@ jobs: API_BASE: https://api.github.com/repos REPO: ${{ github.repository }} RULES_PATH: scripts/ci/ruled_labels - CHECK_SPECS: specs-D.yaml + CHECK_SPECS: specs.yaml run: | echo "REPO: ${REPO}" echo "GITHUB_PR: ${GITHUB_PR}" diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 251fcc73786..9a67cac16c5 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -30,4 +30,3 @@ std = [ "polkadot-parachain/std", "polkadot-primitives/std", ] -# diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index b286cd4f6ad..ec4c30ea053 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -243,6 +243,7 @@ rules: - name: Require single audit (D) label allowed id: single_d - tags: [ audit ] + tags: [audit] spec: - require: !one_of [ D* ] \ No newline at end of file + when: !some_of [D*] + require: !one_of [D*] From 295acf5e3449228ec9824f78c3214bdd179c9e15 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Thu, 10 Nov 2022 14:42:35 +0100 Subject: [PATCH 44/53] test D label --- primitives/core/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 9a67cac16c5..fab9458642c 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -30,3 +30,4 @@ std = [ "polkadot-parachain/std", "polkadot-primitives/std", ] +## From 4522dd4f5f3599bf00da3c6d07697a4c19ff393f Mon Sep 17 00:00:00 2001 From: alvicsam Date: Thu, 10 Nov 2022 15:07:34 +0100 Subject: [PATCH 45/53] fix tags --- .github/workflows/check-labels-new.yml | 2 +- scripts/ci/ruled_labels/specs.yaml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index f706fa4a8f9..2ac40c5685b 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -49,4 +49,4 @@ jobs: IFS="," # --dev is more useful to debug mode to debug - docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels ${labels_args} --dev + docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels ${labels_args} --dev --tags PR diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index ec4c30ea053..b75b21da426 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -245,5 +245,4 @@ rules: id: single_d tags: [audit] spec: - when: !some_of [D*] require: !one_of [D*] From ee5ae94cd93cda92b977951af494a17bb4a62fac Mon Sep 17 00:00:00 2001 From: alvicsam Date: Thu, 10 Nov 2022 15:18:53 +0100 Subject: [PATCH 46/53] remove changes --- primitives/core/Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index fab9458642c..9a67cac16c5 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -30,4 +30,3 @@ std = [ "polkadot-parachain/std", "polkadot-primitives/std", ] -## From 79cb53a0e5e4ab9d60aa919424b4571561d1124d Mon Sep 17 00:00:00 2001 From: Joyce Siqueira <98593770+the-right-joyce@users.noreply.github.com> Date: Thu, 10 Nov 2022 15:41:39 +0000 Subject: [PATCH 47/53] add PR tag to single criticality rule --- scripts/ci/ruled_labels/specs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index 723ca92ab11..f2c582886ed 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -236,7 +236,7 @@ rules: - name: One single criticality (C) label allowed id: single_c - tags: + tags: [ PR ] spec: when: !some_of [ C* ] require: !one_of [ C* ] From 71131c0b5815665c5b23c211423847b1e30c8d1a Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 16 Nov 2022 15:39:06 +0100 Subject: [PATCH 48/53] remove old line --- .github/workflows/check-label-rules.yaml | 1 - .github/workflows/check-labels.yml | 43 ++++++++++++------------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/check-label-rules.yaml b/.github/workflows/check-label-rules.yaml index 0cf9d4d5b04..730fe36d7b5 100644 --- a/.github/workflows/check-label-rules.yaml +++ b/.github/workflows/check-label-rules.yaml @@ -28,4 +28,3 @@ jobs: RULES_PATH: scripts/ci/ruled_labels run: | docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE test ${MOUNT}/specs.yaml - docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE test ${MOUNT}/specs-D.yaml diff --git a/.github/workflows/check-labels.yml b/.github/workflows/check-labels.yml index f0f5556ebed..5d3e3ed580c 100644 --- a/.github/workflows/check-labels.yml +++ b/.github/workflows/check-labels.yml @@ -1,23 +1,24 @@ -name: Check labels +# disabled in favor of ruled_labels tool +# name: Check labels -on: - pull_request: - types: [labeled, opened, synchronize, unlabeled] +# on: +# pull_request: +# types: [labeled, opened, synchronize, unlabeled] -jobs: - check-labels: - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Check labels - run: bash ${{ github.workspace }}/scripts/ci/github/check_labels.sh - env: - GITHUB_PR: ${{ github.event.pull_request.number }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - HEAD_SHA: ${{ github.event.pull_request.head.sha }} - BASE_SHA: ${{ github.event.pull_request.base.sha }} +# jobs: +# check-labels: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout sources +# uses: actions/checkout@v3 +# with: +# fetch-depth: 0 +# ref: ${{ github.event.pull_request.head.ref }} +# repository: ${{ github.event.pull_request.head.repo.full_name }} +# - name: Check labels +# run: bash ${{ github.workspace }}/scripts/ci/github/check_labels.sh +# env: +# GITHUB_PR: ${{ github.event.pull_request.number }} +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# HEAD_SHA: ${{ github.event.pull_request.head.sha }} +# BASE_SHA: ${{ github.event.pull_request.base.sha }} From 5865d0d48273fdf177dae54c08ac8f35abc2bcfe Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 16 Nov 2022 15:41:05 +0100 Subject: [PATCH 49/53] test ruled_labels test --- scripts/ci/ruled_labels/specs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index 1b6b6d5eb8b..45d76b3e245 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -246,3 +246,4 @@ rules: tags: [audit] spec: require: !one_of [D*] + From c62ec4a102719e190ae3dd7d1a096ff45ea5b5a3 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 16 Nov 2022 15:42:59 +0100 Subject: [PATCH 50/53] disable Check label Rules --- .github/workflows/check-label-rules.yaml | 53 ++++++++++++------------ 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/.github/workflows/check-label-rules.yaml b/.github/workflows/check-label-rules.yaml index 730fe36d7b5..0196329fc40 100644 --- a/.github/workflows/check-label-rules.yaml +++ b/.github/workflows/check-label-rules.yaml @@ -1,30 +1,31 @@ -name: Check label Rules +# Disabled before https://github.com/chevdor/ruled_labels/issues/9 is fixed +# name: Check label Rules -on: - push: - paths: - - scripts/ci/ruled_labels/** +# on: +# push: +# paths: +# - scripts/ci/ruled_labels/** -jobs: - check-label-rules: - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} +# jobs: +# check-label-rules: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout sources +# uses: actions/checkout@v3 +# with: +# fetch-depth: 0 +# ref: ${{ github.event.pull_request.head.ref }} +# repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Pull image - env: - IMAGE: paritytech/ruled_labels:0.3.1 - run: docker pull $IMAGE +# - name: Pull image +# env: +# IMAGE: paritytech/ruled_labels:0.3.1 +# run: docker pull $IMAGE - - name: Check label Rules - env: - IMAGE: paritytech/ruled_labels:0.3.1 - MOUNT: /work - RULES_PATH: scripts/ci/ruled_labels - run: | - docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE test ${MOUNT}/specs.yaml +# - name: Check label Rules +# env: +# IMAGE: paritytech/ruled_labels:0.3.1 +# MOUNT: /work +# RULES_PATH: scripts/ci/ruled_labels +# run: | +# docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE test ${MOUNT}/specs.yaml From 713cd3365ff6852297ebaf04eeacc372a685d452 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 16 Nov 2022 15:44:03 +0100 Subject: [PATCH 51/53] fix GHA name --- .github/workflows/check-labels-new.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml index 2ac40c5685b..7a59f9c6bad 100644 --- a/.github/workflows/check-labels-new.yml +++ b/.github/workflows/check-labels-new.yml @@ -1,4 +1,4 @@ -name: Check labels (new) +name: Check labels on: pull_request: From 75fc00557c56dde45cad283df64653dc3416cf49 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Mon, 21 Nov 2022 16:51:12 +0100 Subject: [PATCH 52/53] fix tests --- .github/workflows/check-label-rules.yaml | 53 ++++++++++++------------ scripts/ci/ruled_labels/specs.yaml | 3 +- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/.github/workflows/check-label-rules.yaml b/.github/workflows/check-label-rules.yaml index 0196329fc40..2b500bc7f7c 100644 --- a/.github/workflows/check-label-rules.yaml +++ b/.github/workflows/check-label-rules.yaml @@ -1,31 +1,30 @@ -# Disabled before https://github.com/chevdor/ruled_labels/issues/9 is fixed -# name: Check label Rules +name: Check label Rules -# on: -# push: -# paths: -# - scripts/ci/ruled_labels/** +on: + push: + paths: + - scripts/ci/ruled_labels/** -# jobs: -# check-label-rules: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout sources -# uses: actions/checkout@v3 -# with: -# fetch-depth: 0 -# ref: ${{ github.event.pull_request.head.ref }} -# repository: ${{ github.event.pull_request.head.repo.full_name }} +jobs: + check-label-rules: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} -# - name: Pull image -# env: -# IMAGE: paritytech/ruled_labels:0.3.1 -# run: docker pull $IMAGE + - name: Pull image + env: + IMAGE: paritytech/ruled_labels:0.3.1 + run: docker pull $IMAGE -# - name: Check label Rules -# env: -# IMAGE: paritytech/ruled_labels:0.3.1 -# MOUNT: /work -# RULES_PATH: scripts/ci/ruled_labels -# run: | -# docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE test ${MOUNT}/specs.yaml + - name: Check label Rules + env: + IMAGE: paritytech/ruled_labels:0.3.1 + MOUNT: /work + RULES_PATH: scripts/ci/ruled_labels + run: | + docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE test ${MOUNT}/tests.yaml diff --git a/scripts/ci/ruled_labels/specs.yaml b/scripts/ci/ruled_labels/specs.yaml index 45d76b3e245..25355dfdf16 100644 --- a/scripts/ci/ruled_labels/specs.yaml +++ b/scripts/ci/ruled_labels/specs.yaml @@ -236,7 +236,7 @@ rules: - name: One single criticality (C) label allowed id: single_c - tags: [ PR ] + tags: [PR] spec: when: !some_of [C*] require: !one_of [C*] @@ -246,4 +246,3 @@ rules: tags: [audit] spec: require: !one_of [D*] - From dee90ab9f59604b111acf139401fb1f66fb0f3d6 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Mon, 21 Nov 2022 17:32:17 +0100 Subject: [PATCH 53/53] rename files, upd ruled_labels 0.3.2 --- .github/workflows/check-D-labels.yml | 4 +- .github/workflows/check-label-rules.yaml | 4 +- .github/workflows/check-labels-new.yml | 52 ---------------- .github/workflows/check-labels-old.yml | 26 ++++++++ .github/workflows/check-labels.yml | 76 ++++++++++++++++-------- 5 files changed, 81 insertions(+), 81 deletions(-) delete mode 100644 .github/workflows/check-labels-new.yml create mode 100644 .github/workflows/check-labels-old.yml diff --git a/.github/workflows/check-D-labels.yml b/.github/workflows/check-D-labels.yml index b85e1de6499..711840a4c8e 100644 --- a/.github/workflows/check-D-labels.yml +++ b/.github/workflows/check-D-labels.yml @@ -19,12 +19,12 @@ jobs: - name: Pull image env: - IMAGE: paritytech/ruled_labels:0.3.1 + IMAGE: paritytech/ruled_labels:0.3.2 run: docker pull $IMAGE - name: Check labels env: - IMAGE: paritytech/ruled_labels:0.3.1 + IMAGE: paritytech/ruled_labels:0.3.2 MOUNT: /work GITHUB_PR: ${{ github.event.pull_request.number }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/check-label-rules.yaml b/.github/workflows/check-label-rules.yaml index 2b500bc7f7c..c744a71946b 100644 --- a/.github/workflows/check-label-rules.yaml +++ b/.github/workflows/check-label-rules.yaml @@ -18,12 +18,12 @@ jobs: - name: Pull image env: - IMAGE: paritytech/ruled_labels:0.3.1 + IMAGE: paritytech/ruled_labels:0.3.2 run: docker pull $IMAGE - name: Check label Rules env: - IMAGE: paritytech/ruled_labels:0.3.1 + IMAGE: paritytech/ruled_labels:0.3.2 MOUNT: /work RULES_PATH: scripts/ci/ruled_labels run: | diff --git a/.github/workflows/check-labels-new.yml b/.github/workflows/check-labels-new.yml deleted file mode 100644 index 7a59f9c6bad..00000000000 --- a/.github/workflows/check-labels-new.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Check labels - -on: - pull_request: - types: [labeled, opened, synchronize, unlabeled] - -jobs: - check-labels: - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - - name: Pull image - env: - IMAGE: paritytech/ruled_labels:0.3.1 - run: docker pull $IMAGE - - - name: Check labels - env: - IMAGE: paritytech/ruled_labels:0.3.1 - MOUNT: /work - GITHUB_PR: ${{ github.event.pull_request.number }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - API_BASE: https://api.github.com/repos - REPO: ${{ github.repository }} - RULES_PATH: scripts/ci/ruled_labels - CHECK_SPECS: specs.yaml - run: | - echo "REPO: ${REPO}" - echo "GITHUB_PR: ${GITHUB_PR}" - - # Fetch the labels for the PR under test - labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",") - - if [ -z "${labels}" ]; then - echo "No labels found. Please add labels A, B and C labels" - exit 1 - fi - - labels_args=${labels: :-1} - printf "Checking labels: %s\n" "${labels_args}" - - # Prevent the shell from splitting labels with spaces - IFS="," - - # --dev is more useful to debug mode to debug - docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels ${labels_args} --dev --tags PR diff --git a/.github/workflows/check-labels-old.yml b/.github/workflows/check-labels-old.yml new file mode 100644 index 00000000000..053cc5f7cf0 --- /dev/null +++ b/.github/workflows/check-labels-old.yml @@ -0,0 +1,26 @@ +# disabled in favor of ruled_labels tool +# name: Check labels + +# on: +# pull_request: +# types: [labeled, opened, synchronize, unlabeled] + + +# jobs: +# check-labels: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout sources +# uses: actions/checkout@v3 +# with: +# fetch-depth: 0 +# ref: ${{ github.event.pull_request.head.ref }} +# repository: ${{ github.event.pull_request.head.repo.full_name }} +# - name: Check labels +# run: bash ${{ github.workspace }}/scripts/ci/github/check_labels.sh +# env: +# GITHUB_PR: ${{ github.event.pull_request.number }} +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# HEAD_SHA: ${{ github.event.pull_request.head.sha }} +# BASE_SHA: ${{ github.event.pull_request.base.sha }} + diff --git a/.github/workflows/check-labels.yml b/.github/workflows/check-labels.yml index 053cc5f7cf0..e1cdf33832e 100644 --- a/.github/workflows/check-labels.yml +++ b/.github/workflows/check-labels.yml @@ -1,26 +1,52 @@ -# disabled in favor of ruled_labels tool -# name: Check labels - -# on: -# pull_request: -# types: [labeled, opened, synchronize, unlabeled] - - -# jobs: -# check-labels: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout sources -# uses: actions/checkout@v3 -# with: -# fetch-depth: 0 -# ref: ${{ github.event.pull_request.head.ref }} -# repository: ${{ github.event.pull_request.head.repo.full_name }} -# - name: Check labels -# run: bash ${{ github.workspace }}/scripts/ci/github/check_labels.sh -# env: -# GITHUB_PR: ${{ github.event.pull_request.number }} -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# HEAD_SHA: ${{ github.event.pull_request.head.sha }} -# BASE_SHA: ${{ github.event.pull_request.base.sha }} +name: Check labels +on: + pull_request: + types: [labeled, opened, synchronize, unlabeled] + +jobs: + check-labels: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + + - name: Pull image + env: + IMAGE: paritytech/ruled_labels:0.3.2 + run: docker pull $IMAGE + + - name: Check labels + env: + IMAGE: paritytech/ruled_labels:0.3.2 + MOUNT: /work + GITHUB_PR: ${{ github.event.pull_request.number }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + API_BASE: https://api.github.com/repos + REPO: ${{ github.repository }} + RULES_PATH: scripts/ci/ruled_labels + CHECK_SPECS: specs.yaml + run: | + echo "REPO: ${REPO}" + echo "GITHUB_PR: ${GITHUB_PR}" + + # Fetch the labels for the PR under test + labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",") + + if [ -z "${labels}" ]; then + echo "No labels found. Please add labels A, B and C labels" + exit 1 + fi + + labels_args=${labels: :-1} + printf "Checking labels: %s\n" "${labels_args}" + + # Prevent the shell from splitting labels with spaces + IFS="," + + # --dev is more useful to debug mode to debug + docker run --rm -i -v $PWD/${RULES_PATH}/:$MOUNT $IMAGE check $MOUNT/$CHECK_SPECS --labels ${labels_args} --dev --tags PR