Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug with breakpoint onFailure to TaskRun Spec #3857

Merged
merged 1 commit into from
Jul 9, 2021

Conversation

waveywaves
Copy link
Member

@waveywaves waveywaves commented Mar 25, 2021

Changes

Add debug with breakpoint onFailure to TaskRun Spec

  • Add -breakpoint_on_failure to entrypointer which disables exit of container upon failure
  • If debug is enabled (as shown below) mount /tekton/debug/scripts and /tekton/debug/info/<step-no> to TaskRun Pod.
spec:
  debug:
    breakpoint: ["onFailure"]
  • Add debug helper scripts to /tekton/debug/scripts
  • Add /tekton/debug/info/ mount which is used by helper scripts to understand which step they are running in where denotes the step number. First step = 0, Second step = 1 and so on.

In addition, categorize the changes you're making using the "/kind" Prow command, example:

/kind feature

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

Release Notes

  • Add -breakpoint_on_failure to entrypointer which disables exit of container upon failure
  • Add debug helper scripts to /tekton/debug/scripts
  • Add /tekton/debug/info/ mount which is used by helper scripts to understand which step they are running in where denotes the step number. First step = 0, Second step = 1 and so on.

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Mar 25, 2021
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 25, 2021
@waveywaves waveywaves changed the title Add breakpoint to TaskRun Spec Add debug with breakpoint onFailure to TaskRun Spec Mar 25, 2021
@waveywaves waveywaves changed the title Add debug with breakpoint onFailure to TaskRun Spec WIP: Add debug with breakpoint onFailure to TaskRun Spec Mar 25, 2021
@tekton-robot tekton-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 25, 2021
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 64.0% 64.2% 0.2

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 64.0% 64.2% 0.2
pkg/pod/entrypoint.go 84.8% 80.3% -4.6
pkg/pod/pod.go 87.4% 86.7% -0.7
pkg/pod/script.go 100.0% 60.7% -39.3

@waveywaves
Copy link
Member Author

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 25, 2021
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 64.0% 64.2% 0.2

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 64.0% 64.2% 0.2
pkg/pod/entrypoint.go 84.8% 80.3% -4.6
pkg/pod/pod.go 87.4% 86.7% -0.7
pkg/pod/script.go 100.0% 61.4% -38.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 64.0% 64.2% 0.2
pkg/pod/entrypoint.go 84.8% 80.3% -4.6
pkg/pod/pod.go 87.4% 86.7% -0.7
pkg/pod/script.go 100.0% 61.0% -39.0

@imjasonh
Copy link
Member

/assign

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 64.0% 64.2% 0.2
pkg/pod/entrypoint.go 84.8% 80.3% -4.6
pkg/pod/pod.go 87.4% 86.7% -0.7
pkg/pod/script.go 100.0% 59.3% -40.7

@waveywaves waveywaves force-pushed the api/debug branch 2 times, most recently from 143690e to 0390f18 Compare March 25, 2021 22:17
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 64.0% 64.2% 0.2
pkg/pod/entrypoint.go 84.8% 80.3% -4.6
pkg/pod/pod.go 87.4% 86.7% -0.7
pkg/pod/script.go 100.0% 59.3% -40.7

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 64.0% 64.2% 0.2
pkg/pod/entrypoint.go 84.8% 80.3% -4.6
pkg/pod/pod.go 87.4% 86.7% -0.7
pkg/pod/script.go 100.0% 59.3% -40.7

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 64.0% 64.2% 0.2
pkg/pod/entrypoint.go 84.8% 80.3% -4.6
pkg/pod/pod.go 87.4% 86.7% -0.7
pkg/pod/script.go 100.0% 59.3% -40.7

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
cmd/entrypoint/waiter.go 69.2% 80.0% 10.8
pkg/entrypoint/entrypointer.go 64.0% 66.1% 2.1
pkg/pod/entrypoint.go 84.8% 85.9% 1.1
pkg/pod/pod.go 87.2% 87.6% 0.4

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
cmd/entrypoint/waiter.go 69.2% 80.0% 10.8
pkg/entrypoint/entrypointer.go 64.0% 66.1% 2.1
pkg/pod/entrypoint.go 84.8% 85.9% 1.1
pkg/pod/pod.go 87.2% 87.6% 0.4

