Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test GCS Tasks #262

Merged
merged 1 commit into from Apr 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions gcs/sample/gcs-sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
apiVersion: triggers.tekton.dev/v1alpha1
kind: TriggerTemplate
metadata:
name: gcs-triggertemplate
spec:
params:
- name: pvc-name
- name: project-name
- name: secret-name
resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: gcs-pr-$(uid)
spec:
workspaces:
- name: data
persistentVolumeClaim:
claimName: $(params.pvc-name)
- name: credentials
secret:
secretName: $(params.secret-name)
pipelineSpec:
workspaces:
- name: data
- name: credentials
tasks:
- name: gcs-create-bucket
taskRef:
name: gcs-create-bucket
workspaces:
- name: credentials
workspace: credentials
params:
- name: bucketName
value: gs://tekton-test-bucket-$(uid)
- name: project
value: $(params.project-name)
- name: create-data
runAfter: [gcs-create-bucket]
taskSpec:
workspaces:
- name: data
steps:
- name: write-data
image: ubuntu
script: |
#!/usr/bin/env bash
set -xe
mkdir -p $(workspaces.data.path)/$(uid)/test_data/
echo "Test data $(uid)" > $(workspaces.data.path)/$(uid)/test_data/test.txt
workspaces:
- name: data
workspace: data
- name: gcs-upload
taskRef:
name: gcs-upload
runAfter: [create-data]
workspaces:
- name: credentials
workspace: credentials
- name: source
workspace: data
params:
- name: path
value: $(uid)
- name: location
value: gs://tekton-test-bucket-$(uid)
- name: serviceAccountPath
value: service_account.json
- name: gcs-download
taskRef:
name: gcs-download
runAfter: [gcs-upload]
workspaces:
- name: credentials
workspace: credentials
- name: output
workspace: data
params:
- name: path
value: download-$(uid)
- name: location
value: gs://tekton-test-bucket-$(uid)
- name: typeDir
value: "true"
- name: serviceAccountPath
value: service_account.json
- name: verify-data
runAfter: [gcs-download]
workspaces:
- name: data
workspace: data
taskSpec:
workspaces:
- name: data
steps:
- image: ubuntu
script: |
#!/usr/bin/env bash
set -xe
cat $(workspaces.data.path)/download-$(uid)/test_data/test.txt | grep "Test data $(uid)"
- name: delete-bucket
taskRef:
name: gcs-delete-bucket
runAfter: [gcs-download]
workspaces:
- name: credentials
workspace: credentials
params:
- name: bucketName
value: gs://tekton-test-bucket-$(uid)
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gcs-test-storage
spec:
resources:
requests:
storage: 16Mi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce