From 1a660802f435aca9fea2691b42b98f74d11a26e8 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Fri, 14 Feb 2020 12:22:21 +0100 Subject: [PATCH] =?UTF-8?q?Add=20v1alpha2=20yaml=20tests=20=F0=9F=90=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - move current examples in `examples/v1alpha1` - copy and migrate those examples forĀ `v1alpha1` (in `examples/v1alpha2`) Signed-off-by: Vincent Demeester --- .../pipelineruns/clustertask-pipelinerun.yaml | 0 ...l-pipelinerun-with-optional-resources.yaml | 0 .../pipelineruns/conditional-pipelinerun.yaml | 0 .../pipelineruns/demo-optional-resources.yaml | 0 .../{ => v1alpha1}/pipelineruns/no-ci/.keep | 0 .../pipelineruns/no-ci/limitrange.yaml | 0 .../pipelineruns/no-ci/pipeline-timeout.yaml | 0 .../pipelineruns/output-pipelinerun.yaml | 0 ...inerun-with-pipelinespec-and-taskspec.yaml | 0 .../pipelinerun-with-pipelinespec.yaml | 0 .../pipelinerun-with-resourcespec.yaml | 0 .../pipelineruns/pipelinerun.yaml | 0 .../pipelineruns/workspaces.yaml | 0 .../taskruns/build-gcs-targz.yaml | 0 .../taskruns/build-gcs-zip.yaml | 0 .../taskruns/build-push-kaniko.yaml | 0 .../{ => v1alpha1}/taskruns/cloud-event.yaml | 0 .../{ => v1alpha1}/taskruns/clustertask.yaml | 0 .../{ => v1alpha1}/taskruns/configmap.yaml | 0 .../{ => v1alpha1}/taskruns/custom-env.yaml | 0 .../taskruns/custom-volume.yaml | 0 .../{ => v1alpha1}/taskruns/dind-sidecar.yaml | 0 .../{ => v1alpha1}/taskruns/docker-creds.yaml | 0 .../{ => v1alpha1}/taskruns/gcs-resource.yaml | 0 .../{ => v1alpha1}/taskruns/git-resource.yaml | 0 .../taskruns/git-ssh-creds.yaml | 0 .../{ => v1alpha1}/taskruns/git-volume.yaml | 0 .../{ => v1alpha1}/taskruns/home-is-set.yaml | 0 .../{ => v1alpha1}/taskruns/home-volume.yaml | 0 examples/{ => v1alpha1}/taskruns/no-ci/.keep | 0 .../taskruns/no-ci/limitrange.yaml | 0 .../optional-resources-with-clustertask.yaml | 0 .../taskruns/optional-resources.yaml | 0 .../taskruns/pull-private-image.yaml | 0 .../{ => v1alpha1}/taskruns/pullrequest.yaml | 0 .../{ => v1alpha1}/taskruns/secret-env.yaml | 0 .../taskruns/secret-volume-params.yaml | 0 .../taskruns/secret-volume.yaml | 0 .../taskruns/sidecar-interp.yaml | 0 .../taskruns/sidecar-ready-script.yaml | 0 .../taskruns/sidecar-ready.yaml | 0 .../taskruns/step-by-digest.yaml | 0 .../{ => v1alpha1}/taskruns/step-script.yaml | 0 .../taskruns/steps-run-in-order.yaml | 0 .../taskruns/steptemplate-env-merge.yaml | 0 .../taskruns/task-multiple-output-image.yaml | 0 .../taskruns/task-output-image.yaml | 0 .../{ => v1alpha1}/taskruns/task-result.yaml | 0 .../taskruns/task-volume-args.yaml | 0 .../taskruns/template-volume.yaml | 0 .../taskruns/unnamed-steps.yaml | 0 .../{ => v1alpha1}/taskruns/workingdir.yaml | 0 .../taskruns/workspace-readonly.yaml | 0 .../taskruns/workspace-volume.yaml | 0 .../{ => v1alpha1}/taskruns/workspace.yaml | 0 .../pipelineruns/clustertask-pipelinerun.yaml | 30 ++ ...l-pipelinerun-with-optional-resources.yaml | 85 ++++++ .../pipelineruns/conditional-pipelinerun.yaml | 94 +++++++ .../pipelineruns/demo-optional-resources.yaml | 127 +++++++++ examples/v1alpha2/pipelineruns/no-ci/.keep | 0 .../pipelineruns/no-ci/limitrange.yaml | 57 ++++ .../pipelineruns/no-ci/pipeline-timeout.yaml | 55 ++++ .../pipelineruns/output-pipelinerun.yaml | 104 +++++++ ...inerun-with-pipelinespec-and-taskspec.yaml | 79 ++++++ .../pipelinerun-with-pipelinespec.yaml | 53 ++++ .../pipelinerun-with-resourcespec.yaml | 97 +++++++ .../v1alpha2/pipelineruns/pipelinerun.yaml | 258 ++++++++++++++++++ .../v1alpha2/pipelineruns/workspaces.yaml | 135 +++++++++ .../v1alpha2/taskruns/build-gcs-targz.yaml | 25 ++ examples/v1alpha2/taskruns/build-gcs-zip.yaml | 25 ++ .../v1alpha2/taskruns/build-push-kaniko.yaml | 81 ++++++ examples/v1alpha2/taskruns/cloud-event.yaml | 182 ++++++++++++ examples/v1alpha2/taskruns/clustertask.yaml | 17 ++ examples/v1alpha2/taskruns/configmap.yaml | 32 +++ examples/v1alpha2/taskruns/custom-env.yaml | 14 + examples/v1alpha2/taskruns/custom-volume.yaml | 26 ++ examples/v1alpha2/taskruns/dind-sidecar.yaml | 61 +++++ examples/v1alpha2/taskruns/docker-creds.yaml | 42 +++ examples/v1alpha2/taskruns/gcs-resource.yaml | 23 ++ examples/v1alpha2/taskruns/git-resource.yaml | 71 +++++ examples/v1alpha2/taskruns/git-ssh-creds.yaml | 50 ++++ examples/v1alpha2/taskruns/git-volume.yaml | 21 ++ examples/v1alpha2/taskruns/home-is-set.yaml | 11 + examples/v1alpha2/taskruns/home-volume.yaml | 26 ++ examples/v1alpha2/taskruns/no-ci/.keep | 0 .../v1alpha2/taskruns/no-ci/limitrange.yaml | 47 ++++ .../optional-resources-with-clustertask.yaml | 34 +++ .../v1alpha2/taskruns/optional-resources.yaml | 130 +++++++++ .../v1alpha2/taskruns/pull-private-image.yaml | 50 ++++ examples/v1alpha2/taskruns/pullrequest.yaml | 33 +++ examples/v1alpha2/taskruns/secret-env.yaml | 25 ++ .../taskruns/secret-volume-params.yaml | 33 +++ examples/v1alpha2/taskruns/secret-volume.yaml | 26 ++ .../v1alpha2/taskruns/sidecar-interp.yaml | 33 +++ .../taskruns/sidecar-ready-script.yaml | 28 ++ examples/v1alpha2/taskruns/sidecar-ready.yaml | 38 +++ .../v1alpha2/taskruns/step-by-digest.yaml | 11 + examples/v1alpha2/taskruns/step-script.yaml | 88 ++++++ .../v1alpha2/taskruns/steps-run-in-order.yaml | 12 + .../taskruns/steptemplate-env-merge.yaml | 65 +++++ .../taskruns/task-multiple-output-image.yaml | 118 ++++++++ .../v1alpha2/taskruns/task-output-image.yaml | 90 ++++++ examples/v1alpha2/taskruns/task-result.yaml | 24 ++ .../v1alpha2/taskruns/task-volume-args.yaml | 34 +++ .../v1alpha2/taskruns/template-volume.yaml | 27 ++ examples/v1alpha2/taskruns/unnamed-steps.yaml | 13 + examples/v1alpha2/taskruns/workingdir.yaml | 19 ++ .../v1alpha2/taskruns/workspace-readonly.yaml | 47 ++++ .../v1alpha2/taskruns/workspace-volume.yaml | 27 ++ examples/v1alpha2/taskruns/workspace.yaml | 93 +++++++ test/e2e-common.sh | 20 +- test/e2e-tests-yaml.sh | 23 +- 112 files changed, 3051 insertions(+), 18 deletions(-) rename examples/{ => v1alpha1}/pipelineruns/clustertask-pipelinerun.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/conditional-pipelinerun.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/demo-optional-resources.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/no-ci/.keep (100%) rename examples/{ => v1alpha1}/pipelineruns/no-ci/limitrange.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/no-ci/pipeline-timeout.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/output-pipelinerun.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/pipelinerun-with-pipelinespec.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/pipelinerun-with-resourcespec.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/pipelinerun.yaml (100%) rename examples/{ => v1alpha1}/pipelineruns/workspaces.yaml (100%) rename examples/{ => v1alpha1}/taskruns/build-gcs-targz.yaml (100%) rename examples/{ => v1alpha1}/taskruns/build-gcs-zip.yaml (100%) rename examples/{ => v1alpha1}/taskruns/build-push-kaniko.yaml (100%) rename examples/{ => v1alpha1}/taskruns/cloud-event.yaml (100%) rename examples/{ => v1alpha1}/taskruns/clustertask.yaml (100%) rename examples/{ => v1alpha1}/taskruns/configmap.yaml (100%) rename examples/{ => v1alpha1}/taskruns/custom-env.yaml (100%) rename examples/{ => v1alpha1}/taskruns/custom-volume.yaml (100%) rename examples/{ => v1alpha1}/taskruns/dind-sidecar.yaml (100%) rename examples/{ => v1alpha1}/taskruns/docker-creds.yaml (100%) rename examples/{ => v1alpha1}/taskruns/gcs-resource.yaml (100%) rename examples/{ => v1alpha1}/taskruns/git-resource.yaml (100%) rename examples/{ => v1alpha1}/taskruns/git-ssh-creds.yaml (100%) rename examples/{ => v1alpha1}/taskruns/git-volume.yaml (100%) rename examples/{ => v1alpha1}/taskruns/home-is-set.yaml (100%) rename examples/{ => v1alpha1}/taskruns/home-volume.yaml (100%) rename examples/{ => v1alpha1}/taskruns/no-ci/.keep (100%) rename examples/{ => v1alpha1}/taskruns/no-ci/limitrange.yaml (100%) rename examples/{ => v1alpha1}/taskruns/optional-resources-with-clustertask.yaml (100%) rename examples/{ => v1alpha1}/taskruns/optional-resources.yaml (100%) rename examples/{ => v1alpha1}/taskruns/pull-private-image.yaml (100%) rename examples/{ => v1alpha1}/taskruns/pullrequest.yaml (100%) rename examples/{ => v1alpha1}/taskruns/secret-env.yaml (100%) rename examples/{ => v1alpha1}/taskruns/secret-volume-params.yaml (100%) rename examples/{ => v1alpha1}/taskruns/secret-volume.yaml (100%) rename examples/{ => v1alpha1}/taskruns/sidecar-interp.yaml (100%) rename examples/{ => v1alpha1}/taskruns/sidecar-ready-script.yaml (100%) rename examples/{ => v1alpha1}/taskruns/sidecar-ready.yaml (100%) rename examples/{ => v1alpha1}/taskruns/step-by-digest.yaml (100%) rename examples/{ => v1alpha1}/taskruns/step-script.yaml (100%) rename examples/{ => v1alpha1}/taskruns/steps-run-in-order.yaml (100%) rename examples/{ => v1alpha1}/taskruns/steptemplate-env-merge.yaml (100%) rename examples/{ => v1alpha1}/taskruns/task-multiple-output-image.yaml (100%) rename examples/{ => v1alpha1}/taskruns/task-output-image.yaml (100%) rename examples/{ => v1alpha1}/taskruns/task-result.yaml (100%) rename examples/{ => v1alpha1}/taskruns/task-volume-args.yaml (100%) rename examples/{ => v1alpha1}/taskruns/template-volume.yaml (100%) rename examples/{ => v1alpha1}/taskruns/unnamed-steps.yaml (100%) rename examples/{ => v1alpha1}/taskruns/workingdir.yaml (100%) rename examples/{ => v1alpha1}/taskruns/workspace-readonly.yaml (100%) rename examples/{ => v1alpha1}/taskruns/workspace-volume.yaml (100%) rename examples/{ => v1alpha1}/taskruns/workspace.yaml (100%) create mode 100644 examples/v1alpha2/pipelineruns/clustertask-pipelinerun.yaml create mode 100644 examples/v1alpha2/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml create mode 100644 examples/v1alpha2/pipelineruns/conditional-pipelinerun.yaml create mode 100644 examples/v1alpha2/pipelineruns/demo-optional-resources.yaml create mode 100644 examples/v1alpha2/pipelineruns/no-ci/.keep create mode 100644 examples/v1alpha2/pipelineruns/no-ci/limitrange.yaml create mode 100644 examples/v1alpha2/pipelineruns/no-ci/pipeline-timeout.yaml create mode 100644 examples/v1alpha2/pipelineruns/output-pipelinerun.yaml create mode 100644 examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml create mode 100644 examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec.yaml create mode 100644 examples/v1alpha2/pipelineruns/pipelinerun-with-resourcespec.yaml create mode 100644 examples/v1alpha2/pipelineruns/pipelinerun.yaml create mode 100644 examples/v1alpha2/pipelineruns/workspaces.yaml create mode 100644 examples/v1alpha2/taskruns/build-gcs-targz.yaml create mode 100644 examples/v1alpha2/taskruns/build-gcs-zip.yaml create mode 100644 examples/v1alpha2/taskruns/build-push-kaniko.yaml create mode 100644 examples/v1alpha2/taskruns/cloud-event.yaml create mode 100644 examples/v1alpha2/taskruns/clustertask.yaml create mode 100644 examples/v1alpha2/taskruns/configmap.yaml create mode 100644 examples/v1alpha2/taskruns/custom-env.yaml create mode 100644 examples/v1alpha2/taskruns/custom-volume.yaml create mode 100644 examples/v1alpha2/taskruns/dind-sidecar.yaml create mode 100644 examples/v1alpha2/taskruns/docker-creds.yaml create mode 100644 examples/v1alpha2/taskruns/gcs-resource.yaml create mode 100644 examples/v1alpha2/taskruns/git-resource.yaml create mode 100644 examples/v1alpha2/taskruns/git-ssh-creds.yaml create mode 100644 examples/v1alpha2/taskruns/git-volume.yaml create mode 100644 examples/v1alpha2/taskruns/home-is-set.yaml create mode 100644 examples/v1alpha2/taskruns/home-volume.yaml create mode 100644 examples/v1alpha2/taskruns/no-ci/.keep create mode 100644 examples/v1alpha2/taskruns/no-ci/limitrange.yaml create mode 100644 examples/v1alpha2/taskruns/optional-resources-with-clustertask.yaml create mode 100644 examples/v1alpha2/taskruns/optional-resources.yaml create mode 100644 examples/v1alpha2/taskruns/pull-private-image.yaml create mode 100644 examples/v1alpha2/taskruns/pullrequest.yaml create mode 100644 examples/v1alpha2/taskruns/secret-env.yaml create mode 100644 examples/v1alpha2/taskruns/secret-volume-params.yaml create mode 100644 examples/v1alpha2/taskruns/secret-volume.yaml create mode 100644 examples/v1alpha2/taskruns/sidecar-interp.yaml create mode 100644 examples/v1alpha2/taskruns/sidecar-ready-script.yaml create mode 100644 examples/v1alpha2/taskruns/sidecar-ready.yaml create mode 100644 examples/v1alpha2/taskruns/step-by-digest.yaml create mode 100644 examples/v1alpha2/taskruns/step-script.yaml create mode 100644 examples/v1alpha2/taskruns/steps-run-in-order.yaml create mode 100644 examples/v1alpha2/taskruns/steptemplate-env-merge.yaml create mode 100644 examples/v1alpha2/taskruns/task-multiple-output-image.yaml create mode 100644 examples/v1alpha2/taskruns/task-output-image.yaml create mode 100644 examples/v1alpha2/taskruns/task-result.yaml create mode 100644 examples/v1alpha2/taskruns/task-volume-args.yaml create mode 100644 examples/v1alpha2/taskruns/template-volume.yaml create mode 100644 examples/v1alpha2/taskruns/unnamed-steps.yaml create mode 100644 examples/v1alpha2/taskruns/workingdir.yaml create mode 100644 examples/v1alpha2/taskruns/workspace-readonly.yaml create mode 100644 examples/v1alpha2/taskruns/workspace-volume.yaml create mode 100644 examples/v1alpha2/taskruns/workspace.yaml diff --git a/examples/pipelineruns/clustertask-pipelinerun.yaml b/examples/v1alpha1/pipelineruns/clustertask-pipelinerun.yaml similarity index 100% rename from examples/pipelineruns/clustertask-pipelinerun.yaml rename to examples/v1alpha1/pipelineruns/clustertask-pipelinerun.yaml diff --git a/examples/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml b/examples/v1alpha1/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml similarity index 100% rename from examples/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml rename to examples/v1alpha1/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml diff --git a/examples/pipelineruns/conditional-pipelinerun.yaml b/examples/v1alpha1/pipelineruns/conditional-pipelinerun.yaml similarity index 100% rename from examples/pipelineruns/conditional-pipelinerun.yaml rename to examples/v1alpha1/pipelineruns/conditional-pipelinerun.yaml diff --git a/examples/pipelineruns/demo-optional-resources.yaml b/examples/v1alpha1/pipelineruns/demo-optional-resources.yaml similarity index 100% rename from examples/pipelineruns/demo-optional-resources.yaml rename to examples/v1alpha1/pipelineruns/demo-optional-resources.yaml diff --git a/examples/pipelineruns/no-ci/.keep b/examples/v1alpha1/pipelineruns/no-ci/.keep similarity index 100% rename from examples/pipelineruns/no-ci/.keep rename to examples/v1alpha1/pipelineruns/no-ci/.keep diff --git a/examples/pipelineruns/no-ci/limitrange.yaml b/examples/v1alpha1/pipelineruns/no-ci/limitrange.yaml similarity index 100% rename from examples/pipelineruns/no-ci/limitrange.yaml rename to examples/v1alpha1/pipelineruns/no-ci/limitrange.yaml diff --git a/examples/pipelineruns/no-ci/pipeline-timeout.yaml b/examples/v1alpha1/pipelineruns/no-ci/pipeline-timeout.yaml similarity index 100% rename from examples/pipelineruns/no-ci/pipeline-timeout.yaml rename to examples/v1alpha1/pipelineruns/no-ci/pipeline-timeout.yaml diff --git a/examples/pipelineruns/output-pipelinerun.yaml b/examples/v1alpha1/pipelineruns/output-pipelinerun.yaml similarity index 100% rename from examples/pipelineruns/output-pipelinerun.yaml rename to examples/v1alpha1/pipelineruns/output-pipelinerun.yaml diff --git a/examples/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml b/examples/v1alpha1/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml similarity index 100% rename from examples/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml rename to examples/v1alpha1/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml diff --git a/examples/pipelineruns/pipelinerun-with-pipelinespec.yaml b/examples/v1alpha1/pipelineruns/pipelinerun-with-pipelinespec.yaml similarity index 100% rename from examples/pipelineruns/pipelinerun-with-pipelinespec.yaml rename to examples/v1alpha1/pipelineruns/pipelinerun-with-pipelinespec.yaml diff --git a/examples/pipelineruns/pipelinerun-with-resourcespec.yaml b/examples/v1alpha1/pipelineruns/pipelinerun-with-resourcespec.yaml similarity index 100% rename from examples/pipelineruns/pipelinerun-with-resourcespec.yaml rename to examples/v1alpha1/pipelineruns/pipelinerun-with-resourcespec.yaml diff --git a/examples/pipelineruns/pipelinerun.yaml b/examples/v1alpha1/pipelineruns/pipelinerun.yaml similarity index 100% rename from examples/pipelineruns/pipelinerun.yaml rename to examples/v1alpha1/pipelineruns/pipelinerun.yaml diff --git a/examples/pipelineruns/workspaces.yaml b/examples/v1alpha1/pipelineruns/workspaces.yaml similarity index 100% rename from examples/pipelineruns/workspaces.yaml rename to examples/v1alpha1/pipelineruns/workspaces.yaml diff --git a/examples/taskruns/build-gcs-targz.yaml b/examples/v1alpha1/taskruns/build-gcs-targz.yaml similarity index 100% rename from examples/taskruns/build-gcs-targz.yaml rename to examples/v1alpha1/taskruns/build-gcs-targz.yaml diff --git a/examples/taskruns/build-gcs-zip.yaml b/examples/v1alpha1/taskruns/build-gcs-zip.yaml similarity index 100% rename from examples/taskruns/build-gcs-zip.yaml rename to examples/v1alpha1/taskruns/build-gcs-zip.yaml diff --git a/examples/taskruns/build-push-kaniko.yaml b/examples/v1alpha1/taskruns/build-push-kaniko.yaml similarity index 100% rename from examples/taskruns/build-push-kaniko.yaml rename to examples/v1alpha1/taskruns/build-push-kaniko.yaml diff --git a/examples/taskruns/cloud-event.yaml b/examples/v1alpha1/taskruns/cloud-event.yaml similarity index 100% rename from examples/taskruns/cloud-event.yaml rename to examples/v1alpha1/taskruns/cloud-event.yaml diff --git a/examples/taskruns/clustertask.yaml b/examples/v1alpha1/taskruns/clustertask.yaml similarity index 100% rename from examples/taskruns/clustertask.yaml rename to examples/v1alpha1/taskruns/clustertask.yaml diff --git a/examples/taskruns/configmap.yaml b/examples/v1alpha1/taskruns/configmap.yaml similarity index 100% rename from examples/taskruns/configmap.yaml rename to examples/v1alpha1/taskruns/configmap.yaml diff --git a/examples/taskruns/custom-env.yaml b/examples/v1alpha1/taskruns/custom-env.yaml similarity index 100% rename from examples/taskruns/custom-env.yaml rename to examples/v1alpha1/taskruns/custom-env.yaml diff --git a/examples/taskruns/custom-volume.yaml b/examples/v1alpha1/taskruns/custom-volume.yaml similarity index 100% rename from examples/taskruns/custom-volume.yaml rename to examples/v1alpha1/taskruns/custom-volume.yaml diff --git a/examples/taskruns/dind-sidecar.yaml b/examples/v1alpha1/taskruns/dind-sidecar.yaml similarity index 100% rename from examples/taskruns/dind-sidecar.yaml rename to examples/v1alpha1/taskruns/dind-sidecar.yaml diff --git a/examples/taskruns/docker-creds.yaml b/examples/v1alpha1/taskruns/docker-creds.yaml similarity index 100% rename from examples/taskruns/docker-creds.yaml rename to examples/v1alpha1/taskruns/docker-creds.yaml diff --git a/examples/taskruns/gcs-resource.yaml b/examples/v1alpha1/taskruns/gcs-resource.yaml similarity index 100% rename from examples/taskruns/gcs-resource.yaml rename to examples/v1alpha1/taskruns/gcs-resource.yaml diff --git a/examples/taskruns/git-resource.yaml b/examples/v1alpha1/taskruns/git-resource.yaml similarity index 100% rename from examples/taskruns/git-resource.yaml rename to examples/v1alpha1/taskruns/git-resource.yaml diff --git a/examples/taskruns/git-ssh-creds.yaml b/examples/v1alpha1/taskruns/git-ssh-creds.yaml similarity index 100% rename from examples/taskruns/git-ssh-creds.yaml rename to examples/v1alpha1/taskruns/git-ssh-creds.yaml diff --git a/examples/taskruns/git-volume.yaml b/examples/v1alpha1/taskruns/git-volume.yaml similarity index 100% rename from examples/taskruns/git-volume.yaml rename to examples/v1alpha1/taskruns/git-volume.yaml diff --git a/examples/taskruns/home-is-set.yaml b/examples/v1alpha1/taskruns/home-is-set.yaml similarity index 100% rename from examples/taskruns/home-is-set.yaml rename to examples/v1alpha1/taskruns/home-is-set.yaml diff --git a/examples/taskruns/home-volume.yaml b/examples/v1alpha1/taskruns/home-volume.yaml similarity index 100% rename from examples/taskruns/home-volume.yaml rename to examples/v1alpha1/taskruns/home-volume.yaml diff --git a/examples/taskruns/no-ci/.keep b/examples/v1alpha1/taskruns/no-ci/.keep similarity index 100% rename from examples/taskruns/no-ci/.keep rename to examples/v1alpha1/taskruns/no-ci/.keep diff --git a/examples/taskruns/no-ci/limitrange.yaml b/examples/v1alpha1/taskruns/no-ci/limitrange.yaml similarity index 100% rename from examples/taskruns/no-ci/limitrange.yaml rename to examples/v1alpha1/taskruns/no-ci/limitrange.yaml diff --git a/examples/taskruns/optional-resources-with-clustertask.yaml b/examples/v1alpha1/taskruns/optional-resources-with-clustertask.yaml similarity index 100% rename from examples/taskruns/optional-resources-with-clustertask.yaml rename to examples/v1alpha1/taskruns/optional-resources-with-clustertask.yaml diff --git a/examples/taskruns/optional-resources.yaml b/examples/v1alpha1/taskruns/optional-resources.yaml similarity index 100% rename from examples/taskruns/optional-resources.yaml rename to examples/v1alpha1/taskruns/optional-resources.yaml diff --git a/examples/taskruns/pull-private-image.yaml b/examples/v1alpha1/taskruns/pull-private-image.yaml similarity index 100% rename from examples/taskruns/pull-private-image.yaml rename to examples/v1alpha1/taskruns/pull-private-image.yaml diff --git a/examples/taskruns/pullrequest.yaml b/examples/v1alpha1/taskruns/pullrequest.yaml similarity index 100% rename from examples/taskruns/pullrequest.yaml rename to examples/v1alpha1/taskruns/pullrequest.yaml diff --git a/examples/taskruns/secret-env.yaml b/examples/v1alpha1/taskruns/secret-env.yaml similarity index 100% rename from examples/taskruns/secret-env.yaml rename to examples/v1alpha1/taskruns/secret-env.yaml diff --git a/examples/taskruns/secret-volume-params.yaml b/examples/v1alpha1/taskruns/secret-volume-params.yaml similarity index 100% rename from examples/taskruns/secret-volume-params.yaml rename to examples/v1alpha1/taskruns/secret-volume-params.yaml diff --git a/examples/taskruns/secret-volume.yaml b/examples/v1alpha1/taskruns/secret-volume.yaml similarity index 100% rename from examples/taskruns/secret-volume.yaml rename to examples/v1alpha1/taskruns/secret-volume.yaml diff --git a/examples/taskruns/sidecar-interp.yaml b/examples/v1alpha1/taskruns/sidecar-interp.yaml similarity index 100% rename from examples/taskruns/sidecar-interp.yaml rename to examples/v1alpha1/taskruns/sidecar-interp.yaml diff --git a/examples/taskruns/sidecar-ready-script.yaml b/examples/v1alpha1/taskruns/sidecar-ready-script.yaml similarity index 100% rename from examples/taskruns/sidecar-ready-script.yaml rename to examples/v1alpha1/taskruns/sidecar-ready-script.yaml diff --git a/examples/taskruns/sidecar-ready.yaml b/examples/v1alpha1/taskruns/sidecar-ready.yaml similarity index 100% rename from examples/taskruns/sidecar-ready.yaml rename to examples/v1alpha1/taskruns/sidecar-ready.yaml diff --git a/examples/taskruns/step-by-digest.yaml b/examples/v1alpha1/taskruns/step-by-digest.yaml similarity index 100% rename from examples/taskruns/step-by-digest.yaml rename to examples/v1alpha1/taskruns/step-by-digest.yaml diff --git a/examples/taskruns/step-script.yaml b/examples/v1alpha1/taskruns/step-script.yaml similarity index 100% rename from examples/taskruns/step-script.yaml rename to examples/v1alpha1/taskruns/step-script.yaml diff --git a/examples/taskruns/steps-run-in-order.yaml b/examples/v1alpha1/taskruns/steps-run-in-order.yaml similarity index 100% rename from examples/taskruns/steps-run-in-order.yaml rename to examples/v1alpha1/taskruns/steps-run-in-order.yaml diff --git a/examples/taskruns/steptemplate-env-merge.yaml b/examples/v1alpha1/taskruns/steptemplate-env-merge.yaml similarity index 100% rename from examples/taskruns/steptemplate-env-merge.yaml rename to examples/v1alpha1/taskruns/steptemplate-env-merge.yaml diff --git a/examples/taskruns/task-multiple-output-image.yaml b/examples/v1alpha1/taskruns/task-multiple-output-image.yaml similarity index 100% rename from examples/taskruns/task-multiple-output-image.yaml rename to examples/v1alpha1/taskruns/task-multiple-output-image.yaml diff --git a/examples/taskruns/task-output-image.yaml b/examples/v1alpha1/taskruns/task-output-image.yaml similarity index 100% rename from examples/taskruns/task-output-image.yaml rename to examples/v1alpha1/taskruns/task-output-image.yaml diff --git a/examples/taskruns/task-result.yaml b/examples/v1alpha1/taskruns/task-result.yaml similarity index 100% rename from examples/taskruns/task-result.yaml rename to examples/v1alpha1/taskruns/task-result.yaml diff --git a/examples/taskruns/task-volume-args.yaml b/examples/v1alpha1/taskruns/task-volume-args.yaml similarity index 100% rename from examples/taskruns/task-volume-args.yaml rename to examples/v1alpha1/taskruns/task-volume-args.yaml diff --git a/examples/taskruns/template-volume.yaml b/examples/v1alpha1/taskruns/template-volume.yaml similarity index 100% rename from examples/taskruns/template-volume.yaml rename to examples/v1alpha1/taskruns/template-volume.yaml diff --git a/examples/taskruns/unnamed-steps.yaml b/examples/v1alpha1/taskruns/unnamed-steps.yaml similarity index 100% rename from examples/taskruns/unnamed-steps.yaml rename to examples/v1alpha1/taskruns/unnamed-steps.yaml diff --git a/examples/taskruns/workingdir.yaml b/examples/v1alpha1/taskruns/workingdir.yaml similarity index 100% rename from examples/taskruns/workingdir.yaml rename to examples/v1alpha1/taskruns/workingdir.yaml diff --git a/examples/taskruns/workspace-readonly.yaml b/examples/v1alpha1/taskruns/workspace-readonly.yaml similarity index 100% rename from examples/taskruns/workspace-readonly.yaml rename to examples/v1alpha1/taskruns/workspace-readonly.yaml diff --git a/examples/taskruns/workspace-volume.yaml b/examples/v1alpha1/taskruns/workspace-volume.yaml similarity index 100% rename from examples/taskruns/workspace-volume.yaml rename to examples/v1alpha1/taskruns/workspace-volume.yaml diff --git a/examples/taskruns/workspace.yaml b/examples/v1alpha1/taskruns/workspace.yaml similarity index 100% rename from examples/taskruns/workspace.yaml rename to examples/v1alpha1/taskruns/workspace.yaml diff --git a/examples/v1alpha2/pipelineruns/clustertask-pipelinerun.yaml b/examples/v1alpha2/pipelineruns/clustertask-pipelinerun.yaml new file mode 100644 index 00000000000..0fda9c8be35 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/clustertask-pipelinerun.yaml @@ -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' diff --git a/examples/v1alpha2/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml b/examples/v1alpha2/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml new file mode 100644 index 00000000000..9638d00f6f1 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/conditional-pipelinerun-with-optional-resources.yaml @@ -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 diff --git a/examples/v1alpha2/pipelineruns/conditional-pipelinerun.yaml b/examples/v1alpha2/pipelineruns/conditional-pipelinerun.yaml new file mode 100644 index 00000000000..9ac6f92f50e --- /dev/null +++ b/examples/v1alpha2/pipelineruns/conditional-pipelinerun.yaml @@ -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 diff --git a/examples/v1alpha2/pipelineruns/demo-optional-resources.yaml b/examples/v1alpha2/pipelineruns/demo-optional-resources.yaml new file mode 100644 index 00000000000..450a25b3585 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/demo-optional-resources.yaml @@ -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 +--- diff --git a/examples/v1alpha2/pipelineruns/no-ci/.keep b/examples/v1alpha2/pipelineruns/no-ci/.keep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/examples/v1alpha2/pipelineruns/no-ci/limitrange.yaml b/examples/v1alpha2/pipelineruns/no-ci/limitrange.yaml new file mode 100644 index 00000000000..face542a97e --- /dev/null +++ b/examples/v1alpha2/pipelineruns/no-ci/limitrange.yaml @@ -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: {} diff --git a/examples/v1alpha2/pipelineruns/no-ci/pipeline-timeout.yaml b/examples/v1alpha2/pipelineruns/no-ci/pipeline-timeout.yaml new file mode 100644 index 00000000000..dd8483d24f0 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/no-ci/pipeline-timeout.yaml @@ -0,0 +1,55 @@ +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: task-echo-message +spec: + params: + - name: MESSAGE + type: string + default: "Hello World" + steps: + - name: echo + image: ubuntu + command: + - sleep 90s + args: + - "$(inputs.params.MESSAGE)" +--- + +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: pipelinerun-timeout +spec: + # 1 hour and half timeout + timeout: 1h30m + pipelineSpec: + params: + - name: MORNING_GREETINGS + description: "morning greetings, default is Good Morning!" + type: string + default: "Good Morning!" + - name: NIGHT_GREETINGS + description: "Night greetings, default is Good Night!" + type: string + default: "Good Night!" + tasks: + # Task to display morning greetings + - name: echo-good-morning + taskRef: + name: task-echo-message + params: + - name: MESSAGE + value: $(params.MORNING_GREETINGS) + # Task to display night greetings + - name: echo-good-night + taskRef: + name: task-echo-message + params: + - name: MESSAGE + value: $(params.NIGHT_GREETINGS) + params: + - name: MORNING_GREETINGS + value: "Good Morning, Bob!" + - name: NIGHT_GREETINGS + value: "Good Night, Bob!" diff --git a/examples/v1alpha2/pipelineruns/output-pipelinerun.yaml b/examples/v1alpha2/pipelineruns/output-pipelinerun.yaml new file mode 100644 index 00000000000..b48eed397f1 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/output-pipelinerun.yaml @@ -0,0 +1,104 @@ +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-git-output-pipelinerun +spec: + type: git + params: + - name: revision + value: v0.32.0 + - name: url + value: https://github.com/GoogleContainerTools/skaffold +--- +# Task writes "some stuff" to a predefined path in the workspace git PipelineResource +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: create-file +spec: + resources: + inputs: + - name: workspace + type: git + targetPath: damnworkspace + outputs: + - name: workspace + type: git + steps: + - name: read-docs-old + image: ubuntu + command: ["/bin/bash"] + args: ['-c', 'ls -la /workspace/damnworkspace/docs/README.md'] # tests that targetpath works + - name: write-new-stuff + image: ubuntu + command: ['bash'] + args: ['-c', 'ln -s /workspace/damnworkspace /workspace/output/workspace && echo some stuff > /workspace/output/workspace/stuff'] +--- +# Reads a file from a predefined path in the workspace git PipelineResource +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: check-stuff-file-exists +spec: + params: + - name: args + type: array + resources: + inputs: + - name: workspace + type: git + targetPath: newworkspace + steps: + - name: read + image: ubuntu + command: ["/bin/bash"] + args: ['$(params.args)'] # tests that new targetpath and previous task output is dumped +--- +# The Output of the first Task (git resource) create-file is given as an `Input` +# to the next `Task` check-stuff-file-exists using`from` clause. + +apiVersion: tekton.dev/v1alpha2 +kind: Pipeline +metadata: + name: output-pipeline +spec: + resources: + - name: source-repo + type: git + tasks: + - name: first-create-file # 1. create file + taskRef: + name: create-file + resources: + inputs: + - name: workspace + resource: source-repo + outputs: + - name: workspace + resource: source-repo + - name: then-check # 2. check file exists + taskRef: + name: check-stuff-file-exists + params: + - name: args + value: + - '-c' + - 'cat /workspace/newworkspace/stuff' + resources: + inputs: + - name: workspace + resource: source-repo + from: [first-create-file] +--- +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: output-pipeline-run +spec: + pipelineRef: + name: output-pipeline + serviceAccountName: 'default' + resources: + - name: source-repo + resourceRef: + name: skaffold-git-output-pipelinerun diff --git a/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml b/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml new file mode 100644 index 00000000000..568be978a9d --- /dev/null +++ b/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml @@ -0,0 +1,79 @@ +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: pipelinerun-with-taskspec-to-echo-good-morning +spec: + pipelineSpec: + tasks: + - name: echo-good-morning + taskSpec: + steps: + - name: echo + image: ubuntu + script: | + #!/usr/bin/env bash + echo "Good Morning!" +--- + +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: pipelinerun-with-taskspec-to-echo-message +spec: + pipelineSpec: + params: + - name: MESSAGE + description: "Message, default is Hello World!" + type: string + default: "Hello World!" + tasks: + - name: echo-message + taskSpec: + params: + - name: MESSAGE + type: string + default: "Hello World!" + steps: + - name: echo + image: ubuntu + script: | + #!/usr/bin/env bash + echo "$(params.MESSAGE)" + params: + - name: MESSAGE + value: $(params.MESSAGE) + params: + - name: MESSAGE + value: "Good Morning!" +--- + +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: pipelinerun-with-taskspec-to-echo-greetings +spec: + pipelineSpec: + params: + - name: GREETINGS + description: "Greetings, default is Hello World!" + type: string + default: "Hello World!" + tasks: + - name: echo-greetings + taskSpec: + params: + - name: MESSAGE + type: string + default: "Hello World!" + steps: + - name: echo + image: ubuntu + script: | + #!/usr/bin/env bash + echo "$(params.MESSAGE)" + params: + - name: MESSAGE + value: $(params.GREETINGS) + params: + - name: GREETINGS + value: "Good Morning!" diff --git a/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec.yaml b/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec.yaml new file mode 100644 index 00000000000..5cd0da41e31 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/pipelinerun-with-pipelinespec.yaml @@ -0,0 +1,53 @@ +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: task-echo-message +spec: + params: + - name: MESSAGE + type: string + default: "Hello World" + steps: + - name: echo + image: ubuntu + command: + - echo + args: + - "$(params.MESSAGE)" +--- + +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: pipelinerun-echo-greetings +spec: + pipelineSpec: + params: + - name: MORNING_GREETINGS + description: "morning greetings, default is Good Morning!" + type: string + default: "Good Morning!" + - name: NIGHT_GREETINGS + description: "Night greetings, default is Good Night!" + type: string + default: "Good Night!" + tasks: + # Task to display morning greetings + - name: echo-good-morning + taskRef: + name: task-echo-message + params: + - name: MESSAGE + value: $(params.MORNING_GREETINGS) + # Task to display night greetings + - name: echo-good-night + taskRef: + name: task-echo-message + params: + - name: MESSAGE + value: $(params.NIGHT_GREETINGS) + params: + - name: MORNING_GREETINGS + value: "Good Morning, Bob!" + - name: NIGHT_GREETINGS + value: "Good Night, Bob!" diff --git a/examples/v1alpha2/pipelineruns/pipelinerun-with-resourcespec.yaml b/examples/v1alpha2/pipelineruns/pipelinerun-with-resourcespec.yaml new file mode 100644 index 00000000000..1471f09a357 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/pipelinerun-with-resourcespec.yaml @@ -0,0 +1,97 @@ +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: task-to-list-files +spec: + resources: + inputs: + - name: pipeline-git + type: git + outputs: + - name: pipeline-git + type: git + steps: + - name: list + image: ubuntu + command: + - bash + args: + - -c + - | + ls -al $(resources.inputs.pipeline-git.path) +--- + +apiVersion: tekton.dev/v1alpha1 +kind: Condition +metadata: + name: always-true-sample-condition +spec: + resources: + - name: pipeline-git + type: git + check: + image: ubuntu + command: + - bash + args: + - -c + - | + echo "Hello from Tekton Pipeline!" +--- + +apiVersion: tekton.dev/v1alpha2 +kind: Pipeline +metadata: + name: pipeline-to-list-files +spec: + resources: + - name: pipeline-git + type: git + params: + - name: "path" + default: "README.md" + tasks: + - name: list-files + taskRef: + name: task-to-list-files + resources: + inputs: + - name: pipeline-git + resource: pipeline-git + outputs: + - name: pipeline-git + resource: pipeline-git + - name: conditional-list-files + taskRef: + name: task-to-list-files + conditions: + - conditionRef: always-true-sample-condition + resources: + - name: pipeline-git + resource: pipeline-git + resources: + inputs: + - name: pipeline-git + resource: pipeline-git + outputs: + - name: pipeline-git + resource: pipeline-git +--- + +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: demo-pipelinerun-with-resourcespec +spec: + pipelineRef: + name: pipeline-to-list-files + serviceAccountName: 'default' + resources: + - name: pipeline-git + resourceSpec: + type: git + params: + - name: revision + value: master + - name: url + value: https://github.com/tektoncd/pipeline diff --git a/examples/v1alpha2/pipelineruns/pipelinerun.yaml b/examples/v1alpha2/pipelineruns/pipelinerun.yaml new file mode 100644 index 00000000000..5ae420bcf13 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/pipelinerun.yaml @@ -0,0 +1,258 @@ +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-image-leeroy-app +spec: + type: image + params: + - name: url + value: gcr.io/christiewilson-catfactory/leeroy-app +--- +# This demo modifies the cluster (deploys to it) you must use a service +# account with permission to admin the cluster (or make your default user an admin +# of the `default` namespace with default-cluster-admin. + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + generateName: default-cluster-admin- +subjects: + - kind: ServiceAccount + name: default + namespace: default +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-image-leeroy-web-pipelinerun +spec: + type: image + params: + - name: url + value: gcr.io/christiewilson-catfactory/leeroy-web +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-git-pipelinerun +spec: + type: git + params: + - name: revision + value: v0.32.0 + - name: url + value: https://github.com/GoogleContainerTools/skaffold +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: unit-tests +spec: + resources: + inputs: + - name: workspace + type: git + targetPath: go/src/github.com/GoogleContainerTools/skaffold + steps: + - name: run-tests + image: golang + env: + - name: GOPATH + value: /workspace/go + workingDir: /workspace/go/src/github.com/GoogleContainerTools/skaffold + command: + - echo + args: + - "pass" +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: build-push +spec: + params: + - name: pathToDockerFile + description: The path to the dockerfile to build + default: /workspace/workspace/Dockerfile + - name: pathToContext + description: The build context used by Kaniko (https://github.com/GoogleContainerTools/kaniko#kaniko-build-contexts) + default: /workspace/workspace + resources: + inputs: + - name: workspace + type: git + outputs: + - name: builtImage + type: image + steps: + - name: build-and-push + image: gcr.io/kaniko-project/executor:v0.15.0 + # specifying DOCKER_CONFIG is required to allow kaniko to detect docker credential + env: + - name: "DOCKER_CONFIG" + value: "/tekton/home/.docker/" + command: + - /kaniko/executor + args: + - --dockerfile=$(params.pathToDockerFile) + - --destination=$(resources.outputs.builtImage.url) + - --context=$(params.pathToContext) +--- +# This task deploys with kubectl apply -f +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: demo-deploy-kubectl +spec: + params: + - name: path + description: Path to the manifest to apply + - name: yqArg + description: Okay this is a hack, but I didn't feel right hard-codeing `-d1` down below + - name: yamlPathToImage + description: The path to the image to replace in the yaml manifest (arg to yq) + resources: + inputs: + - name: workspace + type: git + - name: image + type: image + steps: + - name: replace-image + image: mikefarah/yq + command: ['yq'] + args: + - "w" + - "-i" + - "$(params.yqArg)" + - "$(params.path)" + - "$(params.yamlPathToImage)" + - "$(resources.inputs.image.url)" + - name: run-kubectl + image: lachlanevenson/k8s-kubectl + command: ['kubectl'] + args: + - 'apply' + - '-f' + - '$(params.path)' +--- +# This Pipeline Builds two microservice images(https://github.com/GoogleContainerTools/skaffold/tree/master/examples/microservices) +# from the Skaffold repo (https://github.com/GoogleContainerTools/skaffold) and deploys them to the repo currently running Tekton Pipelines. + +# **Note** : It does this using the k8s `Deployment` in the skaffold repos's existing yaml +# files, so at the moment there is no guarantee that the image that are built and +# pushed are the ones that are deployed (that would require using the digest of +# the built image, see https://github.com/tektoncd/pipeline/issues/216). + +apiVersion: tekton.dev/v1alpha2 +kind: Pipeline +metadata: + name: demo-pipeline +spec: + resources: + - name: source-repo + type: git + - name: web-image + type: image + - name: app-image + type: image + tasks: + - name: skaffold-unit-tests + taskRef: + name: unit-tests + resources: + inputs: + - name: workspace + resource: source-repo + - name: build-skaffold-web + runAfter: [skaffold-unit-tests] + taskRef: + name: build-push + params: + - name: pathToDockerFile + value: Dockerfile + - name: pathToContext + value: /workspace/workspace/examples/microservices/leeroy-web + resources: + inputs: + - name: workspace + resource: source-repo + outputs: + - name: builtImage + resource: web-image + - name: build-skaffold-app + runAfter: [skaffold-unit-tests] + taskRef: + name: build-push + params: + - name: pathToDockerFile + value: Dockerfile + - name: pathToContext + value: /workspace/workspace/examples/microservices/leeroy-app + resources: + inputs: + - name: workspace + resource: source-repo + outputs: + - name: builtImage + resource: app-image + - name: deploy-app + taskRef: + name: demo-deploy-kubectl + resources: + inputs: + - name: workspace + resource: source-repo + - name: image + resource: app-image + from: + - build-skaffold-app + params: + - name: path + value: /workspace/workspace/examples/microservices/leeroy-app/kubernetes/deployment.yaml + - name: yqArg + value: "-d1" + - name: yamlPathToImage + value: "spec.template.spec.containers[0].image" + - name: deploy-web + taskRef: + name: demo-deploy-kubectl + resources: + inputs: + - name: workspace + resource: source-repo + - name: image + resource: web-image + from: + - build-skaffold-web + params: + - name: path + value: /workspace/workspace/examples/microservices/leeroy-web/kubernetes/deployment.yaml + - name: yqArg + value: "-d1" + - name: yamlPathToImage + value: "spec.template.spec.containers[0].image" +--- +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + name: demo-pipeline-run-1 +spec: + pipelineRef: + name: demo-pipeline + serviceAccountName: 'default' + resources: + - name: source-repo + resourceRef: + name: skaffold-git-pipelinerun + - name: web-image + resourceRef: + name: skaffold-image-leeroy-web-pipelinerun + - name: app-image + resourceRef: + name: skaffold-image-leeroy-app diff --git a/examples/v1alpha2/pipelineruns/workspaces.yaml b/examples/v1alpha2/pipelineruns/workspaces.yaml new file mode 100644 index 00000000000..f7dca7a78d6 --- /dev/null +++ b/examples/v1alpha2/pipelineruns/workspaces.yaml @@ -0,0 +1,135 @@ +# In this contrived example 3 different kinds of workspace volume are used to thread +# data through a pipeline's tasks. +# 1. A ConfigMap is used as source of recipe data. +# 2. A Secret is used to store a password. +# 3. A PVC is used to share data from one task to the next. +# +# The end result is a pipeline that first checks if the password is correct and, if so, +# copies data out of a recipe store onto a shared volume. The recipe data is then read +# by a subsequent task and printed to screen. +apiVersion: v1 +kind: ConfigMap +metadata: + name: sensitive-recipe-storage +data: + brownies: | + 1. Heat oven to 325 degrees F + 2. Melt 1/2 cup butter w/ 1/2 cup cocoa, stirring smooth. + 3. Remove from heat, allow to cool for a few minutes. + 4. Transfer to bowl. + 5. Whisk in 2 eggs, one at a time. + 6. Stir in vanilla. + 7. Separately combine 1 cup sugar, 1/4 cup flour, 1 cup chopped + walnuts and pinch of salt + 8. Combine mixtures. + 9. Bake in greased pan for 30 minutes. Watch carefully for + appropriate level of gooeyness. +--- +apiVersion: v1 +kind: Secret +metadata: + name: secret-password +type: Opaque +data: + password: aHVudGVyMg== +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: shared-task-storage +spec: + resources: + requests: + storage: 16Mi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: fetch-secure-data +spec: + workspaces: + - name: super-secret-password + - name: secure-store + - name: filedrop + steps: + - name: fetch-and-write + image: ubuntu + script: | + if [ "hunter2" = "$(cat $(workspaces.super-secret-password.path)/password)" ]; then + cp $(workspaces.secure-store.path)/recipe.txt $(workspaces.filedrop.path) + else + echo "wrong password!" + exit 1 + fi +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: print-data +spec: + workspaces: + - name: storage + readOnly: true + params: + - name: filename + steps: + - name: print-secrets + image: ubuntu + script: cat $(workspaces.storage.path)/$(params.filename) +--- +apiVersion: tekton.dev/v1alpha2 +kind: Pipeline +metadata: + name: fetch-and-print-recipe +spec: + workspaces: + - name: password-vault + - name: recipe-store + - name: shared-data + tasks: + - name: fetch-the-recipe + taskRef: + name: fetch-secure-data + workspaces: + - name: super-secret-password + workspace: password-vault + - name: secure-store + workspace: recipe-store + - name: filedrop + workspace: shared-data + - name: print-the-recipe + taskRef: + name: print-data + # Note: this is currently required to ensure order of write / read on PVC is correct. + runAfter: + - fetch-the-recipe + params: + - name: filename + value: recipe.txt + workspaces: + - name: storage + workspace: shared-data +--- +apiVersion: tekton.dev/v1alpha2 +kind: PipelineRun +metadata: + generateName: recipe-time- +spec: + pipelineRef: + name: fetch-and-print-recipe + workspaces: + - name: password-vault + secret: + secretName: secret-password + - name: recipe-store + configMap: + name: sensitive-recipe-storage + items: + - key: brownies + path: recipe.txt + - name: shared-data + persistentVolumeClaim: + claimName: shared-task-storage diff --git a/examples/v1alpha2/taskruns/build-gcs-targz.yaml b/examples/v1alpha2/taskruns/build-gcs-targz.yaml new file mode 100644 index 00000000000..78a82ab1b73 --- /dev/null +++ b/examples/v1alpha2/taskruns/build-gcs-targz.yaml @@ -0,0 +1,25 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: build-gcs-targz- +spec: + taskSpec: + resources: + inputs: + - name: source + type: storage + steps: + - image: ubuntu + script: cat source/file.txt + resources: + inputs: + - name: source + resourceSpec: + type: storage + params: + - name: location + value: gs://build-crd-tests/archive.tar.gz + - name: artifactType + value: TarGzArchive + - name: type + value: build-gcs diff --git a/examples/v1alpha2/taskruns/build-gcs-zip.yaml b/examples/v1alpha2/taskruns/build-gcs-zip.yaml new file mode 100644 index 00000000000..fd721f7a8b3 --- /dev/null +++ b/examples/v1alpha2/taskruns/build-gcs-zip.yaml @@ -0,0 +1,25 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: build-gcs-zip- +spec: + taskSpec: + resources: + inputs: + - name: source + type: storage + steps: + - image: ubuntu + script: cat source/file.txt + resources: + inputs: + - name: source + resourceSpec: + type: storage + params: + - name: location + value: gs://build-crd-tests/archive.zip + - name: artifactType + value: ZipArchive + - name: type + value: build-gcs diff --git a/examples/v1alpha2/taskruns/build-push-kaniko.yaml b/examples/v1alpha2/taskruns/build-push-kaniko.yaml new file mode 100644 index 00000000000..3e511ab670d --- /dev/null +++ b/examples/v1alpha2/taskruns/build-push-kaniko.yaml @@ -0,0 +1,81 @@ +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-image-leeroy-web-build-push-kaniko +spec: + type: image + params: + - name: url + value: localhost:5000/leeroy-web +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-git-build-push-kaniko +spec: + type: git + params: + - name: revision + value: v0.32.0 + - name: url + value: https://github.com/GoogleContainerTools/skaffold +--- +# Builds an image via kaniko and pushes it to registry. +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: build-push-kaniko +spec: + params: + - name: pathToDockerFile + description: The path to the dockerfile to build + default: /workspace/workspace/Dockerfile + - name: pathToContext + description: The build context used by Kaniko (https://github.com/GoogleContainerTools/kaniko#kaniko-build-contexts) + default: /workspace/workspace + resources: + inputs: + - name: workspace + type: git + outputs: + - name: builtImage + type: image + steps: + - name: build-and-push + image: gcr.io/kaniko-project/executor:v0.15.0 + # specifying DOCKER_CONFIG is required to allow kaniko to detect docker credential + env: + - name: "DOCKER_CONFIG" + value: "/tekton/home/.docker/" + args: + - --dockerfile=$(inputs.params.pathToDockerFile) + - --destination=$(outputs.resources.builtImage.url) + - --context=$(inputs.params.pathToContext) + - --oci-layout-path=$(inputs.resources.builtImage.path) + securityContext: + runAsUser: 0 + sidecars: + - image: registry + name: registry +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: build-push-kaniko +spec: + taskRef: + name: build-push-kaniko + resources: + inputs: + - name: workspace + resourceRef: + name: skaffold-git-build-push-kaniko + outputs: + - name: builtImage + resourceRef: + name: skaffold-image-leeroy-web-build-push-kaniko + params: + - name: pathToDockerFile + value: Dockerfile + - name: pathToContext + value: /workspace/workspace/examples/microservices/leeroy-web diff --git a/examples/v1alpha2/taskruns/cloud-event.yaml b/examples/v1alpha2/taskruns/cloud-event.yaml new file mode 100644 index 00000000000..ab0073d8d59 --- /dev/null +++ b/examples/v1alpha2/taskruns/cloud-event.yaml @@ -0,0 +1,182 @@ +apiVersion: v1 +kind: Service +metadata: + name: sink +spec: + selector: + app: cloudevent + ports: + - protocol: TCP + port: 8080 + targetPort: 8080 +--- +apiVersion: v1 +kind: Pod +metadata: + labels: + app: cloudevent + name: message-sink +spec: + containers: + - env: + - name: PORT + value: "8080" + name: cloudeventlistener + image: python:3-alpine + imagePullPolicy: IfNotPresent + command: ["/bin/sh"] + args: + - -ce + - | + cat <

