Skip to content

Commit

Permalink
Removed 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 2, 2024
1 parent 478f5ca commit 4106455
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 35 deletions.
39 changes: 16 additions & 23 deletions templates/load-scripts.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,22 @@
*/ -}}

{{- define "load_scripts" -}}
{{- $global := index . 0 -}}
- name: load-scripts
image: {{ $global.Values.images.bash }}
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-opc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,13 @@ spec:
{{- include "environment" ( list $variables ) | nindent 6 }}

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

- name: opc
image: {{ .Values.images.opc }}
env:
- name: HOME
value: /tekton/home
command:
- /scripts/opc-client.sh
script: |
{{- include "load_scripts" ( list . ( list "opc-" ) ( list "/scripts/opc-client.sh" ) ) | nindent 8 }}
args: ["$(params.ARGS)"]
securityContext:
runAsNonRoot: true
Expand Down
6 changes: 2 additions & 4 deletions templates/task-openshift-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,13 @@ spec:
{{- include "environment" ( list $variables ) | nindent 6 }}

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

- name: oc
image: {{ .Values.images.openshiftCli }}
env:
- name: HOME
value: /tekton/home
command:
- /scripts/oc-client.sh
script: |
{{- include "load_scripts" ( list . ( list "oc-" ) ( list "/scripts/oc-client.sh" ) ) | nindent 8 }}
securityContext:
runAsNonRoot: true
runAsUser: 65532
Expand Down
6 changes: 2 additions & 4 deletions templates/task-tkn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,13 @@ spec:
{{- include "environment" ( list $variables ) | nindent 6 }}

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

- name: tkn
image: {{ .Values.images.tkn }}
env:
- name: HOME
value: /tekton/home
command:
- /scripts/tkn-client.sh
script: |
{{- include "load_scripts" ( list . ( list "tkn-" ) ( list "/scripts/tkn-client.sh" ) ) | nindent 8 }}
args: ["$(params.ARGS)"]
securityContext:
runAsNonRoot: true
Expand Down

0 comments on commit 4106455

Please sign in to comment.