/
scripts_constants.go
43 lines (38 loc) · 1.17 KB
/
scripts_constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package pod
// TODO(#3972): Use text/template templating instead of %s based templating
const (
debugContinueScriptTemplate = `
numberOfSteps=%d
debugInfo=%s
tektonTools=%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
echo "Executing step $stepNumber..."
else
echo "Last step (no. $stepNumber) has already been executed, breakpoint exiting !"
exit 0
fi`
debugFailScriptTemplate = `
numberOfSteps=%d
debugInfo=%s
tektonTools=%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
echo "Executing step $stepNumber..."
else
echo "Last step (no. $stepNumber) has already been executed, breakpoint exiting !"
exit 0
fi`
initScriptDirective = `tmpfile="%s"
touch ${tmpfile} && chmod +x ${tmpfile}
cat > ${tmpfile} << '%s'
%s
%s
`
)