Слияние кода завершено, страница обновится автоматически
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
generateName: guarded-pr-
spec:
taskRunTemplate:
serviceAccountName: 'default'
pipelineSpec:
params:
- name: path
type: string
description: The path of the file to be created
- name: branches
type: array
description: The list of branch names
workspaces:
- name: source
description: |
This workspace is shared among all the pipeline tasks to read/write common resources
tasks:
- name: create-file # when expression using parameter, evaluates to true
when:
- input: "$(params.path)"
operator: in
values: ["README.md"]
workspaces:
- name: source
workspace: source
taskSpec:
workspaces:
- name: source
description: The workspace to create the readme file in
steps:
- name: write-new-stuff
image: mirror.gcr.io/ubuntu
script: 'touch $(workspaces.source.path)/README.md'
- name: check-file
params:
- name: path
value: "$(params.path)"
workspaces:
- name: source
workspace: source
runAfter:
- create-file
taskSpec:
params:
- name: path
workspaces:
- name: source
description: The workspace to check for the file
results:
- name: exists
description: indicates whether the file exists or is missing
steps:
- name: check-file
image: mirror.gcr.io/alpine
script: |
if test -f $(workspaces.source.path)/$(params.path); then
printf yes | tee $(results.exists.path)
else
printf no | tee $(results.exists.path)
fi
- name: echo-file-exists # when expression using task result, evaluates to true
when:
- input: "$(tasks.check-file.results.exists)"
operator: in
values: ["yes"]
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/ubuntu
script: 'echo file exists'
- name: sample-task-with-array-values
when:
- input: "main"
operator: in
values: ["$(params.branches[*])"]
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/alpine
script: 'echo hello'
- name: task-should-be-skipped-1
when:
- input: "$(tasks.check-file.results.exists)" # when expression using task result, evaluates to false
operator: in
values: ["missing"]
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/ubuntu
script: exit 1
- name: task-should-be-skipped-2 # when expression using parameter, evaluates to false
when:
- input: "$(params.path)"
operator: notin
values: ["README.md"]
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/ubuntu
script: exit 1
- name: task-should-be-skipped-3 # task with when expression and run after
runAfter:
- echo-file-exists
when:
- input: "monday"
operator: in
values: ["friday"]
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/ubuntu
script: exit 1
- name: task-should-be-skipped-4 # task with when expression using array parameter, evaluates to false
when:
- input: "master"
operator: in
values: ["$(params.branches[*])"]
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/alpine
script: exit 1
finally:
- name: finally-task-should-be-skipped-1 # when expression using execution status, evaluates to false
when:
- input: "$(tasks.echo-file-exists.status)"
operator: in
values: ["Failure"]
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/ubuntu
script: exit 1
- name: finally-task-should-be-skipped-2 # when expression using task result, evaluates to false
when:
- input: "$(tasks.check-file.results.exists)"
operator: in
values: ["missing"]
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/ubuntu
script: exit 1
- name: finally-task-should-be-skipped-3 # when expression using parameter, evaluates to false
when:
- input: "$(params.path)"
operator: notin
values: ["README.md"]
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/ubuntu
script: exit 1
- name: finally-task-should-be-skipped-4 # when expression using tasks execution status, evaluates to false
when:
- input: "$(tasks.status)"
operator: in
values: ["Failure"]
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/ubuntu
script: exit 1
- name: finally-task-should-be-skipped-5 # when expression using tasks execution status, evaluates to false
when:
- input: "$(tasks.status)"
operator: in
values: ["Succeeded"]
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/ubuntu
script: exit 1
- name: finally-task-should-be-executed # when expression using execution status, tasks execution status, param, and results
when:
- input: "$(tasks.echo-file-exists.status)"
operator: in
values: ["Succeeded"]
- input: "$(tasks.status)"
operator: in
values: ["Completed"]
- input: "$(tasks.check-file.results.exists)"
operator: in
values: ["yes"]
- input: "$(params.path)"
operator: in
values: ["README.md"]
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/ubuntu
script: 'echo finally done'
params:
- name: path
value: README.md
- name: branches
value:
- main
- hotfix
workspaces:
- name: source
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 16Mi
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )