570a3a67 by Adam Heath

Extracted files to a separate repo.

1 parent 37496cba
1 apiVersion: kustomize.config.k8s.io/v1beta1
2 kind: Kustomization
3
4 resources:
5 - ./task-s5cmd-download.yaml
6
7 configMapGenerator:
8 - name: task-s5cmd-scripts
9 options:
10 disableNameSuffixHash: true
11 files:
12 - scripts/download-files.sh
13 ---
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 download!" 1>&2
7 fi
8 if [ "z$DOWNLOAD_OUTPUT" = z ]; then
9 had_error=$(($had_error + 1))
10 echo "DOWNLOAD_OUTPUT variable not set!" 1>&2
11 fi
12 if [ $had_error -gt 0 ]; then
13 exit 1
14 fi
15 echo "Downloading files: $@"
16 echo " placing them in: $DOWNLOAD_OUTPUT"
17
18 for item in "$@"; do
19 target="${item%%:*}"
20 source="${item#*:}"
21 /s5cmd cp "$source" "$DOWNLOAD_OUTPUT/$target"
22 done
1 ---
2 apiVersion: tekton.dev/v1beta1
3 kind: Task
4 metadata:
5 name: task-s5cmd-download
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: download-files
29 image: $(params.s5cmd-image)
30 command: ["/task-s5cmd-scripts/download-files.sh"]
31 args: ["$(params.items[*])"]
32 env:
33 - name: DOWNLOAD_OUTPUT
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 ---