From c498eee67f18addf316e92f4f69ff5d26429966b Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Sun, 8 Oct 2023 23:01:51 -0300 Subject: [PATCH] change(ci): Create automatic tickets on CI failure for more workflows (#7620) * add buld failures ticket generation to most important workflows * add missing newline at the end of the file * doc fixes * add missing testnet build check Co-authored-by: teor --------- Co-authored-by: teor --- .../workflows/build-crates-individually.yml | 18 +++++++++++++++++ .github/workflows/continous-delivery.yml | 18 +++++++++++++++++ .../continous-integration-docker.yml | 8 +++----- .../workflows/continous-integration-os.yml | 18 +++++++++++++++++ .github/workflows/release-binaries.yml | 17 ++++++++++++++++ .github/workflows/release-crates-io.yml | 20 ++++++++++++++++++- 6 files changed, 93 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-crates-individually.yml b/.github/workflows/build-crates-individually.yml index 505d9796..8bbf4765 100644 --- a/.github/workflows/build-crates-individually.yml +++ b/.github/workflows/build-crates-individually.yml @@ -138,3 +138,21 @@ jobs: - name: Build ${{ matrix.crate }} crate with all features run: | cargo build --package ${{ matrix.crate }} --all-features + + failure-issue: + name: Open or update issues for building crates individually failures + # When a new job is added to this workflow, add it to this list. + needs: [ matrix, build ] + # Only open tickets for failed or cancelled jobs that are not coming from PRs. + # (PR statuses are already reported in the PR jobs list, and checked by Mergify.) + if: (failure() && github.event.pull_request == null) || (cancelled() && github.event.pull_request == null) + runs-on: ubuntu-latest + steps: + - uses: jayqi/failed-build-issue-action@v1 + with: + title-template: "{{refname}} branch CI failed: {{eventName}} in {{workflow}}" + # New failures open an issue with this label. + label-name: S-ci-fail-build-crates-auto-issue + # If there is already an open issue with this label, any failures become comments on that issue. + always-create-new-issue: false + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/continous-delivery.yml b/.github/workflows/continous-delivery.yml index 1d1c6efb..3bc314be 100644 --- a/.github/workflows/continous-delivery.yml +++ b/.github/workflows/continous-delivery.yml @@ -382,3 +382,21 @@ jobs: --labels=app=zebrad,environment=qa,network=${NETWORK},github_ref=${{ env.GITHUB_REF_SLUG_URL }} \ --tags zebrad \ --zone ${{ vars.GCP_ZONE }} + + failure-issue: + name: Open or update issues for release failures + # When a new job is added to this workflow, add it to this list. + needs: [ versioning, build, test-configuration-file, deploy-nodes, deploy-instance ] + # Only open tickets for failed or cancelled jobs that are not coming from PRs. + # (PR statuses are already reported in the PR jobs list, and checked by Mergify.) + if: (failure() && github.event.pull_request == null) || (cancelled() && github.event.pull_request == null) + runs-on: ubuntu-latest + steps: + - uses: jayqi/failed-build-issue-action@v1 + with: + title-template: "{{refname}} branch CI failed: {{eventName}} in {{workflow}}" + # New failures open an issue with this label. + label-name: S-ci-fail-release-auto-issue + # If there is already an open issue with this label, any failures become comments on that issue. + always-create-new-issue: false + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/continous-integration-docker.yml b/.github/workflows/continous-integration-docker.yml index 492c9556..aeafb9a0 100644 --- a/.github/workflows/continous-integration-docker.yml +++ b/.github/workflows/continous-integration-docker.yml @@ -790,18 +790,16 @@ jobs: # This list is for reliable tests that are run on the `main` branch. # Testnet jobs are not in this list, because we expect testnet to fail occasionally. needs: [ regenerate-stateful-disks, test-full-sync, lightwalletd-full-sync, test-all, test-all-getblocktemplate-rpcs, test-fake-activation-heights, test-empty-sync, test-lightwalletd-integration, test-configuration-file, test-zebra-conf-path, test-stateful-sync, test-update-sync, generate-checkpoints-mainnet, lightwalletd-update-sync, lightwalletd-rpc-test, lightwalletd-transactions-test, lightwalletd-grpc-test, get-block-template-test, submit-block-test ] - # Only open tickets for failed scheduled jobs, manual workflow runs, or `main` branch merges. + # Only open tickets for failed or cancelled jobs that are not coming from PRs. # (PR statuses are already reported in the PR jobs list, and checked by Mergify.) - # TODO: if a job times out, we want to create a ticket. Does failure() do that? Or do we need cancelled()? - if: failure() && github.event.pull_request == null + if: (failure() && github.event.pull_request == null) || (cancelled() && github.event.pull_request == null) runs-on: ubuntu-latest steps: - uses: jayqi/failed-build-issue-action@v1 with: title-template: "{{refname}} branch CI failed: {{eventName}} in {{workflow}}" # New failures open an issue with this label. - # TODO: do we want a different label for each workflow, or each kind of workflow? - label-name: S-ci-fail-auto-issue + label-name: S-ci-fail-main-branch-auto-issue # If there is already an open issue with this label, any failures become comments on that issue. always-create-new-issue: false github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/continous-integration-os.yml b/.github/workflows/continous-integration-os.yml index 3266f24e..4f33c020 100644 --- a/.github/workflows/continous-integration-os.yml +++ b/.github/workflows/continous-integration-os.yml @@ -319,3 +319,21 @@ jobs: else echo "No unused dependencies found." fi + + failure-issue: + name: Open or update issues for OS integration failures + # When a new job is added to this workflow, add it to this list. + needs: [ test, install-from-lockfile-no-cache, check-cargo-lock, cargo-deny, unused-deps ] + # Only open tickets for failed or cancelled jobs that are not coming from PRs. + # (PR statuses are already reported in the PR jobs list, and checked by Mergify.) + if: (failure() && github.event.pull_request == null) || (cancelled() && github.event.pull_request == null) + runs-on: ubuntu-latest + steps: + - uses: jayqi/failed-build-issue-action@v1 + with: + title-template: "{{refname}} branch CI failed: {{eventName}} in {{workflow}}" + # New failures open an issue with this label. + label-name: S-ci-fail-os-integration-auto-issue + # If there is already an open issue with this label, any failures become comments on that issue. + always-create-new-issue: false + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml index a96c15c2..2fe2243e 100644 --- a/.github/workflows/release-binaries.yml +++ b/.github/workflows/release-binaries.yml @@ -43,3 +43,20 @@ jobs: rust_log: info # This step needs access to Docker Hub secrets to run successfully secrets: inherit + + failure-issue: + name: Open or update issues for release binaries failures + # When a new job is added to this workflow, add it to this list. + needs: [ build, build-mining-testnet ] + # Open tickets for any failed build in this workflow. + if: failure() || cancelled() + runs-on: ubuntu-latest + steps: + - uses: jayqi/failed-build-issue-action@v1 + with: + title-template: "{{refname}} branch CI failed: {{eventName}} in {{workflow}}" + # New failures open an issue with this label. + label-name: S-ci-fail-binaries-auto-issue + # If there is already an open issue with this label, any failures become comments on that issue. + always-create-new-issue: false + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-crates-io.yml b/.github/workflows/release-crates-io.yml index e4651556..94535fcc 100644 --- a/.github/workflows/release-crates-io.yml +++ b/.github/workflows/release-crates-io.yml @@ -114,7 +114,6 @@ jobs: # TODO: check all crates after fixing these errors cargo release publish --verbose --dry-run --allow-branch '*' --workspace --exclude zebra-consensus --exclude zebra-utils --exclude zebrad - # TODO: actually do the release here #release-crates: # name: Release Zebra Crates @@ -123,3 +122,22 @@ jobs: # timeout-minutes: 30 # if: ${{ !cancelled() && !failure() && github.event_name == 'release' }} # steps: + # ... + + failure-issue: + name: Open or update issues for release crates failures + # When a new job is added to this workflow, add it to this list. + needs: [ check-release ] + # Only open tickets for failed or cancelled jobs that are not coming from PRs. + # (PR statuses are already reported in the PR jobs list, and checked by Mergify.) + if: (failure() && github.event.pull_request == null) || (cancelled() && github.event.pull_request == null) + runs-on: ubuntu-latest + steps: + - uses: jayqi/failed-build-issue-action@v1 + with: + title-template: "{{refname}} branch CI failed: {{eventName}} in {{workflow}}" + # New failures open an issue with this label. + label-name: S-ci-fail-release-crates-auto-issue + # If there is already an open issue with this label, any failures become comments on that issue. + always-create-new-issue: false + github-token: ${{ secrets.GITHUB_TOKEN }}