{{- define "template.upload-storage" -}} - name: upload-storage container: image: {{ .Values.images.awsCli | quote }} env: - name: AWS_ACCESS_KEY_ID valueFrom: secretKeyRef: name: amp-security-pipeline-secrets key: AWS_ACCESS_KEY_ID - name: AWS_SECRET_ACCESS_KEY valueFrom: secretKeyRef: name: amp-security-pipeline-secrets key: AWS_SECRET_ACCESS_KEY - name: MINIO_ROOT_USER valueFrom: secretKeyRef: name: amp-security-pipeline-secrets key: MINIO_ROOT_USER - name: MINIO_ROOT_PASSWORD valueFrom: secretKeyRef: name: amp-security-pipeline-secrets key: MINIO_ROOT_PASSWORD - name: REPORTS_BUCKET value: {{ .Values.storage.reportsBucket | quote }} - name: REPO_NAME value: {{ .Values.pipeline.repoName | quote }} - name: STORAGE_ENDPOINT value: {{ .Values.storage.endpoint | quote }} command: - sh - -c args: - | set -eu commit_sha="${GIT_COMMIT_SHA:-unknown}" report_date="$(date -u +%F)" sync_target="s3://${REPORTS_BUCKET}/${REPO_NAME}/${report_date}/${commit_sha}/" if [ -n "${STORAGE_ENDPOINT}" ]; then aws --endpoint-url "${STORAGE_ENDPOINT}" s3 sync /workspace/reports "${sync_target}" else aws s3 sync /workspace/reports "${sync_target}" fi volumeMounts: - name: workspace mountPath: /workspace {{- end }}