From 01b4ad9eecfa13c38b825b1dc6834e831dfc8532 Mon Sep 17 00:00:00 2001 From: Deepika Upadhyay Date: Fri, 17 Feb 2023 18:19:35 +0530 Subject: [PATCH 1/2] ci: use composite action for tmate session debugging this will help deduplicate tmate debug code throughout. Signed-off-by: Deepika Upadhyay --- .github/workflows/build.yml | 27 +- .github/workflows/canary-integration-test.yml | 247 ++++-------------- .../integration-test-helm-suite.yaml | 13 +- .../workflows/integration-test-mgr-suite.yaml | 13 +- .../integration-test-multi-cluster-suite.yaml | 13 +- .../integration-test-object-suite.yaml | 13 +- .../integration-test-smoke-suite.yaml | 13 +- .../integration-test-upgrade-suite.yaml | 13 +- .github/workflows/push-build.yaml | 13 +- .github/workflows/tmate_debug/action.yml | 28 ++ 10 files changed, 112 insertions(+), 281 deletions(-) create mode 100644 .github/workflows/tmate_debug/action.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5905eed40..8a8ce80a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -72,17 +72,9 @@ jobs: run: tests/scripts/validate_modified_files.sh gen-rbac - name: consider debugging - if: failure() - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} linux-build-all: runs-on: ubuntu-20.04 @@ -113,13 +105,6 @@ jobs: - name: consider debugging if: failure() - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/canary-integration-test.yml b/.github/workflows/canary-integration-test.yml index 98df253d4..31c5b9141 100644 --- a/.github/workflows/canary-integration-test.yml +++ b/.github/workflows/canary-integration-test.yml @@ -204,16 +204,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} raw-disk: runs-on: ubuntu-20.04 @@ -264,16 +257,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} two-osds-in-device: runs-on: ubuntu-20.04 @@ -318,16 +304,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} osd-with-metadata-device: runs-on: ubuntu-20.04 @@ -378,16 +357,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} encryption: runs-on: ubuntu-20.04 @@ -483,16 +455,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} pvc: runs-on: ubuntu-20.04 @@ -563,16 +528,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} pvc-db: runs-on: ubuntu-20.04 @@ -619,16 +577,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} pvc-db-wal: runs-on: ubuntu-20.04 @@ -678,16 +629,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} encryption-pvc: runs-on: ubuntu-20.04 @@ -754,16 +698,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} encryption-pvc-db: runs-on: ubuntu-20.04 @@ -812,16 +749,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} encryption-pvc-db-wal: runs-on: ubuntu-20.04 @@ -871,16 +801,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} encryption-pvc-kms-vault-token-auth: runs-on: ubuntu-20.04 @@ -958,16 +881,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} encryption-pvc-kms-vault-k8s-auth: runs-on: ubuntu-20.04 @@ -1027,16 +943,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} lvm-pvc: runs-on: ubuntu-20.04 @@ -1088,16 +997,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} multi-cluster-mirroring: runs-on: ubuntu-20.04 @@ -1345,16 +1247,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} rgw-multisite-testing: runs-on: ubuntu-20.04 @@ -1380,16 +1275,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} encryption-pvc-kms-ibm-kp: runs-on: ubuntu-20.04 @@ -1418,16 +1306,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} multus-cluster-network: runs-on: ubuntu-20.04 @@ -1506,16 +1387,9 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} csi-hostnetwork-disabled: runs-on: ubuntu-20.04 @@ -1565,13 +1439,6 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/integration-test-helm-suite.yaml b/.github/workflows/integration-test-helm-suite.yaml index 4e79a8a6b..2b0a01712 100644 --- a/.github/workflows/integration-test-helm-suite.yaml +++ b/.github/workflows/integration-test-helm-suite.yaml @@ -63,13 +63,6 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/integration-test-mgr-suite.yaml b/.github/workflows/integration-test-mgr-suite.yaml index eb9170c58..5ce0d1082 100644 --- a/.github/workflows/integration-test-mgr-suite.yaml +++ b/.github/workflows/integration-test-mgr-suite.yaml @@ -57,13 +57,6 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/integration-test-multi-cluster-suite.yaml b/.github/workflows/integration-test-multi-cluster-suite.yaml index 13838c0a8..7cc1b6e3f 100644 --- a/.github/workflows/integration-test-multi-cluster-suite.yaml +++ b/.github/workflows/integration-test-multi-cluster-suite.yaml @@ -59,13 +59,6 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/integration-test-object-suite.yaml b/.github/workflows/integration-test-object-suite.yaml index 74df6da03..c9122868a 100644 --- a/.github/workflows/integration-test-object-suite.yaml +++ b/.github/workflows/integration-test-object-suite.yaml @@ -58,13 +58,6 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/integration-test-smoke-suite.yaml b/.github/workflows/integration-test-smoke-suite.yaml index f09f241c1..7607b3bc2 100644 --- a/.github/workflows/integration-test-smoke-suite.yaml +++ b/.github/workflows/integration-test-smoke-suite.yaml @@ -58,13 +58,6 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/integration-test-upgrade-suite.yaml b/.github/workflows/integration-test-upgrade-suite.yaml index f93ec30ab..49906b260 100644 --- a/.github/workflows/integration-test-upgrade-suite.yaml +++ b/.github/workflows/integration-test-upgrade-suite.yaml @@ -106,13 +106,6 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/push-build.yaml b/.github/workflows/push-build.yaml index cddb8bdb6..223f92dd4 100644 --- a/.github/workflows/push-build.yaml +++ b/.github/workflows/push-build.yaml @@ -78,13 +78,6 @@ jobs: - name: consider debugging if: failure() - run: | - # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run - if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ secrets.USE_TMATE }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then - echo USE_TMATE=1 >> $GITHUB_ENV - fi - - - name: set up tmate session for debugging - if: failure() && env.USE_TMATE - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/tmate_debug/action.yml b/.github/workflows/tmate_debug/action.yml new file mode 100644 index 000000000..9a83b788b --- /dev/null +++ b/.github/workflows/tmate_debug/action.yml @@ -0,0 +1,28 @@ +name: "Tmate debugging tests" +description: "Setup tmate session if the test fails" +inputs: + use-tmate: + description: "boolean for enabling TMATE" + required: false + timeout-minutes: + description: "timeout tmate debug session" + required: false + default: '60' +# ...name, description and inputs as above +runs: + using: "composite" + steps: + - name: consider debugging + shell: bash --noprofile --norc -eo pipefail -x {0} + if: failure() && github.event_name == 'pull_request' + run: | + # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run + if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ inputs.use-tmate }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then + echo USE_TMATE=1 >> $GITHUB_ENV + fi + echo "${{ inputs.timeout-minutes }}" + + - name: set up tmate session for debugging + if: failure() && env.USE_TMATE + uses: mxschmitt/action-tmate@v3 + timeout-minutes: "${{ inputs.timeout-minutes }}" From fef11fa6a6589b06dd2f34c3c6f0cd2071331a46 Mon Sep 17 00:00:00 2001 From: Deepika Upadhyay Date: Mon, 20 Feb 2023 17:39:38 +0530 Subject: [PATCH 2/2] ci: timeout-minutes has a known issue with composite use timeout for the step in main workflow instead https://github.com/actions/runner/issues/1979 https://github.com/metabase/metabase/pull/24554/files once support for timeout-minutes is added we can remove these steps Signed-off-by: Deepika Upadhyay --- .github/workflows/build.yml | 3 +++ .github/workflows/canary-integration-test.yml | 19 +++++++++++++++++++ .../integration-test-helm-suite.yaml | 1 + .../workflows/integration-test-mgr-suite.yaml | 1 + .../integration-test-multi-cluster-suite.yaml | 1 + .../integration-test-object-suite.yaml | 1 + .../integration-test-smoke-suite.yaml | 1 + .../integration-test-upgrade-suite.yaml | 1 + .github/workflows/push-build.yaml | 1 + .github/workflows/tmate_debug/action.yml | 12 ++---------- 10 files changed, 31 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a8ce80a9..34d0d7623 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -72,6 +72,8 @@ jobs: run: tests/scripts/validate_modified_files.sh gen-rbac - name: consider debugging + if: failure() + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -105,6 +107,7 @@ jobs: - name: consider debugging if: failure() + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/canary-integration-test.yml b/.github/workflows/canary-integration-test.yml index 31c5b9141..0a9cad8ba 100644 --- a/.github/workflows/canary-integration-test.yml +++ b/.github/workflows/canary-integration-test.yml @@ -204,6 +204,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -257,6 +258,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -304,6 +306,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -357,6 +360,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -455,6 +459,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -528,6 +533,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -577,6 +583,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -629,6 +636,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -698,6 +706,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -749,6 +758,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -801,6 +811,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -881,6 +892,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -943,6 +955,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -997,6 +1010,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -1247,6 +1261,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -1275,6 +1290,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -1306,6 +1322,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -1387,6 +1404,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} @@ -1439,6 +1457,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/integration-test-helm-suite.yaml b/.github/workflows/integration-test-helm-suite.yaml index 2b0a01712..79be133e3 100644 --- a/.github/workflows/integration-test-helm-suite.yaml +++ b/.github/workflows/integration-test-helm-suite.yaml @@ -63,6 +63,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/integration-test-mgr-suite.yaml b/.github/workflows/integration-test-mgr-suite.yaml index 5ce0d1082..4ebbe0547 100644 --- a/.github/workflows/integration-test-mgr-suite.yaml +++ b/.github/workflows/integration-test-mgr-suite.yaml @@ -57,6 +57,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/integration-test-multi-cluster-suite.yaml b/.github/workflows/integration-test-multi-cluster-suite.yaml index 7cc1b6e3f..fd52c2f50 100644 --- a/.github/workflows/integration-test-multi-cluster-suite.yaml +++ b/.github/workflows/integration-test-multi-cluster-suite.yaml @@ -59,6 +59,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/integration-test-object-suite.yaml b/.github/workflows/integration-test-object-suite.yaml index c9122868a..474a87457 100644 --- a/.github/workflows/integration-test-object-suite.yaml +++ b/.github/workflows/integration-test-object-suite.yaml @@ -58,6 +58,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/integration-test-smoke-suite.yaml b/.github/workflows/integration-test-smoke-suite.yaml index 7607b3bc2..0570bfc32 100644 --- a/.github/workflows/integration-test-smoke-suite.yaml +++ b/.github/workflows/integration-test-smoke-suite.yaml @@ -58,6 +58,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/integration-test-upgrade-suite.yaml b/.github/workflows/integration-test-upgrade-suite.yaml index 49906b260..275cb266a 100644 --- a/.github/workflows/integration-test-upgrade-suite.yaml +++ b/.github/workflows/integration-test-upgrade-suite.yaml @@ -106,6 +106,7 @@ jobs: - name: consider debugging if: failure() && github.event_name == 'pull_request' + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/push-build.yaml b/.github/workflows/push-build.yaml index 223f92dd4..9d0388977 100644 --- a/.github/workflows/push-build.yaml +++ b/.github/workflows/push-build.yaml @@ -78,6 +78,7 @@ jobs: - name: consider debugging if: failure() + timeout-minutes: 60 uses: ./.github/workflows/tmate_debug with: use-tmate: ${{ secrets.USE_TMATE }} diff --git a/.github/workflows/tmate_debug/action.yml b/.github/workflows/tmate_debug/action.yml index 9a83b788b..47fef44ea 100644 --- a/.github/workflows/tmate_debug/action.yml +++ b/.github/workflows/tmate_debug/action.yml @@ -3,26 +3,18 @@ description: "Setup tmate session if the test fails" inputs: use-tmate: description: "boolean for enabling TMATE" - required: false - timeout-minutes: - description: "timeout tmate debug session" - required: false - default: '60' -# ...name, description and inputs as above + required: true runs: using: "composite" steps: - name: consider debugging shell: bash --noprofile --norc -eo pipefail -x {0} - if: failure() && github.event_name == 'pull_request' run: | # Enable tmate only in the Rook fork, where the USE_TMATE secret is set in the repo, or if the action is re-run if [ "$GITHUB_REPOSITORY_OWNER" = "rook" ] || [ -n "${{ inputs.use-tmate }}" ] || [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then echo USE_TMATE=1 >> $GITHUB_ENV fi - echo "${{ inputs.timeout-minutes }}" - name: set up tmate session for debugging - if: failure() && env.USE_TMATE + if: env.USE_TMATE uses: mxschmitt/action-tmate@v3 - timeout-minutes: "${{ inputs.timeout-minutes }}"