POST!

') + + def do_GET(self): + with open("content.txt", mode="rb") as f: + content = f.read() + self.send_response(200 if content else 404) + self.send_header('Content-type', 'text/plain') + self.end_headers() + self.wfile.write(content) + + if __name__ == "__main__": + open("content.txt", 'a').close() + httpd = HTTPServer(('', $PORT), GetAndPostHandler) + print('Starting httpd...') + httpd.serve_forever() + EOF + ports: + - containerPort: 8080 + name: user-port + protocol: TCP +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: send-cloud-event-task + +spec: + resources: + outputs: + - name: myimage + type: image + - name: notification + type: cloudEvent + steps: + - name: wait-for-sink + image: python:3-alpine + imagePullPolicy: IfNotPresent + script: | + #!/usr/bin/env python3 + import http.client + import json + import sys + import time + + while True: + conn = http.client.HTTPConnection("sink:8080") + try: + conn.request("GET", "/") + break + except: + # Perhaps the service is not setup yet, so service name does not + # resolve or it does not accept connections on 8080 yet + print("Not yet...") + time.sleep(10) + - name: build-index-json + image: busybox + script: | + set -e + cat < $(resources.outputs.myimage.path)/index.json + { + "schemaVersion": 2, + "manifests": [ + { + "mediaType": "application/vnd.oci.image.index.v1+json", + "size": 314, + "digest": "sha256:deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" + } + ] + } +--- +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: poll-for-content-task +spec: + steps: + - name: polling + image: python:3-alpine + imagePullPolicy: IfNotPresent + script: | + #!/usr/bin/env python3 + import http.client + import json + import sys + import time + + while True: + conn = http.client.HTTPConnection("sink:8080") + try: + conn.request("GET", "/") + except: + # Perhaps the service is not setup yet, so service name does not + # resolve or it does not accept connections on 8080 yet + print("Not yet...") + time.sleep(10) + continue + response = conn.getresponse() + if response.status == 200: + print("Got it!") + taskrun = json.loads(response.read().decode('utf-8')) + digest = taskrun['taskRun']['status']['resourcesResult'][0]['value'] + image_name = taskrun['taskRun']['status']['resourcesResult'][0]['resourceRef']['name'] + print("Got digest %s for image %s" % (digest, image_name)) + if image_name == "myimage" and digest: + break + else: + sys.exit(1) + else: + print("Not yet...") + time.sleep(10) +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: send-cloud-event +spec: + resources: + outputs: + - name: myimage + resourceSpec: + type: image + params: + - name: url + value: fake-registry/test/fake-image + - name: notification + resourceSpec: + type: cloudEvent + params: + - name: targetURI + value: http://sink.default:8080 + taskRef: + name: send-cloud-event-task +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: poll-for-content-run +spec: + taskRef: + name: poll-for-content-task diff --git a/examples/v1alpha2/taskruns/clustertask.yaml b/examples/v1alpha2/taskruns/clustertask.yaml new file mode 100644 index 00000000000..b31eed920d4 --- /dev/null +++ b/examples/v1alpha2/taskruns/clustertask.yaml @@ -0,0 +1,17 @@ +apiVersion: tekton.dev/v1alpha2 +kind: ClusterTask +metadata: + name: clustertask +spec: + steps: + - image: ubuntu + script: echo hello +--- +apiVersion: tekton.dev/v1alpha1 +kind: TaskRun +metadata: + generateName: clustertask- +spec: + taskRef: + name: clustertask + kind: ClusterTask diff --git a/examples/v1alpha2/taskruns/configmap.yaml b/examples/v1alpha2/taskruns/configmap.yaml new file mode 100644 index 00000000000..cd0c80ea2cb --- /dev/null +++ b/examples/v1alpha2/taskruns/configmap.yaml @@ -0,0 +1,32 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: config-for-testing-configmaps +data: + test.data: tasks are my jam +--- +apiVersion: tekton.dev/v1alpha1 +kind: TaskRun +metadata: + generateName: configmap- +spec: + taskSpec: + steps: + - name: secret + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $(cat /config/test.data) == $TEST_DATA ]] + env: + - name: TEST_DATA + valueFrom: + configMapKeyRef: + name: config-for-testing-configmaps + key: test.data + volumeMounts: + - name: config-volume + mountPath: /config + volumes: + - name: config-volume + configMap: + name: config-for-testing-configmaps diff --git a/examples/v1alpha2/taskruns/custom-env.yaml b/examples/v1alpha2/taskruns/custom-env.yaml new file mode 100644 index 00000000000..0636ffaffe8 --- /dev/null +++ b/examples/v1alpha2/taskruns/custom-env.yaml @@ -0,0 +1,14 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: custom-env- +spec: + taskSpec: + steps: + - image: ubuntu + script: | + #!/usr/bin/env bash + [[ $MY_VAR1 == foo ]] + env: + - name: MY_VAR1 + value: foo diff --git a/examples/v1alpha2/taskruns/custom-volume.yaml b/examples/v1alpha2/taskruns/custom-volume.yaml new file mode 100644 index 00000000000..6f560d893f8 --- /dev/null +++ b/examples/v1alpha2/taskruns/custom-volume.yaml @@ -0,0 +1,26 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: custom-volume- +spec: + taskSpec: + steps: + - name: write + image: ubuntu + script: | + #!/usr/bin/env bash + echo some stuff > /im/a/custom/mount/path/file + volumeMounts: + - name: custom + mountPath: /im/a/custom/mount/path + - name: read + image: ubuntu + script: | + #!/usr/bin/env bash + cat /short/and/stout/file | grep stuff + volumeMounts: + - name: custom + mountPath: /short/and/stout + volumes: + - name: custom + emptyDir: {} diff --git a/examples/v1alpha2/taskruns/dind-sidecar.yaml b/examples/v1alpha2/taskruns/dind-sidecar.yaml new file mode 100644 index 00000000000..aea99e26646 --- /dev/null +++ b/examples/v1alpha2/taskruns/dind-sidecar.yaml @@ -0,0 +1,61 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: dind-sidecar- +spec: + taskSpec: + steps: + - image: docker + name: client + env: + # Connect to the sidecar over TCP, with TLS. + - name: DOCKER_HOST + value: tcp://localhost:2376 + # Verify TLS. + - name: DOCKER_TLS_VERIFY + value: '1' + # Use the certs generated by the sidecar daemon. + - name: DOCKER_CERT_PATH + value: /certs/client + script: | + #!/usr/bin/env sh + # Run a Docker container. + docker run busybox echo hello + + # Write a Dockerfile and `docker build` it. + cat > Dockerfile << EOF + FROM ubuntu + RUN apt-get update + ENTRYPOINT ["echo", "hello"] + EOF + docker build -t hello . && docker run hello + docker images + + # ...then run it! + docker run hello + volumeMounts: + - mountPath: /certs/client + name: dind-certs + + sidecars: + - image: docker:dind + name: server + securityContext: + privileged: true + env: + # Write generated certs to the path shared with the client. + - name: DOCKER_TLS_CERTDIR + value: /certs + volumeMounts: + - mountPath: /certs/client + name: dind-certs + # Wait for the dind daemon to generate the certs it will share with the + # client. + readinessProbe: + periodSeconds: 1 + exec: + command: ['ls', '/certs/client/ca.pem'] + + volumes: + - name: dind-certs + emptyDir: {} diff --git a/examples/v1alpha2/taskruns/docker-creds.yaml b/examples/v1alpha2/taskruns/docker-creds.yaml new file mode 100644 index 00000000000..65f793372a1 --- /dev/null +++ b/examples/v1alpha2/taskruns/docker-creds.yaml @@ -0,0 +1,42 @@ +apiVersion: v1 +kind: Secret +metadata: + name: docker-basic + annotations: + tekton.dev/docker-0: https://us.gcr.io + tekton.dev/docker-1: https://eu.gcr.io + tekton.dev/docker-2: https://asia.gcr.io + tekton.dev/docker-3: https://gcr.io + tekton.dev/docker-4: https://reduce-chance-of-selecting-gcr.io +type: kubernetes.io/basic-auth +data: + # Generated by: + # echo -n _json_key | base64 + username: X2pzb25fa2V5 + # Generated by: + # cat /tmp/key.json | base64 -w 0 + # This service account is JUST a storage reader on gcr.io/build-crd-testing + # (it is the same as test/serviceaccount/secret.yaml) + password: ewogICJ0eXBlIjogInNlcnZpY2VfYWNjb3VudCIsCiAgInByb2plY3RfaWQiOiAiYnVpbGQtY3JkLXRlc3RpbmciLAogICJwcml2YXRlX2tleV9pZCI6ICIwNTAyYTQxYTgxMmZiNjRjZTU2YTY4ZWM1ODMyYWIwYmExMWMxMWU2IiwKICAicHJpdmF0ZV9rZXkiOiAiLS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tXG5NSUlFdlFJQkFEQU5CZ2txaGtpRzl3MEJBUUVGQUFTQ0JLY3dnZ1NqQWdFQUFvSUJBUUM5WDRFWU9BUmJ4UU04XG5EMnhYY2FaVGsrZ1k4ZWp1OTh0THFDUXFUckdNVzlSZVQyeE9ZNUF5Z2FsUFArcDd5WEVja3dCRC9IaE0wZ2xJXG43TVRMZGVlS1dyK3JBMUx3SFp5V0ZXN0gwT25mN3duWUhFSExXVW1jM0JDT1JFRHRIUlo3WnJQQmYxSFRBQS8zXG5Nblc1bFpIU045b2p6U1NGdzZBVnU2ajZheGJCSUlKNzU0THJnS2VBWXVyd2ZJUTJSTFR1MjAxazJJcUxZYmhiXG4zbVNWRzVSK3RiS3oxQ3ZNNTNuSENiN0NmdVZlV3NyQThrazd4SHJyTFFLTW1JOXYyc2dSdWd5TUF6d3ovNnpOXG5oNS9pTXh4Z2VxNVc4eGtWeDNKMm5ZOEpKZEhhZi9UNkFHc09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sCiAgImF1dGhfcHJvdmlkZXJfeDUwOV9jZXJ0X3VybCI6ICJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9vYXV0aDIvdjEvY2VydHMiLAogICJjbGllbnRfeDUwOV9jZXJ0X3VybCI6ICJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9yb2JvdC92MS9tZXRhZGF0YS94NTA5L3B1bGwtc2VjcmV0LXRlc3RpbmclNDBidWlsZC1jcmQtdGVzdGluZy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIKfQo= +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: robot-docker-basic +secrets: +- name: docker-basic +imagePullSecrets: +- name: docker-basic +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: docker-creds +spec: + serviceAccountName: robot-docker-basic + taskSpec: + steps: + - name: test + image: quay.io/rhpipeline/skopeo:alpine + # Test pulling a private builder container. + script: skopeo copy docker://gcr.io/build-crd-testing/secret-sauce dir:///tmp/ diff --git a/examples/v1alpha2/taskruns/gcs-resource.yaml b/examples/v1alpha2/taskruns/gcs-resource.yaml new file mode 100644 index 00000000000..0927ce4e4be --- /dev/null +++ b/examples/v1alpha2/taskruns/gcs-resource.yaml @@ -0,0 +1,23 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: gcs-resource- +spec: + taskSpec: + resources: + inputs: + - name: source + type: storage + steps: + - image: alpine + script: unzip source/archive.zip && cat file.txt + resources: + inputs: + - name: source + resourceSpec: + type: storage + params: + - name: location + value: gs://build-crd-tests/archive.zip + - name: type + value: gcs diff --git a/examples/v1alpha2/taskruns/git-resource.yaml b/examples/v1alpha2/taskruns/git-resource.yaml new file mode 100644 index 00000000000..e0a2f10b6fa --- /dev/null +++ b/examples/v1alpha2/taskruns/git-resource.yaml @@ -0,0 +1,71 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: git-resource-tag- +spec: + taskSpec: + resources: + inputs: + - name: skaffold + type: git + steps: + - image: ubuntu + script: cat skaffold/README.md + resources: + inputs: + - name: skaffold + resourceSpec: + type: git + params: + - name: revision + value: v0.32.0 + - name: url + value: https://github.com/GoogleContainerTools/skaffold +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: git-resource-branch- +spec: + taskSpec: + resources: + inputs: + - name: skaffold + type: git + steps: + - image: ubuntu + script: cat skaffold/README.md + resources: + inputs: + - name: skaffold + resourceSpec: + type: git + params: + - name: revision + value: master + - name: url + value: https://github.com/GoogleContainerTools/skaffold +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: git-resource-ref- +spec: + taskSpec: + resources: + inputs: + - name: skaffold + type: git + steps: + - image: ubuntu + script: cat skaffold/README.md + resources: + inputs: + - name: skaffold + resourceSpec: + type: git + params: + - name: revision + value: pull/2932/head + - name: url + value: https://github.com/GoogleContainerTools/skaffold diff --git a/examples/v1alpha2/taskruns/git-ssh-creds.yaml b/examples/v1alpha2/taskruns/git-ssh-creds.yaml new file mode 100644 index 00000000000..ea0acedebcc --- /dev/null +++ b/examples/v1alpha2/taskruns/git-ssh-creds.yaml @@ -0,0 +1,50 @@ +apiVersion: v1 +kind: Secret +metadata: + name: git-ssh + annotations: + tekton.dev/git-0: github.com +type: kubernetes.io/ssh-auth +data: + # Generated by: + # cat id_rsa | base64 -w 0 + # This deploy key has read-only permissions on github.com/knative/build + ssh-privatekey: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlKSndJQkFBS0NBZ0VBc0YrY3ZIdUlKRjBwNWZNVDBUUVZhMWpTZVBNVlhtUWhGa1F0andsamJFSXVKaVh5CmVrU1I0WUtDbFZIZVo0M2VOa2p5SzFwTDVmVnZnY3J2bkVUMXE5dmFmOThtNzdHWjZUdnJGY0RyZjViZDFIZGUKTU1MTFZRRU8vN1lkcEJFeVJ1UjA4RXRzbWp0RUVaNERVZnBUWGQ5RnAyTU5UWTYwVzFpa0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hrY2NLcnBwMHlWaHA1SGRFSWNLcjZwTGxWREJmT0xYOVFVc3lDT1Ywd3pmaklKTmxHRVlzZGxMSml6SGhibjJtVWp2U0FIUXFaRVRZUDgxZUZ6TFFOblBIdDRFVlZVaDdWZkRFU1U4NEtlem1ENVFsV3BYTG12VTMxL3lNZitTZTh4aEhUdktTQ1pJRkltV3dvRzZtYlVvV2Y5bnpwSW9hU2pCK3dlcXFVVW1wYWFhc1hWYWw3MkorVVgyQisyUlBXM1JjVDBlT3pRZ3FsSkwzUktyVEp2ZHNqRTNKRUF2R3EzbEdIU1pYeTI4RzNza3VhMlNtVmkvdzR5Q0U2Z2JPRHFuVFdsZzcrd0M2MDR5ZEdYQThWSmlTNWFwNDNKWGlVRkZBYVE9PQo= +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: robot-git-ssh +secrets: +- name: git-ssh +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: git-ssh-creds +spec: + serviceAccountName: robot-git-ssh + resources: + inputs: + - name: gitssh + resourceSpec: + type: git + params: + - name: revision + value: master + - name: url + value: git@github.com:tektoncd/pipeline.git + taskSpec: + resources: + inputs: + - name: gitssh + type: git + steps: + - name: config + image: ubuntu + script: | + #!/usr/bin/env bash + cat /workspace/gitssh/README.md diff --git a/examples/v1alpha2/taskruns/git-volume.yaml b/examples/v1alpha2/taskruns/git-volume.yaml new file mode 100644 index 00000000000..792aa32161a --- /dev/null +++ b/examples/v1alpha2/taskruns/git-volume.yaml @@ -0,0 +1,21 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: git-volume- +spec: + taskSpec: + steps: + - name: git + image: gcr.io/cloud-builders/git + workingDir: /path/to/git/rules_docker + args: ["status"] + volumeMounts: + - name: source + mountPath: /path/to/git + + volumes: + - name: source + gitRepo: # https://kubernetes.io/docs/concepts/storage/volumes/#gitrepo + # gitRepo is deprecated. + repository: "https://github.com/bazelbuild/rules_docker.git" + revision: "3caddbe7f75fde6afb2e2c63654b5bbeeeedf2ac" diff --git a/examples/v1alpha2/taskruns/home-is-set.yaml b/examples/v1alpha2/taskruns/home-is-set.yaml new file mode 100644 index 00000000000..54d6509317a --- /dev/null +++ b/examples/v1alpha2/taskruns/home-is-set.yaml @@ -0,0 +1,11 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: home-is-set- +spec: + taskSpec: + steps: + - image: ubuntu + script: | + #!/usr/bin/env bash + [[ $HOME == /tekton/home ]] diff --git a/examples/v1alpha2/taskruns/home-volume.yaml b/examples/v1alpha2/taskruns/home-volume.yaml new file mode 100644 index 00000000000..bd8ede7d878 --- /dev/null +++ b/examples/v1alpha2/taskruns/home-volume.yaml @@ -0,0 +1,26 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: home-volume- +spec: + taskSpec: + steps: + - name: write + image: ubuntu + script: echo some stuff > /tekton/home/stuff + - name: read + image: ubuntu + script: cat /tekton/home/stuff + - name: override-homevol + image: ubuntu + # /tekton/home/stuff *doesn't* exist, because the specified volumeMount + # conflicts with it, and the user's explicit declaration wins the tie. + script: | + #!/usr/bin/env bash + [[ ! -f /tekton/home/stuff ]] + volumeMounts: + - name: empty + mountPath: /tekton/home + volumes: + - name: empty + emptyDir: {} diff --git a/examples/v1alpha2/taskruns/no-ci/.keep b/examples/v1alpha2/taskruns/no-ci/.keep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/examples/v1alpha2/taskruns/no-ci/limitrange.yaml b/examples/v1alpha2/taskruns/no-ci/limitrange.yaml new file mode 100644 index 00000000000..0c94e246cd5 --- /dev/null +++ b/examples/v1alpha2/taskruns/no-ci/limitrange.yaml @@ -0,0 +1,47 @@ +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: TaskRun +metadata: + generateName: echo-hello-world-run- +spec: + inputs: {} + outputs: {} + serviceAccountName: "" + taskRef: + name: echo-hello-world + timeout: 1h0m0s + limitRangeName: "limit-mem-cpu-per-container" +status: + podName: "" diff --git a/examples/v1alpha2/taskruns/optional-resources-with-clustertask.yaml b/examples/v1alpha2/taskruns/optional-resources-with-clustertask.yaml new file mode 100644 index 00000000000..b13793aa60c --- /dev/null +++ b/examples/v1alpha2/taskruns/optional-resources-with-clustertask.yaml @@ -0,0 +1,34 @@ +apiVersion: tekton.dev/v1alpha2 +kind: ClusterTask +metadata: + name: clustertask-with-optional-resources +spec: + params: + - name: filename + type: string + default: "README.md" + resources: + inputs: + - name: git-repo + type: git + optional: true + outputs: + - name: optionalimage + type: image + optional: true + steps: + - name: task-echo-success + image: ubuntu + script: | + #!/usr/bin/env bash + echo "success" +--- + +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: clustertask-without-resources +spec: + taskRef: + name: clustertask-with-optional-resources + kind: ClusterTask diff --git a/examples/v1alpha2/taskruns/optional-resources.yaml b/examples/v1alpha2/taskruns/optional-resources.yaml new file mode 100644 index 00000000000..de59343c202 --- /dev/null +++ b/examples/v1alpha2/taskruns/optional-resources.yaml @@ -0,0 +1,130 @@ +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: task-check-optional-resources +spec: + params: + - name: filename + type: string + default: "README.md" + resources: + inputs: + - name: git-repo + type: git + description: "The input is code from a git repository" + optional: true + outputs: + - name: optionalimage + type: image + description: "The output is a Docker image" + optional: true + steps: + - name: check-git-repo + image: ubuntu + script: | + #!/usr/bin/env bash + if [ -d $(resources.inputs.git-repo.path) ]; then + echo "Git repo was cloned at $(resources.inputs.git-repo.path)" + if [ -f $(resources.inputs.git-repo.path)/$(inputs.params.filename) ]; then + echo "$(inputs.params.filename) does exist at $(resources.inputs.git-repo.path)" + else + echo "$(inputs.params.filename) does not exist at $(resources.inputs.git-repo.path)" + fi + else + echo "Git repo was not cloned at $(resources.inputs.git-repo.path)" + fi + if [ "$(outputs.resources.optionalimage.url)" == "" ]; then + echo "Image URL: $(outputs.resources.optionalimage.url)" + else + echo "No image URL specified." + fi + echo "Yay, Input and Output Resources can be Optional!" +--- + +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: demo-optional-inputs-resources-with-resources +spec: + params: + - name: filename + value: "README.md" + resources: + inputs: + - name: git-repo + resourceSpec: + type: git + params: + - name: url + value: https://github.com/tektoncd/pipeline.git + outputs: + - name: optionalimage + resourceSpec: + type: image + params: + - name: url + value: gcr.io/foo/bar + taskRef: + name: task-check-optional-resources +--- + +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: demo-optional-inputs-resources-invalid-filename +spec: + params: + - name: filename + value: "invalid.md" + resources: + inputs: + - name: git-repo + resourceSpec: + type: git + params: + - name: url + value: https://github.com/tektoncd/pipeline.git + taskRef: + name: task-check-optional-resources +--- + +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: demo-optional-inputs-resources-without-resources +spec: + params: + - name: filename + value: "README.md" + taskRef: + name: task-check-optional-resources +--- + +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: demo-optional-inputs-resources-without-resources-and-params +spec: + taskRef: + name: task-check-optional-resources +--- + +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: demo-optional-outputs-resources-with-input-resources +spec: + params: + - name: filename + value: "README.md" + resources: + inputs: + - name: git-repo + resourceSpec: + type: git + params: + - name: url + value: https://github.com/tektoncd/pipeline.git + taskRef: + name: task-check-optional-resources +--- diff --git a/examples/v1alpha2/taskruns/pull-private-image.yaml b/examples/v1alpha2/taskruns/pull-private-image.yaml new file mode 100644 index 00000000000..f28ee46a87e --- /dev/null +++ b/examples/v1alpha2/taskruns/pull-private-image.yaml @@ -0,0 +1,50 @@ +# Copyright 2019 The Tekton Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: Secret +metadata: + name: test-readonly-credentials +type: kubernetes.io/dockercfg +data: + # Generated by: + # kubectl create secret docker-registry regsecret --docker-server=https://gcr.io \ + # --docker-username=_json_key --docker-password="$(cat /tmp/key.json)" \ + # --docker-email=noreply@google.com --dry-run -o yaml + # This service account is JUST a storage reader on gcr.io/build-crd-testing + .dockercfg: eyJodHRwczovL2djci5pbyI6eyJ1c2VybmFtZSI6Il9qc29uX2tleSIsInBhc3N3b3JkIjoie1xuICBcInR5cGVcIjogXCJzZXJ2aWNlX2FjY291bnRcIixcbiAgXCJwcm9qZWN0X2lkXCI6IFwiYnVpbGQtY3JkLXRlc3RpbmdcIixcbiAgXCJwcml2YXRlX2tleV9pZFwiOiBcIjA1MDJhNDFhODEyZmI2NGNlNTZhNjhlYzU4MzJhYjBiYTExYzExZTZcIixcbiAgXCJwcml2YXRlX2tleVwiOiBcIi0tLS0tQkVHSU4gUFJJVkFURSBLRVktLS0tLVxcbk1JSUV2UUlCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktjd2dnU2pBZ0VBQW9JQkFRQzlYNEVZT0FSYnhRTThcXG5EMnhYY2FaVGsrZ1k4ZWp1OTh0THFDUXFUckdNVzlSZVQyeE9ZNUF5Z2FsUFArcDd5WEVja3dCRC9IaE0wZ2xJXFxuN01UTGRlZUtXcityQTFMd0haeVdGVzdIME9uZjd3bllIRUhMV1VtYzNCQ09SRUR0SFJaN1pyUEJmMUhUQUEvM1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alV5TlRFek5USWlMQW9nSUNKaGRYUm9YM1Z5YVNJNklDSm9kSFJ3Y3pvdkwyRmpZMjkxYm5SekxtZHZiMmRzWlM1amIyMHZieTl2WVhWMGFESXZZWFYwYUNJc0NpQWdJblJ2YTJWdVgzVnlhU0k2SUNKb2RIUndjem92TDJGalkyOTFiblJ6TG1kdmIyZHNaUzVqYjIwdmJ5OXZZWFYwYURJdmRHOXJaVzRpTEFvZ0lDSmhkWFJvWDNCeWIzWnBaR1Z5WDNnMU1EbGZZMlZ5ZEY5MWNtd2lPaUFpYUhSMGNITTZMeTkzZDNjdVoyOXZaMnhsWVhCcGN5NWpiMjB2YjJGMWRHZ3lMM1l4TDJObGNuUnpJaXdLSUNBaVkyeHBaVzUwWDNnMU1EbGZZMlZ5ZEY5MWNtd2lPaUFpYUhSMGNITTZMeTkzZDNjdVoyOXZaMnhsWVhCcGN5NWpiMjB2Y205aWIzUXZkakV2YldWMFlXUmhkR0V2ZURVd09TOXdkV3hzTFhObFkzSmxkQzEwWlhOMGFXNW5KVFF3WW5WcGJHUXRZM0prTFhSbGMzUnBibWN1YVdGdExtZHpaWEoyYVdObFlXTmpiM1Z1ZEM1amIyMGlDbjA9In19 +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: test-build-robot +secrets: +- name: test-readonly-credentials +imagePullSecrets: +- name: test-readonly-credentials +--- +# This example contains embedded taskSpec. This taskrun requires the secrets and service accounts to be able to pull the +# private image. Required secret and service account for this run is configured in test-build-robot SA and test-readonly-credentials secret. +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: pull-private-image- +spec: + serviceAccountName: test-build-robot + taskSpec: + steps: + - name: pull + # Private image is just Ubuntu + image: quay.io/rhpipeline/skopeo:alpine + script: skopeo copy docker://gcr.io/build-crd-testing/secret-sauce dir:///tmp/ diff --git a/examples/v1alpha2/taskruns/pullrequest.yaml b/examples/v1alpha2/taskruns/pullrequest.yaml new file mode 100644 index 00000000000..465e7656453 --- /dev/null +++ b/examples/v1alpha2/taskruns/pullrequest.yaml @@ -0,0 +1,33 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: pullrequest- +spec: + resources: + inputs: + - name: pr + resourceSpec: + type: pullRequest + params: + - name: url + # I just picked a random PR. The first couple didn't have any interesting comments or labels. + value: https://github.com/tektoncd/pipeline/pull/100 + taskSpec: + resources: + inputs: + - name: pr + type: pullRequest + steps: + - name: dump-workspace + image: ubuntu + script: find $(resources.inputs.pr.path)/* -type f | xargs tail -n +1 + + - name: ensure-approved + image: ubuntu + script: | + if [ -f "$(resources.inputs.pr.path)/labels/approved" ]; then + echo "PR is approved!" + else + echo "PR is not approved!" + exit 1 + fi diff --git a/examples/v1alpha2/taskruns/secret-env.yaml b/examples/v1alpha2/taskruns/secret-env.yaml new file mode 100644 index 00000000000..f0360e3ab95 --- /dev/null +++ b/examples/v1alpha2/taskruns/secret-env.yaml @@ -0,0 +1,25 @@ +kind: Secret +apiVersion: v1 +metadata: + name: secret-env-password +stringData: + ninja: SECRET_PASSWORD +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: secret-env +spec: + taskSpec: + steps: + - name: secret + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $SECRET_PASSWORD == SECRET_PASSWORD ]] + env: + - name: SECRET_PASSWORD + valueFrom: + secretKeyRef: + name: secret-env-password + key: ninja diff --git a/examples/v1alpha2/taskruns/secret-volume-params.yaml b/examples/v1alpha2/taskruns/secret-volume-params.yaml new file mode 100644 index 00000000000..6052ee8644e --- /dev/null +++ b/examples/v1alpha2/taskruns/secret-volume-params.yaml @@ -0,0 +1,33 @@ +kind: Secret +apiVersion: v1 +metadata: + name: secret-vol-param-password +stringData: + ninja: SECRET_PASSWORD +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: secret-volume-params +spec: + taskSpec: + params: + - name: SCNAME + description: Name of secret + type: string + steps: + - image: ubuntu + script: | + #!/usr/bin/env bash + SECRET_PASSWORD=$(cat /var/secret/ninja) + [[ $SECRET_PASSWORD == SECRET_PASSWORD ]] + volumeMounts: + - name: secret-volume + mountPath: /var/secret + volumes: + - name: secret-volume + secret: + secretName: "$(params.SCNAME)" + params: + - name: SCNAME + value: secret-vol-param-password diff --git a/examples/v1alpha2/taskruns/secret-volume.yaml b/examples/v1alpha2/taskruns/secret-volume.yaml new file mode 100644 index 00000000000..14d0984e677 --- /dev/null +++ b/examples/v1alpha2/taskruns/secret-volume.yaml @@ -0,0 +1,26 @@ +kind: Secret +apiVersion: v1 +metadata: + name: secret-vol-password +stringData: + ninja: SECRET_PASSWORD +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: secret-volume +spec: + taskSpec: + steps: + - image: ubuntu + script: | + #!/usr/bin/env bash + SECRET_PASSWORD=$(cat /var/secret/ninja) + [[ $SECRET_PASSWORD == SECRET_PASSWORD ]] + volumeMounts: + - name: secret-volume + mountPath: /var/secret + volumes: + - name: secret-volume + secret: + secretName: secret-vol-password diff --git a/examples/v1alpha2/taskruns/sidecar-interp.yaml b/examples/v1alpha2/taskruns/sidecar-interp.yaml new file mode 100644 index 00000000000..6aa642cbf04 --- /dev/null +++ b/examples/v1alpha2/taskruns/sidecar-interp.yaml @@ -0,0 +1,33 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: sidecar-interp- +spec: + taskSpec: + params: + - name: some-input + default: foo + volumes: + - name: shared + emptyDir: {} + sidecars: + - name: value-sidecar + image: ubuntu + command: + - /bin/bash + args: + - -c + - "echo $(params.some-input) > /shared/value && sleep infinity" + volumeMounts: + - name: shared + mountPath: /shared + steps: + - name: check-value + image: ubuntu + script: | + #!/bin/bash + VALUE=$(cat /shared/value) + [[ $VALUE == 'foo' ]] + volumeMounts: + - name: shared + mountPath: /shared diff --git a/examples/v1alpha2/taskruns/sidecar-ready-script.yaml b/examples/v1alpha2/taskruns/sidecar-ready-script.yaml new file mode 100644 index 00000000000..e36e7548af8 --- /dev/null +++ b/examples/v1alpha2/taskruns/sidecar-ready-script.yaml @@ -0,0 +1,28 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: sidecar-ready- +spec: + taskSpec: + sidecars: + - name: slow-sidecar + image: ubuntu + script: | + echo "hello from sidecar" > /shared/message + volumeMounts: + - name: shared + mountPath: /shared + + steps: + - name: check-ready + image: ubuntu + script: cat /shared/message + volumeMounts: + - name: shared + mountPath: /shared + + # Sidecars don't have /workspace mounted by default, so we have to define + # our own shared volume. + volumes: + - name: shared + emptyDir: {} diff --git a/examples/v1alpha2/taskruns/sidecar-ready.yaml b/examples/v1alpha2/taskruns/sidecar-ready.yaml new file mode 100644 index 00000000000..11869605b0d --- /dev/null +++ b/examples/v1alpha2/taskruns/sidecar-ready.yaml @@ -0,0 +1,38 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: sidecar-ready- +spec: + taskSpec: + sidecars: + - name: slow-sidecar + image: ubuntu + command: ['sleep', 'infinity'] + # The sidecar takes 5s to report as Ready, even after it starts. If the + # step runs as soon as the sidecar starts, it will fail because + # /shared/ready isn't available yet. + readinessProbe: + exec: + command: + - sh + - -c + - sleep 5 && touch /shared/ready + volumeMounts: + - name: shared + mountPath: /shared + + steps: + - name: check-ready + image: ubuntu + # The step will only succeed if the sidecar has written this file, which + # it does 5s after it starts, before it reports Ready. + script: cat /shared/ready + volumeMounts: + - name: shared + mountPath: /shared + + # Sidecars don't have /workspace mounted by default, so we have to define + # our own shared volume. + volumes: + - name: shared + emptyDir: {} diff --git a/examples/v1alpha2/taskruns/step-by-digest.yaml b/examples/v1alpha2/taskruns/step-by-digest.yaml new file mode 100644 index 00000000000..33d64fc3201 --- /dev/null +++ b/examples/v1alpha2/taskruns/step-by-digest.yaml @@ -0,0 +1,11 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: step-by-digest- +spec: + taskSpec: + steps: + # Step images can be specified by digest. + - image: busybox@sha256:1303dbf110c57f3edf68d9f5a16c082ec06c4cf7604831669faf2c712260b5a0 + # NB: command is not set, so it must be looked up from the registry. + args: ['-c', 'echo hello'] diff --git a/examples/v1alpha2/taskruns/step-script.yaml b/examples/v1alpha2/taskruns/step-script.yaml new file mode 100644 index 00000000000..cfd77f6150e --- /dev/null +++ b/examples/v1alpha2/taskruns/step-script.yaml @@ -0,0 +1,88 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: step-script- +spec: + taskSpec: + params: + - name: PARAM + default: param-value + + steps: + - name: noshebang + image: ubuntu + script: echo "no shebang" + - name: bash + image: ubuntu + env: + - name: FOO + value: foooooooo + script: | + #!/usr/bin/env bash + set -euxo pipefail + echo "Hello from Bash!" + echo FOO is ${FOO} + echo substring is ${FOO:2:4} + for i in {1..10}; do + echo line $i + done + + - name: place-file + image: ubuntu + script: | + #!/usr/bin/env bash + echo "echo Hello from script file" > /workspace/hello + chmod +x /workspace/hello + - name: run-file + image: ubuntu + script: | + #!/usr/bin/env bash + /workspace/hello + + - name: contains-eof + image: ubuntu + script: | + #!/usr/bin/env bash + cat > file << EOF + this file has some contents + EOF + cat file + + - name: node + image: node + script: | + #!/usr/bin/env node + console.log("Hello from Node!") + + - name: python + image: python + script: | + #!/usr/bin/env python3 + print("Hello from Python!") + + - name: perl + image: perl + script: | + #!/usr/bin/perl + print "Hello from Perl!" + + # Test that param values are replaced. + - name: params-applied + image: python + script: | + #!/usr/bin/env python3 + v = '$(params.PARAM)' + if v != 'param-value': + print('Param values not applied') + print('Got: ', v) + exit(1) + + # Test that args are allowed and passed to the script as expected. + - name: args-allowed + image: ubuntu + args: ['hello', 'world'] + script: | + #!/usr/bin/env bash + [[ $# == 2 ]] + [[ $1 == "hello" ]] + [[ $2 == "world" ]] diff --git a/examples/v1alpha2/taskruns/steps-run-in-order.yaml b/examples/v1alpha2/taskruns/steps-run-in-order.yaml new file mode 100644 index 00000000000..6f7082bb67c --- /dev/null +++ b/examples/v1alpha2/taskruns/steps-run-in-order.yaml @@ -0,0 +1,12 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: steps-run-in-order- +spec: + taskSpec: + steps: + - image: busybox + # NB: command is not set, so it must be looked up from the registry. + args: ['-c', 'sleep 3 && touch foo'] + - image: busybox + args: ['-c', 'ls', 'foo'] diff --git a/examples/v1alpha2/taskruns/steptemplate-env-merge.yaml b/examples/v1alpha2/taskruns/steptemplate-env-merge.yaml new file mode 100644 index 00000000000..bf393ae2d4a --- /dev/null +++ b/examples/v1alpha2/taskruns/steptemplate-env-merge.yaml @@ -0,0 +1,65 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: steptemplate-env-merge- +spec: + params: + - name: FOO + value: foo + - name: BAR + value: bar + taskSpec: + # This template will be applied to all steps + stepTemplate: + env: + - name: QUX + value: original + params: + - name: FOO + description: FOO variable + - name: BAR + description: BAR variable + - name: FOOBAR + description: FOOBAR variable + default: foobar + steps: + # Test the environment variables are set in the task + - name: foo + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $FOO == "foo" ]] + env: + - name: FOO + value: $(params.FOO) + - name: foobar + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $FOOBAR == "foobar" ]] + env: + - name: FOOBAR + value: $(params.FOOBAR) + - name: bar + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $BAR == "bar" ]] + env: + - name: BAR + value: $(params.BAR) + # Use the env var from the stepTemplate + - name: qux-no-override + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $QUX == "original" ]] + # Override the env var in the stepTemplate + - name: qux-override + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $QUX == "override" ]] + env: + - name: QUX + value: override diff --git a/examples/v1alpha2/taskruns/task-multiple-output-image.yaml b/examples/v1alpha2/taskruns/task-multiple-output-image.yaml new file mode 100644 index 00000000000..796a4eaa008 --- /dev/null +++ b/examples/v1alpha2/taskruns/task-multiple-output-image.yaml @@ -0,0 +1,118 @@ +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-image-leeroy-web-1 +spec: + type: image + params: + - name: url + value: gcr.io/dlorenc-vmtest2/leeroy-web # Replace this URL with $KO_DOCKER_REPO +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-image-leeroy-web-2 +spec: + type: image + params: + - name: url + value: gcr.io/christiewilson-catfactory/leeroy-web # Replace this URL with $KO_DOCKER_REPO +--- +# This demo modifies the cluster (deploys to it) you must use a service +# account with permission to admin the cluster (or make your default user an admin +# of the `default` namespace with default-cluster-admin). +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + generateName: default-cluster-admin- +subjects: + - kind: ServiceAccount + name: default + namespace: default +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-git-multiple-output-image +spec: + type: git + params: + - name: revision + value: v0.32.0 + - name: url + value: https://github.com/GoogleContainerTools/skaffold +--- +# This task is currently hardcoding a index.json file instead of +# building an image since kaniko and other easy to use tools don't +# support exporting this file yet +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: multiple-build-push-kaniko +spec: + resources: + inputs: + - name: sourcerepo + type: git + outputs: + - name: builtImage1 + type: image + - name: builtImage2 + type: image + steps: + - name: build-and-push-1 + image: busybox + script: | + set -ex + mkdir -p /tekton/home/image-outputs/builtImage1 + cat < /tekton/home/image-outputs/builtImage1/index.json + { + "schemaVersion": 2, + "manifests": [ + { + "mediaType": "application/vnd.oci.image.index.v1+json", + "size": 314, + "digest": "sha256:05f95b26ed10668b7183c1e2da98610e91372fa9f510046d4ce5812addad86b5" + } + ] + } + - name: build-and-push-2 + image: busybox + script: | + set -e + mkdir -p /tekton/home/image-outputs/builtImage2 + cat < /tekton/home/image-outputs/builtImage2/index.json + { + "schemaVersion": 2, + "manifests": [ + { + "mediaType": "application/vnd.oci.image.index.v1+json", + "size": 314, + "digest": "sha256:05f95b26ed10668b7183c1e2da98610e91372fa9f510046d4ce5812addad86b5" + } + ] + } +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: multiple-build-push-kaniko-run +spec: + taskRef: + name: multiple-build-push-kaniko + resources: + inputs: + - name: sourcerepo + resourceRef: + name: skaffold-git-multiple-output-image + outputs: + - name: builtImage1 + resourceRef: + name: skaffold-image-leeroy-web-1 + - name: builtImage2 + resourceRef: + name: skaffold-image-leeroy-web-2 diff --git a/examples/v1alpha2/taskruns/task-output-image.yaml b/examples/v1alpha2/taskruns/task-output-image.yaml new file mode 100644 index 00000000000..95adeb88970 --- /dev/null +++ b/examples/v1alpha2/taskruns/task-output-image.yaml @@ -0,0 +1,90 @@ +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-image-leeroy-web-output-image +spec: + type: image + params: + - name: url + value: gcr.io/christiewilson-catfactory/leeroy-web # Replace this URL with $KO_DOCKER_REPO +--- +# This demo modifies the cluster (deploys to it) you must use a service +# account with permission to admin the cluster (or make your default user an admin +# of the `default` namespace with default-cluster-admin). +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + generateName: default-cluster-admin- +subjects: + - kind: ServiceAccount + name: default + namespace: default +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: skaffold-git-output-image +spec: + type: git + params: + - name: revision + value: v0.32.0 + - name: url + value: https://github.com/GoogleContainerTools/skaffold +--- +# This task is currently hardcoding a index.json file instead of +# building an image since kaniko and other easy to use tools don't +# support exporting this file yet +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: build-push-kaniko-output-image +spec: + resources: + inputs: + - name: sourcerepo + type: git + outputs: + - name: builtImage + type: image + targetPath: /workspace/sourcerepo + steps: + - name: build-and-push + image: busybox + script: | + set -e + cat < $(resources.inputs.sourcerepo.path)/index.json + { + "schemaVersion": 2, + "manifests": [ + { + "mediaType": "application/vnd.oci.image.index.v1+json", + "size": 314, + "digest": "sha256:05f95b26ed10668b7183c1e2da98610e91372fa9f510046d4ce5812addad86b5" + } + ] + } + - name: echo + image: busybox + script: cat $(resources.inputs.sourcerepo.path)/index.json +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + name: build-push-run-output-image +spec: + taskRef: + name: build-push-kaniko-output-image + resources: + inputs: + - name: sourcerepo + resourceRef: + name: skaffold-git-output-image + outputs: + - name: builtImage + resourceRef: + name: skaffold-image-leeroy-web-output-image diff --git a/examples/v1alpha2/taskruns/task-result.yaml b/examples/v1alpha2/taskruns/task-result.yaml new file mode 100644 index 00000000000..b33110bec64 --- /dev/null +++ b/examples/v1alpha2/taskruns/task-result.yaml @@ -0,0 +1,24 @@ +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: print-date + annotations: + description: | + A simple task that prints the date. +spec: + results: + - name: current-date-unix-timestamp + description: The current date in unix timestamp format + - name: current-date-human-readable + description: The current date in humand readable format + steps: + - name: print-date-unix-timestamp + image: bash:latest + script: | + #!/usr/bin/env bash + date +%s | tee /tekton/results/current-date-unix-timestamp + - name: print-date-humman-readable + image: bash:latest + script: | + #!/usr/bin/env bash + date | tee /tekton/results/current-date-human-readable diff --git a/examples/v1alpha2/taskruns/task-volume-args.yaml b/examples/v1alpha2/taskruns/task-volume-args.yaml new file mode 100644 index 00000000000..410430722d5 --- /dev/null +++ b/examples/v1alpha2/taskruns/task-volume-args.yaml @@ -0,0 +1,34 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: config-for-testing-volume-args +data: + test.data: tasks are my jam +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: task-volume-args- +spec: + taskSpec: + params: + - name: CFGNAME + description: Name of config map + type: string + steps: + - name: read + image: ubuntu + script: | + #!/usr/bin/env bash + cat /configmap/test.data + volumeMounts: + - name: custom + mountPath: /configmap + volumes: + - name: custom + configMap: + name: "$(params.CFGNAME)" + inputs: + params: + - name: CFGNAME + value: config-for-testing-volume-args diff --git a/examples/v1alpha2/taskruns/template-volume.yaml b/examples/v1alpha2/taskruns/template-volume.yaml new file mode 100644 index 00000000000..f588aeeabd1 --- /dev/null +++ b/examples/v1alpha2/taskruns/template-volume.yaml @@ -0,0 +1,27 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: template-volume- +spec: + taskSpec: + steps: + - name: write + image: ubuntu + script: | + #!/usr/bin/env bash + echo some stuff > /im/a/custom/mount/path/file + volumeMounts: + - name: custom + mountPath: /im/a/custom/mount/path + - name: read + image: ubuntu + script: | + #!/usr/bin/env bash + cat /short/and/stout/file + volumeMounts: + - name: custom + mountPath: /short/and/stout + podTemplate: + volumes: + - name: custom + emptyDir: {} diff --git a/examples/v1alpha2/taskruns/unnamed-steps.yaml b/examples/v1alpha2/taskruns/unnamed-steps.yaml new file mode 100644 index 00000000000..b81a59aa1db --- /dev/null +++ b/examples/v1alpha2/taskruns/unnamed-steps.yaml @@ -0,0 +1,13 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: unnamed-steps- +spec: + taskSpec: + steps: + - image: ubuntu + script: 'true' + - image: ubuntu + script: 'true' + - image: ubuntu + script: 'true' diff --git a/examples/v1alpha2/taskruns/workingdir.yaml b/examples/v1alpha2/taskruns/workingdir.yaml new file mode 100644 index 00000000000..9795aa721b2 --- /dev/null +++ b/examples/v1alpha2/taskruns/workingdir.yaml @@ -0,0 +1,19 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: workingdir- +spec: + taskSpec: + steps: + - name: default + image: ubuntu + script: | + #!/usr/bin/env bash + [[ $PWD == /workspace ]] + + - name: override + image: ubuntu + workingDir: '/a/path/too/far' + script: | + #!/usr/bin/env bash + [[ $PWD == /a/path/too/far ]] diff --git a/examples/v1alpha2/taskruns/workspace-readonly.yaml b/examples/v1alpha2/taskruns/workspace-readonly.yaml new file mode 100644 index 00000000000..3dabb0fa9cc --- /dev/null +++ b/examples/v1alpha2/taskruns/workspace-readonly.yaml @@ -0,0 +1,47 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: my-pvc-2 +spec: + resources: + requests: + storage: 5Gi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: workspaces-readonly- +spec: + workspaces: + - name: write-allowed + persistentVolumeClaim: + claimName: my-pvc-2 + - name: write-disallowed + persistentVolumeClaim: + claimName: my-pvc-2 + taskSpec: + workspaces: + - name: write-allowed + - name: write-disallowed + readOnly: true + steps: + - name: write-allowed + image: ubuntu + script: echo "hello" > $(workspaces.write-allowed.path)/foo + - name: read-allowed + image: ubuntu + script: cat $(workspaces.write-allowed.path)/foo | grep "hello" + - name: write-disallowed + image: ubuntu + script: + echo "goodbye" > $(workspaces.write-disallowed.path)/foo || touch write-failed.txt + test -f write-failed.txt + - name: read-again + # We should get "hello" when reading again because writing "goodbye" to + # the file should have been disallowed. + image: ubuntu + script: + cat $(workspaces.write-disallowed.path)/foo | grep "hello" diff --git a/examples/v1alpha2/taskruns/workspace-volume.yaml b/examples/v1alpha2/taskruns/workspace-volume.yaml new file mode 100644 index 00000000000..f756030daea --- /dev/null +++ b/examples/v1alpha2/taskruns/workspace-volume.yaml @@ -0,0 +1,27 @@ +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: workspace-volume- +spec: + taskSpec: + steps: + - name: write + image: ubuntu + script: echo some stuff > /workspace/stuff + - name: read + image: ubuntu + script: cat /workspace/stuff + + - name: override-workspace + image: ubuntu + # /workspace/stuff *doesn't* exist. + script: | + #!/usr/bin/env bash + [[ ! -f /workspace/stuff ]] + volumeMounts: + - name: empty + mountPath: /workspace + + volumes: + - name: empty + emptyDir: {} diff --git a/examples/v1alpha2/taskruns/workspace.yaml b/examples/v1alpha2/taskruns/workspace.yaml new file mode 100644 index 00000000000..3ca1d9bcaca --- /dev/null +++ b/examples/v1alpha2/taskruns/workspace.yaml @@ -0,0 +1,93 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: my-pvc +spec: + resources: + requests: + storage: 5Gi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: my-configmap +data: + message: hello world +--- +apiVersion: v1 +kind: Secret +metadata: + name: my-secret +type: Opaque +stringData: + username: user +data: + message: aGVsbG8gc2VjcmV0 +--- +apiVersion: tekton.dev/v1alpha2 +kind: TaskRun +metadata: + generateName: custom-volume- +spec: + workspaces: + - name: custom + persistentVolumeClaim: + claimName: my-pvc + subPath: my-subdir + - name: custom2 + persistentVolumeClaim: + claimName: my-pvc + - name: custom3 + emptyDir: {} + subPath: testing + - name: custom4 + configMap: + name: my-configmap + items: + - key: message + path: my-message.txt + - name: custom5 + secret: + secretName: my-secret + taskSpec: + steps: + - name: write + image: ubuntu + script: echo $(workspaces.custom.volume) > $(workspaces.custom.path)/foo + - name: read + image: ubuntu + script: cat $(workspaces.custom.path)/foo | grep $(workspaces.custom.volume) + - name: write2 + image: ubuntu + script: echo $(workspaces.custom2.path) > $(workspaces.custom2.path)/foo + - name: read2 + image: ubuntu + script: cat $(workspaces.custom2.path)/foo | grep $(workspaces.custom2.path) + - name: write3 + image: ubuntu + script: echo $(workspaces.custom3.path) > $(workspaces.custom3.path)/foo + - name: read3 + image: ubuntu + script: cat $(workspaces.custom3.path)/foo | grep $(workspaces.custom3.path) + - name: readconfigmap + image: ubuntu + script: cat $(workspaces.custom4.path)/my-message.txt | grep "hello world" + - name: readsecret + image: ubuntu + script: | + #!/usr/bin/env bash + set -xe + cat $(workspaces.custom5.path)/username | grep "user" + cat $(workspaces.custom5.path)/message | grep "hello secret" + workspaces: + - name: custom + - name: custom2 + mountPath: /foo/bar/baz + - name: custom3 + - name: custom4 + mountPath: /baz/bar/quux + - name: custom5 + mountPath: /my/secret/volume diff --git a/test/e2e-common.sh b/test/e2e-common.sh index 97ff5977573..94c28911a9c 100755 --- a/test/e2e-common.sh +++ b/test/e2e-common.sh @@ -119,9 +119,9 @@ function run_tests() { } function run_yaml_tests() { - echo ">> Starting tests for the resource ${1}" - create_resources ${1} || fail_test "Could not create ${1} from the examples" - if ! run_tests ${1}; then + echo ">> Starting tests for the resource ${1}/${2}" + create_resources ${1}/${2} || fail_test "Could not create ${2}/${1} from the examples" + if ! run_tests ${2}; then return 1 fi return 0 @@ -142,9 +142,7 @@ function install_pipeline_crd_version() { function verify_pipeline_installation() { # Make sure that everything is cleaned up in the current namespace. - for res in conditions pipelineresources tasks pipelines taskruns pipelineruns; do - kubectl delete --ignore-not-found=true ${res}.tekton.dev --all - done + delete_pipeline_resources # Wait for pods to be running in the namespaces we are deploying to wait_until_pods_running tekton-pipelines || fail_test "Tekton Pipeline did not come up" @@ -155,9 +153,7 @@ function uninstall_pipeline_crd() { ko delete --ignore-not-found=true -f config/ # Make sure that everything is cleaned up in the current namespace. - for res in conditions pipelineresources tasks pipelines taskruns pipelineruns; do - kubectl delete --ignore-not-found=true ${res}.tekton.dev --all - done + delete_pipeline_resources } function uninstall_pipeline_crd_version() { @@ -165,7 +161,11 @@ function uninstall_pipeline_crd_version() { kubectl delete --ignore-not-found=true -f "https://github.com/tektoncd/pipeline/releases/download/$1/release.yaml" # Make sure that everything is cleaned up in the current namespace. - for res in conditions pipelineresources tasks pipelines taskruns pipelineruns; do + delete_pipeline_resources +} + +function delete_pipeline_resources() { + for res in conditions pipelineresources tasks clustertasks pipelines taskruns pipelineruns; do kubectl delete --ignore-not-found=true ${res}.tekton.dev --all done } diff --git a/test/e2e-tests-yaml.sh b/test/e2e-tests-yaml.sh index 064be59e4fd..bf8d9f2a32c 100755 --- a/test/e2e-tests-yaml.sh +++ b/test/e2e-tests-yaml.sh @@ -33,14 +33,21 @@ install_pipeline_crd # Run the tests failed=0 -for test in taskrun pipelinerun; do - header "Running YAML e2e tests for ${test}s" - if ! run_yaml_tests ${test}; then - echo "ERROR: one or more YAML tests failed" - output_yaml_test_results ${test} - output_pods_logs ${test} - failed=1 - fi +for version in v1alpha1 v1alpha2; do + for test in taskrun pipelinerun; do + header "Running YAML e2e tests for ${version} ${test}s" + if ! run_yaml_tests ${version} ${test}; then + echo "ERROR: one or more YAML tests failed" + output_yaml_test_results ${test} + output_pods_logs ${test} + failed=1 + fi + done + # Clean resources + delete_pipeline_resources + for res in services pods; do + kubectl delete --ignore-not-found=true ${res} --all + done done (( failed )) && fail_test