Skip to content

Commit

Permalink
Merge pull request #214 from subhamkrai/add-tmate
Browse files Browse the repository at this point in the history
ci: access tmate when ci is debug mode or label `debug-ci` is added
  • Loading branch information
travisn authored Dec 13, 2023
2 parents afdfd7a + a8e9f04 commit 79fca21
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/go-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ jobs:
with:
go-version: "1.20"

- name: consider debugging
uses: ./.github/workflows/tmate_debug
with:
use-tmate: ${{ secrets.USE_TMATE }}

- name: setup cluster
uses: ./.github/workflows/cluster-setup
with:
Expand Down Expand Up @@ -73,7 +78,7 @@ jobs:
- name: Subvolume command
run: |
set -ex
kubectl rook-ceph ceph fs subvolume create myfs test-subvol group-a
kubectl rook-ceph ceph fs subvolume create myfs test-subvol group-a
kubectl rook-ceph subvolume ls
kubectl rook-ceph subvolume ls --stale
kubectl rook-ceph subvolume delete test-subvol myfs group-a
Expand Down Expand Up @@ -163,6 +168,11 @@ jobs:
with:
go-version: "1.20"

- name: consider debugging
uses: ./.github/workflows/tmate_debug
with:
use-tmate: ${{ secrets.USE_TMATE }}

- name: setup cluster
uses: ./.github/workflows/cluster-setup
with:
Expand Down Expand Up @@ -210,7 +220,7 @@ jobs:
- name: Subvolume command
run: |
set -ex
kubectl rook-ceph --operator-namespace test-operator -n test-cluster ceph fs subvolume create myfs test-subvol group-a
kubectl rook-ceph --operator-namespace test-operator -n test-cluster ceph fs subvolume create myfs test-subvol group-a
kubectl rook-ceph --operator-namespace test-operator -n test-cluster subvolume ls
kubectl rook-ceph --operator-namespace test-operator -n test-cluster subvolume ls --stale
kubectl rook-ceph --operator-namespace test-operator -n test-cluster subvolume delete test-subvol myfs group-a
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/tmate_debug/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Tmate debugging tests"
description: "Setup tmate session if the test fails"
inputs:
use-tmate:
description: "boolean for enabling TMATE"
required: true
runs:
using: "composite"
steps:
- name: consider debugging
shell: bash --noprofile --norc -eo pipefail -x {0}
if: runner.debug || contains(github.event.pull_request.labels.*.name, 'debug-ci')
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
- name: set up tmate session for debugging
if: env.USE_TMATE
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: false
detached: true

0 comments on commit 79fca21

Please sign in to comment.