Skip to content

Commit

Permalink
Merged report step for git-clone
Browse files Browse the repository at this point in the history
  • Loading branch information
Aneesh-M-Bhat authored and savitaashture committed Sep 17, 2024
1 parent cdbd70b commit f23e091
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 21 deletions.
3 changes: 2 additions & 1 deletion templates/common-steps.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- define "common_steps" -}}
{{- $script := index . 2 -}}
{{- $workspace := index . 1 -}}
{{- with index . 0 -}}
- name: prepare-and-run
Expand All @@ -10,7 +11,7 @@
workingDir: $(workspaces.output.path)
{{- end }}
script: |
{{- include "load_scripts" ( list . ( list "" ) ( list "/scripts/prepare.sh" "/scripts/git-run.sh" ) ) | nindent 4 }}
{{- include "load_scripts" ( list . ( list "" ) ( list "/scripts/prepare.sh" "/scripts/git-run.sh" $script ) ) | nindent 4 }}
volumeMounts:
- name: scripts-dir
mountPath: /scripts
Expand Down
5 changes: 3 additions & 2 deletions templates/load-scripts.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ set -e
printf '%s' "{{ $content | toString | b64enc }}" |base64 -d >"/scripts/{{ $name }}"
{{- end }}
{{- end }}
ls /scripts/{{ $prefix }}*.sh;
chmod +x /scripts/{{ $prefix }}*.sh;
{{- end }}

{{- range $i, $script := index . 2 -}}
{{- if ne $script "" -}}
echo "Running Script {{ $script }}";
{{ $script }};
{{ $script }};
{{- end -}}
{{- end }}
{{- end -}}
7 changes: 2 additions & 5 deletions templates/spec-git.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{- $params := index . 2 -}}
{{- $results := index . 3 -}}
{{- $env_vars := index . 4 -}}
{{- $steps := index . 5 -}}
{{- $script := index . 5 -}}
{{- $workspace := index . 6 -}}
{{- with index . 0 -}}
workspaces:
Expand Down Expand Up @@ -47,10 +47,7 @@ stepTemplate:
{{- end }}

steps:
{{- include "common_steps" ( list . $workspace ) | nindent 2 }}
{{- if ne $steps "" }}
{{- include $steps . | nindent 2}}
{{- end}}
{{- include "common_steps" ( list . $workspace $script ) | nindent 2 }}

{{- end -}}
{{- end -}}
9 changes: 0 additions & 9 deletions templates/steps-git-clone.tpl

This file was deleted.

4 changes: 2 additions & 2 deletions templates/task-git-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"params.GIT_SCRIPT"
"workspaces.source.path"
}}
{{ $steps := "" -}}
{{ $script := "" -}}
---
apiVersion: tekton.dev/v1
kind: Task
Expand All @@ -27,4 +27,4 @@ spec:
the task. This task needs authentication to git in order to push
after the git operation.
{{ include "spec_git" ( list . $workspaces $params $results $env_vars $steps "source" ) | nindent 2 }}
{{ include "spec_git" ( list . $workspaces $params $results $env_vars $script "source" ) | nindent 2 }}
4 changes: 2 additions & 2 deletions templates/task-git-clone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"results.URL.path"
"workspaces.output.path"
}}
{{- $steps := "steps_git_clone" -}}
{{- $script := "/scripts/report.sh" -}}
---
apiVersion: tekton.dev/v1
kind: Task
Expand All @@ -28,4 +28,4 @@ spec:
description: |
{{ .Chart.Description }}
{{ include "spec_git" ( list . $workspaces $params $results $env_vars $steps "output" ) | nindent 2 }}
{{ include "spec_git" ( list . $workspaces $params $results $env_vars $script "output" ) | nindent 2 }}

0 comments on commit f23e091

Please sign in to comment.