1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-25 06:17:50 +00:00
catalog/task/gcs-upload/0.1/gcs-upload.yaml
vinamra28 32f2913fd2 Fix Catlin error by adding Digest to the Images
- Previously catalog's task has some images that are not
  tagged properly,this patch fixes these images by adding
  the digest
- Soon once Catlin is added to the CI it will throw error
  for those images which don't have proper tags

co-authored by:- @PuneetPunamiya

Signed-off-by: vinamra28 <vinjain@redhat.com>
2020-10-26 09:03:20 +00:00

57 lines
1.9 KiB
YAML

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: gcs-upload
labels:
app.kubernetes.io/version: "0.1"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: cloud, gcs
tekton.dev/displayName: "Upload to GCS"
spec:
description: >-
A Task that uploads a GCS bucket.
This task uploads files or directories from a Workspace to a GCS bucket.
workspaces:
- name: credentials
description: A secret with a service account key to use as GOOGLE_APPLICATION_CREDENTIALS.
- name: source
description: A workspace where files will be uploaded from.
params:
- name: path
description: The path to files or directories relative to the source workspace that you'd like to upload.
type: string
- name: location
description: The address (including "gs://") where you'd like to upload files to.
type: string
- name: serviceAccountPath
description: The path inside the credentials workspace to the GOOGLE_APPLICATION_CREDENTIALS key file.
type: string
default: service_account.json
steps:
- name: upload
image: gcr.io/google.com/cloudsdktool/cloud-sdk:310.0.0@sha256:cb03669fcdb9191d55a6200f2911fff3baec0b8c39b156d95b68aabe975ac506 #tag: 310.0.0
script: |
#!/usr/bin/env bash
set -xe
CRED_PATH="$(workspaces.credentials.path)/$(params.serviceAccountPath)"
SOURCE="$(workspaces.source.path)/$(params.path)"
if [[ -f "$CRED_PATH" ]]; then
GOOGLE_APPLICATION_CREDENTIALS="$CRED_PATH"
fi
if [[ "${GOOGLE_APPLICATION_CREDENTIALS}" != "" ]]; then
echo GOOGLE_APPLICATION_CREDENTIALS is set, activating Service Account...
gcloud auth activate-service-account --key-file=${GOOGLE_APPLICATION_CREDENTIALS}
fi
if [[ -d "$SOURCE" ]]; then
gsutil -m rsync -d -r "$SOURCE" "$(params.location)"
else
gsutil cp "$SOURCE" "$(params.location)"
fi