@waveywaves
Copy link
Member Author

/test tekton-pipeline-unit-tests

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
cmd/entrypoint/waiter.go 69.2% 80.0% 10.8
pkg/entrypoint/entrypointer.go 64.0% 66.1% 2.1
pkg/pod/entrypoint.go 84.8% 85.9% 1.1
pkg/pod/pod.go 87.2% 87.6% 0.4

@waveywaves
Copy link
Member Author

/test tekton-pipeline-unit-tests

@waveywaves
Copy link
Member Author

/test pull-tekton-pipeline-alpha-integration-tests

@waveywaves
Copy link
Member Author

/test pull-tekton-pipeline-build-tests

@waveywaves
Copy link
Member Author

/test pull-tekton-pipeline-integration-tests

@waveywaves
Copy link
Member Author

/test pull-tekton-pipeline-alpha-integration-tests

1 similar comment
@waveywaves
Copy link
Member Author

/test pull-tekton-pipeline-alpha-integration-tests

docs/taskruns.md Outdated Show resolved Hide resolved
cmd/entrypoint/main.go Outdated Show resolved Hide resolved
pkg/entrypoint/entrypointer.go Outdated Show resolved Hide resolved
pkg/pod/script.go Outdated Show resolved Hide resolved
pkg/pod/script.go Outdated Show resolved Hide resolved
Based on TEP-0042, this commit adds the ability for the user to debug TaskRuns with the spec.debug delaration where the user can provide breakpoints in spec.debug.breakpoint. With this commit the only breakpoint supported right now is the "onFailure" breakpoint which pauses the TaskRun during a step failure so the user can get shell access to the failed step container and debug. The following additions have been done.

- Add -breakpoint_on_failure to entrypointer which disables
exit of container upon failure
- Add debug helper scripts to /tekton/debug/scripts which contains continuing the TaskRun and marking the step as a success or a failure by writing <n>.breakpointexit file to /tekton/tools
- Add /tekton/debug/info/<n> mount which is used by helper scripts to understand which step they are running in where <n> denotes the step number eg: First step = 0, Second step = 1 and so on.
- Exit code is propogated from .breakpointexit to end of TaskRun
- Disable step skipError if breakpoint enabled
- Add webhook validation for debug
- Add Debug as a alpha feature

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
cmd/entrypoint/waiter.go 69.2% 80.0% 10.8
pkg/entrypoint/entrypointer.go 64.0% 66.1% 2.1
pkg/pod/entrypoint.go 84.8% 85.9% 1.1
pkg/pod/pod.go 87.2% 87.6% 0.4

@waveywaves
Copy link
Member Author

/test pull-tekton-pipeline-alpha-integration-tests
/test tekton-pipeline-unit-tests
/test pull-tekton-pipeline-build-tests

@waveywaves
Copy link
Member Author

/test pull-tekton-pipeline-alpha-integration-tests
/test pull-tekton-pipeline-build-tests

@pritidesai
Copy link
Member

/test pull-tekton-pipeline-build-tests
/test pull-tekton-pipeline-alpha-integration-tests

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 9, 2021
- [Debug Scripts](#debug-scripts)


## Overview
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker but it might be worth mentioning here that debug is behind a feature flag.


## Debugging TaskRuns

The following provides explanation on how Debugging TaskRuns is possible through Tekton. To understand how to use
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it's developer-focused to me. Wonder if it should live under docs/developers/debug.md?

@@ -447,6 +449,43 @@ spec:
status: "TaskRunCancelled"
```


### Debugging a `TaskRun`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again probably worth mentioning that this is an alpha feature, with a link to the "Alpha Features" section of docs/install.md.

@ghost
Copy link

ghost commented Jul 9, 2021

Adding lgtm since the remaining changes I've suggested are small doc fixes.

Suggest also adding an entry about debug to the "Alpha Features" section of install.md..

/lgtm

@tekton-robot tekton-robot assigned ghost Jul 9, 2021
@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 9, 2021
@tekton-robot tekton-robot merged commit 5a4d1f9 into tektoncd:main Jul 9, 2021
@waveywaves
Copy link
Member Author

@sbwsg I will create a separate PR for the doc changes. Thank you for taking time to review this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants