From ddcb9efa9a830a1df2efe0c9a187d52f2fd719d7 Mon Sep 17 00:00:00 2001 From: subhamkrai Date: Wed, 23 Aug 2023 18:49:28 +0530 Subject: [PATCH] ci: enable tmate when in debug mode we don't want to wait for extra 10min once the ci passed, so we'll add a check if `debug-ci` label is added or debug runner is triggered from UI then only start tmate. Also, updaing the development doc and rook test doc. Signed-off-by: subhamkrai (cherry picked from commit a223b6777b54edc3a51409bd39fdf14a8bc81284) --- .github/workflows/tmate_debug/action.yml | 1 + Documentation/Contributing/development-flow.md | 16 ++++++++++++---- tests/README.md | 4 +--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tmate_debug/action.yml b/.github/workflows/tmate_debug/action.yml index b547188da..b6a32e5f5 100644 --- a/.github/workflows/tmate_debug/action.yml +++ b/.github/workflows/tmate_debug/action.yml @@ -9,6 +9,7 @@ runs: 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 diff --git a/Documentation/Contributing/development-flow.md b/Documentation/Contributing/development-flow.md index 33a04e0c5..6c4dac55d 100644 --- a/Documentation/Contributing/development-flow.md +++ b/Documentation/Contributing/development-flow.md @@ -195,8 +195,8 @@ to the [upstream Rook repository](https://github.com/rook/rook). Before opening the PR: -- If there are code changes, add unit tests and verify that all unit tests are passing. See [Unit Tests](#unit-tests) below on running unit tests. -- Rebase on the latest upstream changes +* If there are code changes, add unit tests and verify that all unit tests are passing. See [Unit Tests](#unit-tests) below on running unit tests. +* Rebase on the latest upstream changes ### Regression Testing @@ -245,7 +245,14 @@ Common cases that may need tests: Rook's upstream continuous integration (CI) tests will run integration tests against your changes automatically. -Integration tests will be run in Github actions. If an integration test fails, a tmate session will be available for troubleshooting for a short time. See the action details for an ssh connection to the Github runner. +## Tmate Session + +Integration tests will be run in Github actions. If an integration test fails, enable a tmate session to troubleshoot the issue by one of the following steps: + +* Restart the CI action and click the "Enable debug logging" checkbox from the github UI, or +* Add the label `debug-ci` to the PR and push your changes again. + +See the action details for an ssh connection to the Github runner. ## Commit structure @@ -287,7 +294,7 @@ To squash multiple commits or make other changes to the commit history, use `git git rebase -i HEAD~5 ``` -Once your commit history is clean, ensure the branch is rebased on the [latest upstream](#Updating-your-fork) before opening the PR. +Once your commit history is clean, ensure the branch is rebased on the [latest upstream](#updating-your-fork) before opening the PR. ## Submitting @@ -331,6 +338,7 @@ kubectl exec -n rook-ceph --stdin --tty $(kubectl get pod -n rook-ceph -l ceph_d 1. Restart the modified manager module to test the modifications: Example for restarting the rook manager module with the [krew plugin](https://github.com/rook/kubectl-rook-ceph): + ```console kubectl rook-ceph ceph mgr module disable rook kubectl rook-ceph ceph mgr module enable rook diff --git a/tests/README.md b/tests/README.md index 0bfe535b3..b721eced3 100644 --- a/tests/README.md +++ b/tests/README.md @@ -5,9 +5,7 @@ The framework includes scripts for starting Kubernetes so users can quickly spin up a Kubernetes cluster. The tests are generally designed to install Rook, run tests, and uninstall Rook. The CI runs the integration tests with each PR and each master or release branch build. -If the tests fail in a PR, a tmate session is started which will allow you to connect via ssh and troubleshoot the failure. -The CI is the most efficient way to troubleshoot the tests since the environment is started automatically -and you will only need to connect to investigate. +If the tests fail in a PR, [access](development-flow.md#tmate-session) the tmate for debugging. This document will outline the steps to run the integration tests locally in a minikube environment, should the CI not be sufficient to troubleshoot.