mirror of
https://github.com/tektoncd/catalog.git
synced 2024-11-26 06:23:37 +00:00
1b97361c31
Changes include: - moves the gcs-generic task to the task directory - moves and modifies readme file for gcs-generic from gcs directory - moves sample directory from gcs directory Issue: #386 Signed-off-by: Puneet Punamiya <ppunamiy@redhat.com>
55 lines
1.6 KiB
YAML
55 lines
1.6 KiB
YAML
apiVersion: tekton.dev/v1beta1
|
|
kind: Task
|
|
metadata:
|
|
name: gcs-generic
|
|
labels:
|
|
app.kubernetes.io/version: "0.1"
|
|
annotations:
|
|
tekton.dev/pipelines.minVersion: "0.12.1"
|
|
tekton.dev/tags: cloud, gcs
|
|
spec:
|
|
description: >-
|
|
A Task that allows users to customize and extend the gsutil
|
|
command line based on their needs.
|
|
|
|
workspaces:
|
|
- name: credentials
|
|
description: A secret with a service account key to use as GOOGLE_APPLICATION_CREDENTIALS.
|
|
params:
|
|
- name: command
|
|
description: The command line that you would like to enter.
|
|
type: string
|
|
- name: options
|
|
description: The extended command line that you would like to enter.
|
|
type: array
|
|
- name: serviceAccountPath
|
|
description: |
|
|
The path inside the credentials workspace to the GOOGLE_APPLICATION_CREDENTIALS key file.
|
|
type: string
|
|
default: service_account.json
|
|
- name: image
|
|
description: google cloud image that will be used in steps.
|
|
type: string
|
|
default: google/cloud-sdk
|
|
steps:
|
|
- name: credential-setup
|
|
image: "$(params.image)"
|
|
script: |
|
|
#!/usr/bin/env bash
|
|
set -xe
|
|
|
|
CRED_PATH="$(workspaces.credentials.path)/$(params.serviceAccountPath)"
|
|
|
|
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
|
|
- name: run-gsutil
|
|
image: "$(params.image)"
|
|
command: [gsutil]
|
|
args: ["$(params.command)", "$(params.options[*])"]
|