Skip to content

Commit

Permalink
Add v1alpha2 yaml tests 🐺
Browse files Browse the repository at this point in the history
- move current examples in `examples/v1alpha1`
- copy and migrate those examples for `v1alpha1` (in `examples/v1alpha2`)

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
  • Loading branch information
vdemeester authored and tekton-robot committed Mar 2, 2020
1 parent bf29333 commit cfc961c
Show file tree
Hide file tree
Showing 112 changed files with 3,050 additions and 18 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions examples/v1alpha2/pipelineruns/clustertask-pipelinerun.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: tekton.dev/v1alpha2
kind: ClusterTask
metadata:
name: cluster-task-pipeline-4
spec:
steps:
- name: task-two-step-one
image: ubuntu
command: ["/bin/bash"]
args: ['-c', 'echo success']
---
apiVersion: tekton.dev/v1alpha2
kind: Pipeline
metadata:
name: sample-pipeline-cluster-task-4
spec:
tasks:
- name: cluster-task-pipeline-4
taskRef:
name: cluster-task-pipeline-4
kind: ClusterTask
---
apiVersion: tekton.dev/v1alpha2
kind: PipelineRun
metadata:
name: demo-pipeline-run-4
spec:
pipelineRef:
name: sample-pipeline-cluster-task-4
serviceAccountName: 'default'
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
apiVersion: tekton.dev/v1alpha1
kind: Condition
metadata:
name: verify-no-file-exists-without-resource
spec:
params:
- name: "path"
resources:
- name: optional-workspace
type: git
optional: true
check:
image: alpine
script: 'test ! -f $(resources.optional-workspace.path)/$(params.path)'
---
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: pipeline-git-repo
spec:
type: git
params:
- name: revision
value: master
- name: url
value: https://github.com/tektoncd/pipeline
---
apiVersion: tekton.dev/v1alpha2
kind: Task
metadata:
name: list-pipeline-repo-files
spec:
resources:
inputs:
- name: optional-workspace
type: git
optional: true
steps:
- name: run-ls
image: ubuntu
script: 'ls -al $(inputs.resources.optional-workspace.path)'
---
apiVersion: tekton.dev/v1alpha2
kind: Pipeline
metadata:
name: pipeline-list-pipeline-repo-files
spec:
resources:
- name: pipeline-source-repo
type: git
params:
- name: "path"
default: "README.md"
tasks:
- name: list-pipeline-repo-files-1
taskRef:
name: list-pipeline-repo-files
conditions:
- conditionRef: "verify-no-file-exists-without-resource"
params:
- name: "path"
value: "$(params.path)"
# NOTE: Resource "optional-workspace" is declared as optional in Condition
# No resource specified for the condition here since its optional
# "DO NOT UNCOMMENT THE FOLLOWING RESOURCE"
# resources:
# - name: optional-workspace
# resource: pipeline-source-repo
resources:
inputs:
- name: optional-workspace
resource: pipeline-source-repo
---
apiVersion: tekton.dev/v1alpha2
kind: PipelineRun
metadata:
name: demo-condtional-pr-without-condition-resource
spec:
pipelineRef:
name: pipeline-list-pipeline-repo-files
serviceAccountName: 'default'
resources:
- name: pipeline-source-repo
resourceRef:
name: pipeline-git-repo
94 changes: 94 additions & 0 deletions examples/v1alpha2/pipelineruns/conditional-pipelinerun.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: tekton.dev/v1alpha1
kind: Condition
metadata:
name: file-exists
spec:
params:
- name: "path"
resources:
- name: workspace
type: git
check:
image: alpine
script: 'test -f $(resources.workspace.path)/$(params.path)'
---
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: pipeline-git
spec:
type: git
params:
- name: revision
value: master
- name: url
value: https://github.com/tektoncd/pipeline
---
apiVersion: tekton.dev/v1alpha2
kind: Task
metadata:
name: create-readme-file
spec:
resources:
outputs:
- name: workspace
type: git
steps:
- name: write-new-stuff
image: ubuntu
script: 'touch $(resources.outputs.workspace.path)/README.md'
---
apiVersion: tekton.dev/v1alpha2
kind: Task
metadata:
name: echo-hello
spec:
steps:
- name: echo
image: ubuntu
script: 'echo hello'
---
apiVersion: tekton.dev/v1alpha2
kind: Pipeline
metadata:
name: conditional-pipeline
spec:
resources:
- name: source-repo
type: git
params:
- name: "path"
default: "README.md"
tasks:
- name: first-create-file
taskRef:
name: create-readme-file
resources:
outputs:
- name: workspace
resource: source-repo
- name: then-check
conditions:
- conditionRef: "file-exists"
params:
- name: "path"
value: "$(params.path)"
resources:
- name: workspace
resource: source-repo
from: [first-create-file]
taskRef:
name: echo-hello
---
apiVersion: tekton.dev/v1alpha2
kind: PipelineRun
metadata:
name: condtional-pr
spec:
pipelineRef:
name: conditional-pipeline
serviceAccountName: 'default'
resources:
- name: source-repo
resourceRef:
name: pipeline-git
127 changes: 127 additions & 0 deletions examples/v1alpha2/pipelineruns/demo-optional-resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
apiVersion: tekton.dev/v1alpha1
kind: Condition
metadata:
name: check-git-pipeline-resource
spec:
params:
- name: "path"
resources:
- name: git-repo
type: git
optional: true
check:
image: alpine
script: 'test -f $(resources.git-repo.path)/$(params.path)'
---

