Skip to content

Commit

Permalink
Removed Extra Load Scripts Step
Browse files Browse the repository at this point in the history
  • Loading branch information
Aneesh-M-Bhat authored and openshift-merge-bot[bot] committed Sep 4, 2024
1 parent acca982 commit d18a0fc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
34 changes: 16 additions & 18 deletions templates/load-scripts.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,22 @@
*/ -}}

{{- define "load_scripts" -}}
{{- $global := index . 0 -}}
- name: load-scripts
image: {{ $global.Values.images.minimal }}
workingDir: /scripts
script: |
set -e
{{- range $i, $prefix := . -}}
{{- if gt $i 0 }}
{{- range $path, $content := $global.Files.Glob "scripts/*.sh" }}
{{- $name := trimPrefix "scripts/" $path }}
{{- if or ( hasPrefix $prefix $name ) ( hasPrefix "common" $name ) }}
printf '%s' "{{ $content | toString | b64enc }}" |base64 -d >{{ $name }}
{{- end }}
{{- end }}
chmod +x {{ $prefix }}*.sh
{{- $global := index . 0 -}}
set -e
{{- range $i, $prefix := index . 1 -}}
{{- range $path, $content := $global.Files.Glob "scripts/*.sh" }}
{{- $name := trimPrefix "scripts/" $path }}
echo "/scripts/{{ $name }}"
{{- if or ( hasPrefix $prefix $name ) ( hasPrefix "common" $name ) }}
printf '%s' "{{ $content | toString | b64enc }}" |base64 -d >"/scripts/{{ $name }}"
{{- end }}
{{- end }}
volumeMounts:
- name: scripts-dir
mountPath: /scripts
ls /scripts/{{ $prefix }}*.sh;
chmod +x /scripts/{{ $prefix }}*.sh;
{{- end }}

{{- range $i, $script := index . 2 -}}
echo "Running Script {{ $script }}";
{{ $script }};
{{- end }}
{{- end -}}
6 changes: 2 additions & 4 deletions templates/task-maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,13 @@ spec:
{{- include "environment" ( list $variables ) | nindent 6 }}

steps:
{{- include "load_scripts" ( list . "maven-" ) | nindent 4 }}

- name: maven-generate
image: {{ .Values.images.minimal }}
env:
- name: HOME
value: /tekton/home
command:
- /scripts/maven-generate.sh
script: |
{{- include "load_scripts" ( list . ( list "maven-" ) ( list "/scripts/maven-generate.sh" ) ) | nindent 8 }}
securityContext:
runAsNonRoot: true
runAsUser: 65532
Expand Down

0 comments on commit d18a0fc

Please sign in to comment.