1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-21 05:55:35 +00:00
catalog/task/gcs-delete-bucket/0.1/gcs-delete-bucket.yaml
Yulia Gaponenko f4708d478e Add linux/amd64 platform annotation to the rest of the tasks
At this moment all tasks which can be executed on linux/s390x or
linux/ppc64le are tested and labelled accordingly.
The rest of the tasks can be labelled as `linux/amd64`, which
is default platform and where tasks are already tested via
default PR testing cycle.

Signed-off-by: Yulia Gaponenko <yulia.gaponenko1@de.ibm.com>
2021-10-29 17:08:38 +01:00

48 lines
1.5 KiB
YAML

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: gcs-delete-bucket
labels:
app.kubernetes.io/version: "0.1"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/categories: Cloud, Storage
tekton.dev/tags: cloud, gcs
tekton.dev/platforms: "linux/amd64"
spec:
description: >-
A Task that deletes a GCS bucket.
workspaces:
- name: credentials
description: A secret with a service account key to use as GOOGLE_APPLICATION_CREDENTIALS.
params:
- name: bucketName
description: |
The name (including "gs://") of the bucket to delete.
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: delete-bucket
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)"
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
gsutil rm -r "$(params.bucketName)"