Skip to content

Commit

Permalink
make debug scripts comply with new /tekton/run
Browse files Browse the repository at this point in the history
- fix debug scripts (in /tekton/debug/scripts) to write entrypoint completion
files to /tekton/run/<step-no.>/out and /tekton/run/<step-no.>/out.err
instead of /tekton/run/<step-no.> and /tekton/run/<step-no.>.err.
  • Loading branch information
waveywaves committed Dec 13, 2021
1 parent 76bd56a commit 6297b45
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
25 changes: 13 additions & 12 deletions docs/developers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,19 @@ Here is an example of a directory layout for a simple Task with 2 script steps:
`-- termination
```

| Path | Description |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| /tekton | Directory used for Tekton specific functionality |
| /tekton/bin | Tekton provided binaries / tools |
| /tekton/creds | Location of Tekton mounted secrets. See [Authentication at Run Time](../auth.md) for more details. |
| /tekton/downward | Location of data mounted via the [Downward API](https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#the-downward-api). |
| /tekton/home | (deprecated - see https:/tektoncd/pipeline/issues/2013) Default home directory for user containers. |
| /tekton/results | Where [results](#results) are written to (path available to `Task` authors via [`$(results.name.path)`](../variables.md)) |
| /tekton/run | Runtime variable data. [Used for coordinating step ordering](#entrypoint-rewriting-and-step-ordering). |
| /tekton/scripts | Contains user provided scripts specified in the TaskSpec. |
| /tekton/steps | Where the `step` exitCodes are written to (path available to `Task` authors via [`$(steps.<stepName>.exitCode.path)`](../variables.md#variables-available-in-a-task)) |
| /tekton/termination | where the eventual [termination log message](https://kubernetes.io/docs/tasks/debug-application-cluster/determine-reason-pod-failure/#writing-and-reading-a-termination-message) is written to [Sequencing step containers](#entrypoint-rewriting-and-step-ordering) |
| Path | Description |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| /tekton | Directory used for Tekton specific functionality |
| /tekton/bin | Tekton provided binaries / tools |
| /tekton/creds | Location of Tekton mounted secrets. See [Authentication at Run Time](../auth.md) for more details. |
| /tekton/debug | Contains [Debug scripts](https:/tektoncd/pipeline/blob/main/docs/debug.md#debug-scripts) used to manage step lifecycle during debugging at a breakpoint and the [Debug Info](https:/tektoncd/pipeline/blob/main/docs/debug.md#mounts) mount used to assist for the same. | |
| /tekton/downward | Location of data mounted via the [Downward API](https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#the-downward-api). |
| /tekton/home | (deprecated - see https:/tektoncd/pipeline/issues/2013) Default home directory for user containers. |
| /tekton/results | Where [results](#results) are written to (path available to `Task` authors via [`$(results.name.path)`](../variables.md)) |
| /tekton/run | Runtime variable data. [Used for coordinating step ordering](#entrypoint-rewriting-and-step-ordering). |
| /tekton/scripts | Contains user provided scripts specified in the TaskSpec. |
| /tekton/steps | Where the `step` exitCodes are written to (path available to `Task` authors via [`$(steps.<stepName>.exitCode.path)`](../variables.md#variables-available-in-a-task)) |
| /tekton/termination | where the eventual [termination log message](https://kubernetes.io/docs/tasks/debug-application-cluster/determine-reason-pod-failure/#writing-and-reading-a-termination-message) is written to [Sequencing step containers](#entrypoint-rewriting-and-step-ordering) |

The following directories are covered by the
[Tekton API Compatibility policy](../../api_compatibility_policy.md), and can be
Expand Down
12 changes: 6 additions & 6 deletions pkg/pod/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,14 @@ set -xe
numberOfSteps=4
debugInfo=/tekton/debug/info
tektonTools=/tekton/run
tektonRun=/tekton/run
postFile="$(ls ${debugInfo} | grep -E '[0-9]+' | tail -1)"
stepNumber="$(echo ${postFile} | sed 's/[^0-9]*//g')"
if [ $stepNumber -lt $numberOfSteps ]; then
touch ${tektonTools}/${stepNumber} # Mark step as success
echo "0" > ${tektonTools}/${stepNumber}.breakpointexit
touch ${tektonRun}/${stepNumber}/out # Mark step as success
echo "0" > ${tektonRun}/${stepNumber}/out.breakpointexit
echo "Executing step $stepNumber..."
else
echo "Last step (no. $stepNumber) has already been executed, breakpoint exiting !"
Expand All @@ -301,14 +301,14 @@ set -xe
numberOfSteps=4
debugInfo=/tekton/debug/info
tektonTools=/tekton/run
tektonRun=/tekton/run
postFile="$(ls ${debugInfo} | grep -E '[0-9]+' | tail -1)"
stepNumber="$(echo ${postFile} | sed 's/[^0-9]*//g')"
if [ $stepNumber -lt $numberOfSteps ]; then
touch ${tektonTools}/${stepNumber}.err # Mark step as a failure
echo "1" > ${tektonTools}/${stepNumber}.breakpointexit
touch ${tektonRun}/${stepNumber}/out.err # Mark step as a failure
echo "1" > ${tektonRun}/${stepNumber}/out.breakpointexit
echo "Executing step $stepNumber..."
else
echo "Last step (no. $stepNumber) has already been executed, breakpoint exiting !"
Expand Down
12 changes: 6 additions & 6 deletions pkg/pod/scripts_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ const (
debugContinueScriptTemplate = `
numberOfSteps=%d
debugInfo=%s
tektonTools=%s
tektonRun=%s
postFile="$(ls ${debugInfo} | grep -E '[0-9]+' | tail -1)"
stepNumber="$(echo ${postFile} | sed 's/[^0-9]*//g')"
if [ $stepNumber -lt $numberOfSteps ]; then
touch ${tektonTools}/${stepNumber} # Mark step as success
echo "0" > ${tektonTools}/${stepNumber}.breakpointexit
touch ${tektonRun}/${stepNumber}/out # Mark step as success
echo "0" > ${tektonRun}/${stepNumber}/out.breakpointexit
echo "Executing step $stepNumber..."
else
echo "Last step (no. $stepNumber) has already been executed, breakpoint exiting !"
Expand All @@ -21,14 +21,14 @@ fi`
debugFailScriptTemplate = `
numberOfSteps=%d
debugInfo=%s
tektonTools=%s
tektonRun=%s
postFile="$(ls ${debugInfo} | grep -E '[0-9]+' | tail -1)"
stepNumber="$(echo ${postFile} | sed 's/[^0-9]*//g')"
if [ $stepNumber -lt $numberOfSteps ]; then
touch ${tektonTools}/${stepNumber}.err # Mark step as a failure
echo "1" > ${tektonTools}/${stepNumber}.breakpointexit
touch ${tektonRun}/${stepNumber}/out.err # Mark step as a failure
echo "1" > ${tektonRun}/${stepNumber}/out.breakpointexit
echo "Executing step $stepNumber..."
else
echo "Last step (no. $stepNumber) has already been executed, breakpoint exiting !"
Expand Down

0 comments on commit 6297b45

Please sign in to comment.