Last active
February 28, 2022 12:53
-
-
Save pritidesai/238ef0e8ed935e82d2bb716ef9e91db8 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
# unit-test | |
# | | |
# integration-test | |
# / \ | |
# cleanup deploy | |
# | | |
# rollback | |
# 1. test-pipeline: | |
# unit-test | |
# | | |
# integration-test | |
# |finally | |
# cleanup | |
apiVersion: tekton.dev/v1beta1 | |
kind: Pipeline | |
metadata: | |
name: test-pipeline | |
spec: | |
tasks: | |
- name: unit-test | |
taskRef: | |
Name: unit-test | |
- name: integration-tests | |
taskRef: | |
Name: integration-tests | |
runAfter: unit-test | |
finally: | |
- name: cleanup | |
taskRef: | |
Name: cleanup | |
--- | |
# 2. deploy-pipeline: | |
# deploy | |
# |onFailure/except | |
# rollback | |
# Pipeline Level Except (thanks Christie for clarifying 🙏) | |
# Pros: (1) fits perfect with programming paradigm of try and except | |
# (2) works with task level mappings (params and workspace), unlike conditions e.g. https://gist.github.com/pritidesai/d016fd7fa32709970f8c78ecf64e484e | |
# Cons: (2) failure from any task under `tasks` trigger `except` 🤔 | |
apiVersion: tekton.dev/v1beta1 | |
kind: Pipeline | |
metadata: | |
name: deploy-pipeline | |
spec: | |
tasks: | |
- name: deploy | |
taskRef: | |
Name: deploy | |
except: | |
- name: rollback | |
taskRef: | |
Name: rollback | |
--- | |
OR | |
# Task level except | |
# Pros: fits perfect with programming paradigm of try and except | |
# Cons: (1) params and workspace mapping in `PipelineRun` | |
# (2) maintainance nightmare, patch/enhance `except` just like conditions 🤔 | |
apiVersion: tekton.dev/v1beta1 | |
kind: Pipeline | |
metadata: | |
name: deploy-pipeline | |
spec: | |
tasks: | |
- name: deploy | |
taskRef: | |
Name: deploy | |
except: # OR except Failure: OR exceptFailure: (???) | |
- name: rollback # - exceptRef just like conditionRef (???) | |
taskRef: | |
Name: rollback | |
--- | |
# Pros: (1) Minimal changes to existing spec | |
# (2) task and pipeline both supported with nested pipeline | |
# Cons: ??? | |
OR | |
apiVersion: tekton.dev/v1beta1 | |
kind: Pipeline | |
metadata: | |
name: deploy-pipeline | |
spec: | |
tasks: | |
- name: deploy | |
taskRef: | |
Name: deploy | |
- name: rollback | |
taskRef: | |
Name: rollback | |
runOnFailure: deploy | |
--- | |
# 3. entire-pipeline with sub-pipelines: | |
# test-pipeline | |
# | | |
# deploy-pipeline | |
apiVersion: tekton.dev/v1beta1 | |
kind: Pipeline | |
metadata: | |
name: deploy-pipeline | |
spec: | |
tasks: | |
- name: test | |
pipelineRef: | |
Name: test-pipeline | |
- name: deploy | |
pipelineRef: | |
Name: deploy-pipeline | |
runAfter: test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment