From f171e1c037626c58590fba1aae1d06ff2385fd8c Mon Sep 17 00:00:00 2001 From: subhamkrai Date: Tue, 25 Jul 2023 16:48:07 +0530 Subject: [PATCH] ci: add detached mode in tmate with detached mode, we don't need to wait for the tests to complete. Now, we can get inside tmate before the tests start and we can monitor the tests. By default, this mode will wait at the end of the job for a user to connect and then to terminate the tmate session. If no user has connected within 10 minutes after the post-job step started, it will terminate the tmate session and quit gracefully. Signed-off-by: subhamkrai --- .github/workflows/build.yml | 23 +- .github/workflows/canary-integration-test.yml | 223 ++++++++---------- .../integration-test-helm-suite.yaml | 12 +- .../workflows/integration-test-mgr-suite.yaml | 12 +- .../integration-test-multi-cluster-suite.yaml | 12 +- .../integration-test-object-suite.yaml | 12 +- .../integration-test-smoke-suite.yaml | 12 +- .../integration-test-upgrade-suite.yaml | 22 +- .github/workflows/push-build.yaml | 12 +- .github/workflows/tmate_debug/action.yml | 1 + 10 files changed, 154 insertions(+), 187 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d265c29c8..3fb31e23b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - uses: actions/setup-go@v4 with: go-version: "1.20" @@ -71,12 +76,6 @@ jobs: - name: validate gen-rbac 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 }} linux-build-all: runs-on: ubuntu-20.04 @@ -91,6 +90,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup golang ${{ matrix.go-version }} uses: actions/setup-go@v4 with: @@ -104,10 +108,3 @@ jobs: - name: build.all rook with go ${{ matrix.go-version }} run: | tests/scripts/github-action-helper.sh build_rook_all - - - 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 142555a10..5be534ae1 100644 --- a/.github/workflows/canary-integration-test.yml +++ b/.github/workflows/canary-integration-test.yml @@ -34,6 +34,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -232,12 +237,6 @@ jobs: with: name: canary - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} raw-disk: runs-on: ubuntu-20.04 @@ -248,6 +247,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -286,12 +290,6 @@ jobs: with: name: canary - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} two-osds-in-device: runs-on: ubuntu-20.04 @@ -301,6 +299,10 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} - name: setup cluster resources uses: ./.github/workflows/canary-test-config @@ -334,12 +336,6 @@ jobs: with: name: canary - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} osd-with-metadata-device: runs-on: ubuntu-20.04 @@ -350,6 +346,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -388,12 +389,6 @@ jobs: with: name: canary - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} encryption: runs-on: ubuntu-20.04 @@ -404,6 +399,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -436,11 +436,6 @@ jobs: with: name: canary - - name: setup tmate session for debugging when event is PR - if: failure() && github.event_name == 'pull_request' - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 - lvm: runs-on: ubuntu-20.04 if: "!contains(github.event.pull_request.labels.*.name, 'skip-ci')" @@ -450,6 +445,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -487,12 +487,6 @@ jobs: with: name: canary - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} pvc: runs-on: ubuntu-20.04 @@ -503,6 +497,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -561,12 +560,6 @@ jobs: with: name: pvc - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} pvc-db: runs-on: ubuntu-20.04 @@ -577,6 +570,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -611,12 +609,6 @@ jobs: with: name: pvc-db - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} pvc-db-wal: runs-on: ubuntu-20.04 @@ -627,6 +619,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -664,12 +661,6 @@ jobs: with: name: pvc-db-wal - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} encryption-pvc: runs-on: ubuntu-20.04 @@ -680,6 +671,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -729,12 +725,6 @@ jobs: with: name: encryption-pvc - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} encryption-pvc-db: runs-on: ubuntu-20.04 @@ -745,6 +735,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -781,12 +776,6 @@ jobs: with: name: encryption-pvc-db - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} encryption-pvc-db-wal: runs-on: ubuntu-20.04 @@ -797,6 +786,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -843,12 +837,6 @@ jobs: with: name: encryption-pvc-db-wal - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - 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 @@ -859,6 +847,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -926,12 +919,6 @@ jobs: with: name: encryption-pvc-kms-vault-token-auth - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - 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 @@ -942,6 +929,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -989,12 +981,6 @@ jobs: with: name: encryption-pvc-kms-vault-k8s-auth - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} lvm-pvc: runs-on: ubuntu-20.04 @@ -1005,6 +991,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -1044,12 +1035,6 @@ jobs: with: name: lvm-pvc - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} multi-cluster-mirroring: runs-on: ubuntu-20.04 @@ -1060,6 +1045,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -1300,12 +1290,6 @@ jobs: with: name: multi-cluster-mirroring - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} rgw-multisite-testing: @@ -1317,6 +1301,12 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: run RGW multisite test uses: ./.github/workflows/rgw-multisite-test with: @@ -1330,12 +1320,6 @@ jobs: name: rgw-multisite-testing path: test - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} encryption-pvc-kms-ibm-kp: @@ -1345,6 +1329,12 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: run encryption KMS IBM Key Protect uses: ./.github/workflows/encryption-pvc-kms-ibm-kp if: "env.IBM_KP_SERVICE_INSTANCE_ID != '' && env.IBM_KP_SERVICE_API_KEY != ''" @@ -1363,12 +1353,6 @@ jobs: name: encryption-pvc-kms-ibm-kp path: test - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} multus-cluster-network: @@ -1380,6 +1364,12 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup golang uses: actions/setup-go@v4 with: @@ -1443,12 +1433,6 @@ jobs: with: name: canary-multus - - name: consider debugging - if: failure() && github.event_name == 'pull_request' - timeout-minutes: 60 - uses: ./.github/workflows/tmate_debug - with: - use-tmate: ${{ secrets.USE_TMATE }} csi-hostnetwork-disabled: @@ -1460,6 +1444,12 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/canary-test-config with: @@ -1496,10 +1486,3 @@ jobs: uses: ./.github/workflows/collect-logs with: name: csi-hostnetwork-disabled - - - 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 325265e82..115aa5f13 100644 --- a/.github/workflows/integration-test-helm-suite.yaml +++ b/.github/workflows/integration-test-helm-suite.yaml @@ -32,6 +32,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup latest cluster resources uses: ./.github/workflows/integration-test-config-latest-k8s with: @@ -63,10 +68,3 @@ jobs: with: name: ceph-helm-suite-artifact-${{ matrix.kubernetes-versions }} path: /home/runner/work/rook/rook/tests/integration/_output/tests/ - - - 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 e0205df05..8f75eeb3f 100644 --- a/.github/workflows/integration-test-mgr-suite.yaml +++ b/.github/workflows/integration-test-mgr-suite.yaml @@ -31,6 +31,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/integration-test-config-latest-k8s with: @@ -57,10 +62,3 @@ jobs: with: name: ceph-mgr-suite-artifact-${{ matrix.kubernetes-versions }} path: /home/runner/work/rook/rook/tests/integration/_output/tests/ - - - 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 0ab910d75..9f2a44a86 100644 --- a/.github/workflows/integration-test-multi-cluster-suite.yaml +++ b/.github/workflows/integration-test-multi-cluster-suite.yaml @@ -32,6 +32,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/integration-test-config-latest-k8s with: @@ -59,10 +64,3 @@ jobs: with: name: ceph-multi-cluster-deploy-suite-artifact-${{ matrix.kubernetes-versions }} path: /home/runner/work/rook/rook/tests/integration/_output/tests/ - - - 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 316bc5169..a8bf584cc 100644 --- a/.github/workflows/integration-test-object-suite.yaml +++ b/.github/workflows/integration-test-object-suite.yaml @@ -32,6 +32,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup latest cluster resources uses: ./.github/workflows/integration-test-config-latest-k8s with: @@ -58,10 +63,3 @@ jobs: with: name: ceph-object-suite-artifact-${{ matrix.kubernetes-versions }} path: /home/runner/work/rook/rook/tests/integration/_output/tests/ - - - 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 9f3d3a5ed..632a8713c 100644 --- a/.github/workflows/integration-test-smoke-suite.yaml +++ b/.github/workflows/integration-test-smoke-suite.yaml @@ -32,6 +32,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/integration-test-config-latest-k8s with: @@ -58,10 +63,3 @@ jobs: with: name: ceph-smoke-suite-artifact-${{ matrix.kubernetes-versions }} path: /home/runner/work/rook/rook/tests/integration/_output/tests/ - - - 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 b2b4c2952..4d4549b73 100644 --- a/.github/workflows/integration-test-upgrade-suite.yaml +++ b/.github/workflows/integration-test-upgrade-suite.yaml @@ -32,6 +32,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/integration-test-config-latest-k8s with: @@ -59,11 +64,6 @@ jobs: name: ceph-upgrade-suite-artifact-${{ matrix.kubernetes-versions }} path: /home/runner/work/rook/rook/tests/integration/_output/tests/ - - name: setup tmate session for debugging when event is PR - if: failure() && github.event_name == 'pull_request' - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 60 - TestHelmUpgradeSuite: if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && !contains(github.event.pull_request.labels.*.name, 'skip-ci') }} runs-on: ubuntu-20.04 @@ -77,6 +77,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - name: setup cluster resources uses: ./.github/workflows/integration-test-config-latest-k8s with: @@ -106,10 +111,3 @@ jobs: with: name: ceph-upgrade-helm-suite-artifact-${{ matrix.kubernetes-versions }} path: /home/runner/work/rook/rook/tests/integration/_output/tests/ - - - 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 e08b54d20..531a196e6 100644 --- a/.github/workflows/push-build.yaml +++ b/.github/workflows/push-build.yaml @@ -25,6 +25,11 @@ jobs: with: fetch-depth: 0 + - name: consider debugging + uses: ./.github/workflows/tmate_debug + with: + use-tmate: ${{ secrets.USE_TMATE }} + - uses: actions/setup-go@v4 with: go-version: "1.20" @@ -75,10 +80,3 @@ jobs: GITHUB_REF: $ {{ env.GITHUB_REF }} run: | tests/scripts/build-release.sh - - - 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 1954edfdc..b547188da 100644 --- a/.github/workflows/tmate_debug/action.yml +++ b/.github/workflows/tmate_debug/action.yml @@ -20,3 +20,4 @@ runs: uses: mxschmitt/action-tmate@v3 with: limit-access-to-actor: false + detached: true