570a3a67 by Adam Heath

Extracted files to a separate repo.

1 parent 37496cba
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./task-s5cmd-download.yaml
configMapGenerator:
- name: task-s5cmd-scripts
options:
disableNameSuffixHash: true
files:
- scripts/download-files.sh
---
#!/bin/sh
set -ex
had_error=0
if [ $# -eq 0 ]; then
had_error=$(($had_error + 1))
echo "No files to download!" 1>&2
fi
if [ "z$DOWNLOAD_OUTPUT" = z ]; then
had_error=$(($had_error + 1))
echo "DOWNLOAD_OUTPUT variable not set!" 1>&2
fi
if [ $had_error -gt 0 ]; then
exit 1
fi
echo "Downloading files: $@"
echo " placing them in: $DOWNLOAD_OUTPUT"
for item in "$@"; do
target="${item%%:*}"
source="${item#*:}"
/s5cmd cp "$source" "$DOWNLOAD_OUTPUT/$target"
done
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: task-s5cmd-download
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: download-files
image: $(params.s5cmd-image)
command: ["/task-s5cmd-scripts/download-files.sh"]
args: ["$(params.items[*])"]
env:
- name: DOWNLOAD_OUTPUT
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
---