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

Added Multiple pipeline templates in code completion #611

Merged
merged 4 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
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
15 changes: 15 additions & 0 deletions build/build-snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ const snippets: { [key: string]: Snippet } = {
description: 'Create a Tekton Pipeline Resource',
body: load('pipeline.yaml'),
},
'Pipeline-finally': {
prefix: 'Pipeline-with-finally',
description: 'Create a Tekton Pipeline Resource with finally in spec',
body: load('pipeline-finally.yaml'),
},
'Pipeline-with-multiple-task': {
prefix: 'Pipeline-with-multiple-task',
description: 'Create a Tekton Pipeline Resource with at least three task in spec',
body: load('pipeline-with-multiple-task.yaml'),
},
'Pipeline-condition': {
prefix: 'Pipeline-with-condition',
description: 'Create a Tekton Pipeline Resource with condition in spec',
body: load('pipeline-condition.yaml'),
},
'PipelineRun': {
prefix: 'PipelineRun',
description: 'Create a Tekton PipelineRun Resource',
Expand Down
60 changes: 60 additions & 0 deletions rawsnippets/Pipeline-with-multiple-task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: tekton.dev/v1beta1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pipeline template should be extended, you just referring to commands but template doesn't provide configuration for them.

kind: Pipeline
metadata:
name: ${1:app-deploy}
spec:
workspaces:
- name: ${2:maven-settings}
- name: ${3:my-source}
tasks:
- name: ${4:taskName}
taskRef:
name: ${5:maven}
params:
- name: ${6:CONTEXT_DIR}
value: ${7:"apps/greeter/java/quarkus"} #configure: may change according to your source
- name: ${8:GOALS}
value: ${9:["package"]}
workspaces:
- name: ${10:maven-settings}
workspace: ${11:maven-settings}
- name: ${12:taskName}
taskRef:
name: ${13:buildah}
params:
- name: ${14:IMAGE}
value: ${15:gcr.io/my-repo/my-image} #configure: may change according to your source
workspaces:
- name: ${16:source}
workspace: ${17:my-source}
- name: ${18:taskName}
taskRef:
name: ${19:kubectl-deploy-pod}
params:
- name: ${20:action}
value: ${21:create} #configure: may change according to your source
- name: ${22:success-condition}
value: ${23:status.phase == Running}
- name: ${24:failure-condition}
value: ${25:status.phase in (Failed, Error)}
- name: ${26:output}
value: |
- name: ${27:job-name}
valueFrom: ${28:'{.metadata.name}'}
- name: ${29:job-namespace}
valueFrom: ${30:'{.metadata.namespace}'}
- name: ${31:set-ownerreference}
value: ${32:"true"}
- name: ${33:manifest}
value: |
apiVersion: ${34:v1}
kind: ${35:Pod}
metadata:
generateName: ${36:myapp-pod-}
labels:
app: ${37:myapp}
spec:
containers:
- name: ${38:myapp-container}
image: ${39:docker}
command: ${40:['sh', '-c', 'echo Hello Kubernetes! && sleep 30']}
11 changes: 11 additions & 0 deletions rawsnippets/pipeline-condition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: ${1:app-deploy}
spec:
tasks:
- name: ${2:taskName}
taskRef:
name: ${3:taskRefName}
conditions:
- conditionRef: ${4:conditionRefName}
13 changes: 13 additions & 0 deletions rawsnippets/pipeline-finally.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: ${1:app-deploy}
spec:
tasks:
- name: ${2:taskName}
taskRef:
name: ${3:build-app}
finally:
- name: ${4:finallyName}
taskRef:
name: ${5:taskName}
102 changes: 102 additions & 0 deletions snippets/tekton.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,108 @@
" name: ${5:build-app}"
]
},
"Pipeline-finally": {
"prefix": "Pipeline-with-finally",
"description": "Create a Tekton Pipeline Resource with finally in spec",
"body": [
"apiVersion: tekton.dev/v1beta1",
"kind: Pipeline",
"metadata:",
" name: ${1:app-deploy}",
"spec:",
" tasks:",
" - name: ${2:taskName}",
" taskRef:",
" name: ${3:build-app}",
" finally:",
" - name: ${4:finallyName}",
" taskRef:",
" name: ${5:taskName}"
]
},
"Pipeline-with-multiple-task": {
"prefix": "Pipeline-with-multiple-task",
"description": "Create a Tekton Pipeline Resource with at least three task in spec",
"body": [
"apiVersion: tekton.dev/v1beta1",
"kind: Pipeline",
"metadata:",
" name: ${1:app-deploy}",
"spec:",
" workspaces:",
" - name: ${2:maven-settings}",
" - name: ${3:my-source}",
" tasks:",
" - name: ${4:taskName}",
" taskRef:",
" name: ${5:maven}",
" params:",
" - name: ${6:CONTEXT_DIR}",
" value: ${7:\"apps/greeter/java/quarkus\"} #configure: may change according to your source",
" - name: ${8:GOALS}",
" value: ${9:[\"package\"]}",
" workspaces:",
" - name: ${10:maven-settings}",
" workspace: ${11:maven-settings}",
" - name: ${12:taskName}",
" taskRef:",
" name: ${13:buildah}",
" params:",
" - name: ${14:IMAGE}",
" value: ${15:gcr.io/my-repo/my-image} #configure: may change according to your source",
" workspaces:",
" - name: ${16:source}",
" workspace: ${17:my-source}",
" - name: ${18:taskName}",
" taskRef:",
" name: ${19:kubectl-deploy-pod}",
" params:",
" - name: ${20:action}",
" value: ${21:create} #configure: may change according to your source",
" - name: ${22:success-condition}",
" value: ${23:status.phase == Running}",
" - name: ${24:failure-condition}",
" value: ${25:status.phase in (Failed, Error)}",
" - name: ${26:output}",
" value: |",
" - name: ${27:job-name}",
" valueFrom: ${28:'{.metadata.name}'}",
" - name: ${29:job-namespace}",
" valueFrom: ${30:'{.metadata.namespace}'}",
" - name: ${31:set-ownerreference}",
" value: ${32:\"true\"}",
" - name: ${33:manifest}",
" value: |",
" apiVersion: ${34:v1}",
" kind: ${35:Pod}",
" metadata:",
" generateName: ${36:myapp-pod-}",
" labels:",
" app: ${37:myapp}",
" spec:",
" containers:",
" - name: ${38:myapp-container}",
" image: ${39:docker}",
" command: ${40:['sh', '-c', 'echo Hello Kubernetes! && sleep 30']}"
]
},
"Pipeline-condition": {
"prefix": "Pipeline-with-condition",
"description": "Create a Tekton Pipeline Resource with condition in spec",
"body": [
"apiVersion: tekton.dev/v1beta1",
"kind: Pipeline",
"metadata:",
" name: ${1:app-deploy}",
"spec:",
" tasks:",
" - name: ${2:taskName}",
" taskRef:",
" name: ${3:taskRefName}",
" conditions:",
" - conditionRef: ${4:conditionRefName}"
]
},
"PipelineRun": {
"prefix": "PipelineRun",
"description": "Create a Tekton PipelineRun Resource",
Expand Down