bcece5dd by Adam Heath

Add task-s5cmd-upload.

1 parent 570a3a67
...@@ -3,6 +3,7 @@ kind: Kustomization ...@@ -3,6 +3,7 @@ kind: Kustomization
3 3
4 resources: 4 resources:
5 - ./task-s5cmd-download.yaml 5 - ./task-s5cmd-download.yaml
6 - ./task-s5cmd-upload.yaml
6 7
7 configMapGenerator: 8 configMapGenerator:
8 - name: task-s5cmd-scripts 9 - name: task-s5cmd-scripts
...@@ -10,4 +11,5 @@ configMapGenerator: ...@@ -10,4 +11,5 @@ configMapGenerator:
10 disableNameSuffixHash: true 11 disableNameSuffixHash: true
11 files: 12 files:
12 - scripts/download-files.sh 13 - scripts/download-files.sh
14 - scripts/upload-files.sh
13 --- 15 ---
......
1 #!/bin/sh
2 set -ex
3 had_error=0
4 if [ $# -eq 0 ]; then
5 had_error=$(($had_error + 1))
6 echo "No files to upload!" 1>&2
7 fi
8 if [ "z$UPLOAD_INPUT" = z ]; then
9 had_error=$(($had_error + 1))
10 echo "UPLOAD_INPUT variable not set!" 1>&2
11 fi
12 if [ $had_error -gt 0 ]; then
13 exit 1
14 fi
15 echo "Upload files: $@"
16 echo " from: $UPLOAD_INPUT"
17
18 for item in "$@"; do
19 target="${item%%:*}"
20 remote="${item#*:}"
21 /s5cmd cp "$UPLOAD_INPUT/$target" "$remote"
22 done
1 ---
2 apiVersion: tekton.dev/v1beta1
3 kind: Task
4 metadata:
5 name: task-s5cmd-upload
6 spec:
7 params:
8 - name: auth-config-map
9 type: string
10 default: foo
11 - name: auth-secret
12 type: string
13 default: bar
14 - name: items
15 type: array
16 - name: s5cmd-image
17 type: string
18 default: peakcom/s5cmd
19 workspaces:
20 - name: files
21 volumes:
22 - name: task-s5cmd-scripts
23 configMap:
24 name: task-s5cmd-scripts
25 defaultMode: 0755
26
27 steps:
28 - name: upload-files
29 image: $(params.s5cmd-image)
30 command: ["/task-s5cmd-scripts/upload-files.sh"]
31 args: ["$(params.items[*])"]
32 env:
33 - name: UPLOAD_INPUT
34 value: $(workspaces.files.path)
35 envFrom:
36 - configMapRef:
37 name: $(params.auth-config-map)
38 - secretRef:
39 name: $(params.auth-secret)
40 volumeMounts:
41 - name: task-s5cmd-scripts
42 mountPath: /task-s5cmd-scripts
43 ---