Last active
April 1, 2020 17:56
-
-
Save pritidesai/db4a41a4937d5bf7057586266affe21e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### With Nested Pipeline and Pipeline Level except/finally | |
# test pipeline | |
apiVersion: tekton.dev/v1alpha1 | |
kind: Pipeline | |
metadata: | |
name: test-pipeline | |
spec: | |
tasks: | |
- name: unit-tests | |
taskRef: | |
Name: uts | |
- name: integration | |
taskRef: | |
Name: integration-tests | |
finally: | |
- name: cleanup-integration-test | |
taskRef: | |
Name: cleanup-integration-test | |
# deploy pipeline | |
apiVersion: tekton.dev/v1alpha1 | |
kind: Pipeline | |
metadata: | |
name: my-pipeline | |
spec: | |
tasks: | |
- name: deploy-to-staging | |
taskRef: | |
Name: deploy-to-staging | |
finally: | |
- name: rollback-staging | |
taskRef: | |
Name: rollback-staging | |
# overall pipeline | |
apiVersion: tekton.dev/v1alpha1 | |
kind: Pipeline | |
metadata: | |
name: test-deploy-pipeline | |
spec: | |
tasks: | |
- name: test-pipeline | |
pipelineRef: | |
Name: test-pipeline | |
- name: deploy-pipeline | |
pipelineRef: | |
Name: deploy-pipeline | |
runAfter: ["test-pipeline"] | |
### PipelineTask Level except/finally | |
apiVersion: tekton.dev/v1alpha1 | |
kind: Pipeline | |
metadata: | |
name: test-deploy-pipeline | |
spec: | |
tasks: | |
- name: unit-tests | |
taskRef: | |
Name: uts | |
- name: integration | |
taskRef: | |
Name: integration-tests | |
finally: | |
- name: cleanup-integration-test | |
taskRef: | |
Name: cleanup-integration-test | |
- name: deploy-to-staging | |
taskRef: | |
Name: deploy-to-staging | |
except: | |
- name: rollback | |
taskRef: | |
Name: rollback | |
### Task Level except/finally | |
apiVersion: tekton.dev/v1beta1 | |
kind: Task | |
metadata: | |
name: integration-test-task | |
spec: | |
steps: | |
- name: integration-test | |
finally: | |
- name: cleanup-integration-test | |
--- | |
apiVersion: tekton.dev/v1beta1 | |
kind: Task | |
metadata: | |
name: deploy-task | |
spec: | |
steps: | |
- name: deploy-to-staging | |
except: | |
- name: rollback | |
--- | |
apiVersion: tekton.dev/v1alpha1 | |
kind: Pipeline | |
metadata: | |
name: test-deploy-pipeline | |
spec: | |
tasks: | |
- name: unit-tests | |
taskRef: | |
Name: uts | |
- name: integration | |
taskRef: | |
Name: integration-test-task | |
- name: deploy-to-staging | |
taskRef: | |
Name: deploy-task | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment