bcece5dd by Adam Heath

Add task-s5cmd-upload.

1 parent 570a3a67
......@@ -3,6 +3,7 @@ kind: Kustomization
resources:
- ./task-s5cmd-download.yaml
- ./task-s5cmd-upload.yaml
configMapGenerator:
- name: task-s5cmd-scripts
......@@ -10,4 +11,5 @@ configMapGenerator:
disableNameSuffixHash: true
files:
- scripts/download-files.sh
- scripts/upload-files.sh
---
......
#!/bin/sh
set -ex
had_error=0
if [ $# -eq 0 ]; then
had_error=$(($had_error + 1))
echo "No files to upload!" 1>&2
fi
if [ "z$UPLOAD_INPUT" = z ]; then
had_error=$(($had_error + 1))
echo "UPLOAD_INPUT variable not set!" 1>&2
fi
if [ $had_error -gt 0 ]; then
exit 1
fi
echo "Upload files: $@"
echo " from: $UPLOAD_INPUT"
for item in "$@"; do
target="${item%%:*}"
remote="${item#*:}"
/s5cmd cp "$UPLOAD_INPUT/$target" "$remote"
done
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: task-s5cmd-upload
spec:
params:
- name: auth-config-map
type: string
default: foo
- name: auth-secret
type: string
default: bar
- name: items
type: array
- name: s5cmd-image
type: string
default: peakcom/s5cmd
workspaces:
- name: files
volumes:
- name: task-s5cmd-scripts
configMap:
name: task-s5cmd-scripts
defaultMode: 0755
steps:
- name: upload-files
image: $(params.s5cmd-image)
command: ["/task-s5cmd-scripts/upload-files.sh"]
args: ["$(params.items[*])"]
env:
- name: UPLOAD_INPUT
value: $(workspaces.files.path)
envFrom:
- configMapRef:
name: $(params.auth-config-map)
- secretRef:
name: $(params.auth-secret)
volumeMounts:
- name: task-s5cmd-scripts
mountPath: /task-s5cmd-scripts
---