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 05674ed
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions docs/developers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ Here is an example of a directory layout for a simple Task with 2 script steps:
| /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 | [Debug scripts](https:/tektoncd/pipeline/blob/main/docs/debug.md#debug-scripts) used for managing the step lifecycle and the [Debug Info](https:/tektoncd/pipeline/blob/main/docs/debug.md#mounts) mount used to assist in 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)) |
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 05674ed

Please sign in to comment.