Skip to content

Merged report step for git-clone #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}