apiVersion: tekton.dev/v1alpha1
kind: Condition
metadata:
name: check-image-pipeline-resource
spec:
resources:
- name: built-image
type: image
optional: true
check:
image: alpine
script: 'test ! -z $(resources.built-image.url)'
---

apiVersion: tekton.dev/v1alpha2
kind: Task
metadata:
name: build-an-image
spec:
params:
- name: DOCKERFILE
description: The path to the dockerfile to build from GitHub Repo
default: "Dockerfile"
resources:
inputs:
- name: git-repo
type: git
optional: true
outputs:
- name: built-image
type: image
optional: true
steps:
- name: build-an-image
image: "gcr.io/kaniko-project/executor:latest"
command:
- /kaniko/executor
args:
- --dockerfile=$(params.DOCKERFILE)
- --destination=$(resources.outputs.built-image.url)
---

apiVersion: tekton.dev/v1alpha2
kind: Pipeline
metadata:
name: demo-pipeline-to-build-an-image
spec:
resources:
- name: source-repo
type: git
optional: true
- name: web-image
type: image
optional: true
params:
- name: "path"
default: "README.md"
tasks:
- name: build-an-image
taskRef:
name: build-an-image
conditions:
- conditionRef: "check-git-pipeline-resource"
params:
- name: "path"
value: "$(params.path)"
resources:
- name: git-repo
resource: source-repo
- conditionRef: "check-image-pipeline-resource"
resources:
- name: built-image
resource: web-image
resources:
inputs:
- name: git-repo
resource: source-repo
outputs:
- name: built-image
resource: web-image

---

apiVersion: tekton.dev/v1alpha2
kind: PipelineRun
metadata:
name: demo-pipeline-to-build-an-image-without-resources
spec:
pipelineRef:
name: demo-pipeline-to-build-an-image
serviceAccountName: 'default'
---

apiVersion: tekton.dev/v1alpha2
kind: PipelineRun
metadata:
name: demo-pipeline-to-build-an-image-without-image-resource
spec:
pipelineRef:
name: demo-pipeline-to-build-an-image
serviceAccountName: 'default'
resources:
- name: source-repo
resourceSpec:
type: git
params:
- name: revision
value: master
- name: url
value: https://github.com/tektoncd/pipeline
---
Empty file.
57 changes: 57 additions & 0 deletions examples/v1alpha2/pipelineruns/no-ci/limitrange.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apiVersion: v1
kind: LimitRange
metadata:
name: limit-mem-cpu-per-container
spec:
limits:
- max:
cpu: "800m"
memory: "1Gi"
min:
cpu: "100m"
memory: "99Mi"
default:
cpu: "700m"
memory: "900Mi"
defaultRequest:
cpu: "110m"
memory: "111Mi"
type: Container
---
apiVersion: tekton.dev/v1alpha2
kind: Task
metadata:
name: echo-hello-world
spec:
steps:
- name: echo
image: ubuntu
command:
- echo
args:
- "hello world"
---
apiVersion: tekton.dev/v1alpha2
kind: Pipeline
metadata:
name: pipeline-hello
spec:
tasks:
- name: hello-world-1
taskRef:
name: echo-hello-world
- name: hello-world-2
taskRef:
name: echo-hello-world
runAfter:
- hello-world-1
---
apiVersion: tekton.dev/v1alpha2
kind: PipelineRun
metadata:
generateName: pipeline-hello-run-
spec:
pipelineRef:
name: pipeline-hello
limitRangeName: "limit-mem-cpu-per-container"
status: {}
Loading

0 comments on commit cfc961c

Please sign in to comment.