Skip to content

Commit b7aaa8b

Browse files
committed
Merged report step for git-clone
1 parent cdbd70b commit b7aaa8b

File tree

6 files changed

+11
-21
lines changed

6 files changed

+11
-21
lines changed

templates/common-steps.tpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{- define "common_steps" -}}
2+
{{- $script := index . 2 -}}
23
{{- $workspace := index . 1 -}}
34
{{- with index . 0 -}}
45
- name: prepare-and-run
@@ -10,7 +11,7 @@
1011
workingDir: $(workspaces.output.path)
1112
{{- end }}
1213
script: |
13-
{{- include "load_scripts" ( list . ( list "" ) ( list "/scripts/prepare.sh" "/scripts/git-run.sh" ) ) | nindent 4 }}
14+
{{- include "load_scripts" ( list . ( list "" ) ( list "/scripts/prepare.sh" "/scripts/git-run.sh" $script ) ) | nindent 4 }}
1415
volumeMounts:
1516
- name: scripts-dir
1617
mountPath: /scripts

templates/load-scripts.tpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ set -e
1414
printf '%s' "{{ $content | toString | b64enc }}" |base64 -d >"/scripts/{{ $name }}"
1515
{{- end }}
1616
{{- end }}
17-
ls /scripts/{{ $prefix }}*.sh;
1817
chmod +x /scripts/{{ $prefix }}*.sh;
1918
{{- end }}
2019

2120
{{- range $i, $script := index . 2 -}}
21+
{{- if ne $script "" -}}
2222
echo "Running Script {{ $script }}";
23-
{{ $script }};
23+
{{ $script }};
24+
{{- end -}}
2425
{{- end }}
2526
{{- end -}}

templates/spec-git.tpl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{{- $params := index . 2 -}}
44
{{- $results := index . 3 -}}
55
{{- $env_vars := index . 4 -}}
6-
{{- $steps := index . 5 -}}
6+
{{- $script := index . 5 -}}
77
{{- $workspace := index . 6 -}}
88
{{- with index . 0 -}}
99
workspaces:
@@ -47,10 +47,7 @@ stepTemplate:
4747
{{- end }}
4848

4949
steps:
50-
{{- include "common_steps" ( list . $workspace ) | nindent 2 }}
51-
{{- if ne $steps "" }}
52-
{{- include $steps . | nindent 2}}
53-
{{- end}}
50+
{{- include "common_steps" ( list . $workspace $script ) | nindent 2 }}
5451

5552
{{- end -}}
5653
{{- end -}}

templates/steps-git-clone.tpl

Lines changed: 0 additions & 9 deletions
This file was deleted.

templates/task-git-cli.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"params.GIT_SCRIPT"
88
"workspaces.source.path"
99
}}
10-
{{ $steps := "" -}}
10+
{{ $script := "" -}}
1111
---
1212
apiVersion: tekton.dev/v1
1313
kind: Task
@@ -27,4 +27,4 @@ spec:
2727
the task. This task needs authentication to git in order to push
2828
after the git operation.
2929
30-
{{ include "spec_git" ( list . $workspaces $params $results $env_vars $steps "source" ) | nindent 2 }}
30+
{{ include "spec_git" ( list . $workspaces $params $results $env_vars $script "source" ) | nindent 2 }}

templates/task-git-clone.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"results.URL.path"
1313
"workspaces.output.path"
1414
}}
15-
{{- $steps := "steps_git_clone" -}}
15+
{{- $script := "/scripts/report.sh" -}}
1616
---
1717
apiVersion: tekton.dev/v1
1818
kind: Task
@@ -28,4 +28,4 @@ spec:
2828
description: |
2929
{{ .Chart.Description }}
3030
31-
{{ include "spec_git" ( list . $workspaces $params $results $env_vars $steps "output" ) | nindent 2 }}
31+
{{ include "spec_git" ( list . $workspaces $params $results $env_vars $script "output" ) | nindent 2 }}

0 commit comments

Comments
 (0)