From 2b312514e615cf989f77ff9b624214f33221fcb5 Mon Sep 17 00:00:00 2001 From: Christie Wilson Date: Mon, 8 Oct 2018 09:27:35 -0700 Subject: [PATCH] Only have one set of examples and test that they are valid We ended up in a state where we had both an `examples` dir and a `samples` dir, and neither were tested, so both were slightly out of sync with each other and the actual types. This was b/c: - When we used kubebuilder, we generated our types from an original set of examples - previously these were in `config/samples` and they ended up in `samples`. We used the validation tests generated by kubebuilder to test these, but when we removed kubebuilder we removed the tests - Before presenting the API to the Build CRD working group, we wanted to have some more complex, real world examples, which @tejal29 created from the `kritis` project and the k8s guestbook example This commit makes sure that all of the functionality demonstrated in `samples` is in `examples`, and removes `samples`. This included: - Fixing `passedConstraints` to be plural as the types expected - Including references to the `PipelineParams` in the `TaskRun` example - Fixing clusterBindings to refer to the actual names of the clusters involved It also adds a step to the integration tests to deploy the examples, which will fail if they do not match the expected schema. At this point they are torn down immediately after creation, but in #108 we can expand this to actually test that they are working. Also had to make some tweaks to the types: - actually including `ClusterBindings` in the `Pipeline` - Using names which include `Resource` instead of `Source`, which we moved away from in #39 Fixes #20 --- Gopkg.lock | 4 ++ README.md | 9 ++- examples/README.md | 4 +- examples/deploy_tasks.yaml | 4 +- examples/invocations/run-kritis-test.yaml | 28 +++----- examples/pipelines/guestbook.yaml | 18 ++--- examples/pipelines/kritis.yaml | 10 +-- examples/smoke-test.sh | 35 ++++++++++ pkg/apis/pipeline/v1alpha1/pipeline_types.go | 3 + pkg/apis/pipeline/v1alpha1/resource_types.go | 10 +++ pkg/apis/pipeline/v1alpha1/task_types.go | 21 ++---- .../v1alpha1/zz_generated.deepcopy.go | 49 +++++++------ samples/README.md | 12 ---- samples/pipeline_v1alpha1_pipeline.yaml | 68 ------------------- samples/pipeline_v1alpha1_pipelineparams.yaml | 27 -------- samples/pipeline_v1alpha1_pipelinerun.yaml | 34 ---------- samples/pipeline_v1alpha1_resources.yaml | 23 ------- samples/pipeline_v1alpha1_task.yaml | 24 ------- samples/pipeline_v1alpha1_taskrun.yaml | 59 ---------------- test/README.md | 9 ++- test/e2e-tests.sh | 5 +- 21 files changed, 127 insertions(+), 329 deletions(-) create mode 100755 examples/smoke-test.sh delete mode 100644 samples/README.md delete mode 100644 samples/pipeline_v1alpha1_pipeline.yaml delete mode 100644 samples/pipeline_v1alpha1_pipelineparams.yaml delete mode 100644 samples/pipeline_v1alpha1_pipelinerun.yaml delete mode 100644 samples/pipeline_v1alpha1_resources.yaml delete mode 100644 samples/pipeline_v1alpha1_task.yaml delete mode 100644 samples/pipeline_v1alpha1_taskrun.yaml diff --git a/Gopkg.lock b/Gopkg.lock index 35fdede3c60..57715f30ec2 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -739,11 +739,13 @@ "github.com/google/go-cmp/cmp", "github.com/knative/build/pkg/apis/build/v1alpha1", "github.com/knative/build/pkg/client/clientset/versioned", + "github.com/knative/build/pkg/client/clientset/versioned/typed/build/v1alpha1", "github.com/knative/build/pkg/client/informers/externalversions", "github.com/knative/build/pkg/client/informers/externalversions/build/v1alpha1", "github.com/knative/build/pkg/client/listers/build/v1alpha1", "github.com/knative/caching/pkg/apis/caching", "github.com/knative/caching/pkg/client/clientset/versioned", + "github.com/knative/pkg/apis", "github.com/knative/pkg/client/clientset/versioned", "github.com/knative/pkg/configmap", "github.com/knative/pkg/controller", @@ -755,6 +757,7 @@ "github.com/knative/pkg/tracker", "github.com/knative/pkg/webhook", "github.com/knative/test-infra", + "go.opencensus.io/trace", "go.uber.org/zap", "go.uber.org/zap/zaptest/observer", "k8s.io/api/core/v1", @@ -767,6 +770,7 @@ "k8s.io/apimachinery/pkg/runtime/serializer", "k8s.io/apimachinery/pkg/types", "k8s.io/apimachinery/pkg/util/sets/types", + "k8s.io/apimachinery/pkg/util/wait", "k8s.io/apimachinery/pkg/watch", "k8s.io/client-go/discovery", "k8s.io/client-go/discovery/fake", diff --git a/README.md b/README.md index 3ae64b7e2ae..187af3ebce2 100644 --- a/README.md +++ b/README.md @@ -144,8 +144,11 @@ as inputs and outputs of a `TaskRun`. * `Resources` is created directly in a pipeline configuration and bound to `TaskRun` as an input and/or output source. -* The (optional) `passedConstraint` key on an `input source` defines a set of previous task names. -* When the `passedConstraint` key is specified on an input source, only the version of +* The (optional) `passedConstraints` key on an `input source` defines a set of previous task names. +* When the `passedConstraints` key is specified on an input source, only the version of the resource that passed through the defined list of tasks is used. -* The `passedConstraint` allows for `Tasks` to fan in and fan out, and ordering can be expressed explicitly +* The `passedConstraints` allows for `Tasks` to fan in and fan out, and ordering can be expressed explicitly using this key since a task needing a resource from a another task would have to run after. + +See [docs/pipeline-resources.md](./docs/pipeline-resources.md) for more detail about tyeps +of `Resources`. \ No newline at end of file diff --git a/examples/README.md b/examples/README.md index 45e3e82c5c5..352759d96ee 100644 --- a/examples/README.md +++ b/examples/README.md @@ -3,11 +3,11 @@ This directory contains examples of [the Pipeline CRDs](../README.md) in action. To deploy them to your cluster (after -[installing the CRDs and running the controller](../DEVELOPMENT.md#installing-andrunning)): +[installing the CRDs and running the controller](../DEVELOPMENT.md#getting-started)): ```bash -kubectl apply -f examples/pipelines kubectl apply -f examples/ +kubectl apply -f examples/pipelines kubectl apply -f examples/invocations ``` diff --git a/examples/deploy_tasks.yaml b/examples/deploy_tasks.yaml index fe55a3cb947..4a7e3f3848f 100644 --- a/examples/deploy_tasks.yaml +++ b/examples/deploy_tasks.yaml @@ -16,12 +16,12 @@ spec: - name: image value: string cluster: - - name: clusterName + - name: targetCluster buildSpec: steps: - name: deploy image: kubernetes-helm - args: ['deploy', '--path=${pathToHelmChart}', '--set image=${image}', '${helmArgs}'] + args: ['install', '--kube-context=${targetCluster}', '--set image=${image}', '${helmArgs}', '${pathToHelmChart}'] --- apiVersion: pipeline.knative.dev/v1alpha1 diff --git a/examples/invocations/run-kritis-test.yaml b/examples/invocations/run-kritis-test.yaml index 33da1b6c8c9..11a6eb66428 100644 --- a/examples/invocations/run-kritis-test.yaml +++ b/examples/invocations/run-kritis-test.yaml @@ -9,31 +9,19 @@ spec: name: make trigger: triggerRef: - type: manual + type: PipelineRun + name: kritis-pipeline-run-12321312984 + pipelineParamsRef: + name: pipelineparams-sample inputs: - sources: - - name: 'kritis' - type: 'github' - url: 'github.com/grafeas/kritis' - branch: 'featureX' - commit: 'HEAD' + resourcesVersion: + - resourceRef: + name: kritis-resources-git + version: 4da79b91e8e37ea441cfe4972565e2184c1a127f params: - name: 'makeTarget' type: 'string' value: 'test' - results: - runs: - name: 'runsBucket' - type: 'gcs' - url: 'gcs://somebucket/results/runs' - logs: - name: 'logBucket' - type: 'gcs' - url: 'gcs://somebucket/results/logs' - tests: - name: 'testBucket' - type: 'gcs' - url: 'gcs://somebucket/results/tests' status: steps: - name: make diff --git a/examples/pipelines/guestbook.yaml b/examples/pipelines/guestbook.yaml index 5871d481ac2..67bb5f02663 100644 --- a/examples/pipelines/guestbook.yaml +++ b/examples/pipelines/guestbook.yaml @@ -45,21 +45,21 @@ spec: key: workspace resourceRef: name: guestbook-resources-git - passedConstraint: + passedConstraints: - build-guestbook - build-redis - name: workspace key: redis-docker resourceRef: name: guestbook-resources-redis-docker - passedConstraint: + passedConstraints: - build-push params: - name: pathToFiles value: guestbook/all-in-one/guestbook-all-in-one.yaml clusterBindings: - - inputName: test - key: test + - inputName: clusterName + key: testCluster - name: int-test-osx # 3.a Run Integration tests for osx taskRef: name: integrationTestInDocker @@ -68,7 +68,7 @@ spec: key: workspace resourceRef: name: guestbook-resources-git - passedConstraint: + passedConstraints: - deploy-bundle-test params: - name: dockerBuildFile @@ -81,7 +81,7 @@ spec: key: workspace resourceRef: name: guestbook-resources-git - passedConstraint: + passedConstraints: - deploy-bundle-test params: - name: dockerBuildFile @@ -94,12 +94,12 @@ spec: key: workspace resourceRef: name: guestbook-resources-git - passedConstraint: + passedConstraints: - int-test-osx - int-test-linux params: - name: pathToFiles value: guestbook/all-in-one/guestbook-all-in-one.yaml clusterBindings: - - inputName: staging - key: staging \ No newline at end of file + - inputName: targetCluster + key: stagingCluster \ No newline at end of file diff --git a/examples/pipelines/kritis.yaml b/examples/pipelines/kritis.yaml index 9fd5a0d8997..0b688c3b3eb 100644 --- a/examples/pipelines/kritis.yaml +++ b/examples/pipelines/kritis.yaml @@ -24,7 +24,7 @@ spec: key: workspace # bind to the name in the task resourceRef: name: kritis-resources-git - passedConstraint: + passedConstraints: - unit-test-make outputSourceBindings: - name: kritisImage @@ -42,13 +42,13 @@ spec: key: workspace resourceRef: name: kritis-resources-image - passedConstraint: [build-push] + passedConstraints: [build-push] params: - name: pathToHelmCharts value: kritis-charts clusterBindings: - - inputName: test - key: test + - inputName: targetCluster + key: testCluster - name: integration-test # 4. Run Integration Tests in test cluster taskRef: name: integration-test-in-docker @@ -57,7 +57,7 @@ spec: key: workspace resourceRef: name: kritis-resources-test-git - passedConstraint: [deploy-with-helm] + passedConstraints: [deploy-with-helm] params: - name: testArgs value: "-e REMOTE_INTEGRATION=true" diff --git a/examples/smoke-test.sh b/examples/smoke-test.sh new file mode 100755 index 00000000000..b9fe6228f90 --- /dev/null +++ b/examples/smoke-test.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Copyright 2018 The Knative 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. + +# smoke_test.sh will attempt to deploy all of the example CRDs to whatever +# is the current kubectl cluster context. +# It will not wait for any Runs to complete and instead will destroy the CRDs +# immediately after creation, so at the moment this pretty much just makes +# sure the structure is valid (and this might even have weird side effects..). + +set -o xtrace +set -o errexit +set -o pipefail + +kubectl apply -f examples/ +kubectl apply -f examples/pipelines +kubectl apply -f examples/invocations + +sleep 5 + +kubectl delete -f examples/invocations +kubectl delete -f examples/pipelines +kubectl delete -f examples/ \ No newline at end of file diff --git a/pkg/apis/pipeline/v1alpha1/pipeline_types.go b/pkg/apis/pipeline/v1alpha1/pipeline_types.go index e246032802c..d8409557bf0 100644 --- a/pkg/apis/pipeline/v1alpha1/pipeline_types.go +++ b/pkg/apis/pipeline/v1alpha1/pipeline_types.go @@ -67,6 +67,9 @@ type PipelineTask struct { InputSourceBindings []SourceBinding `json:"inputSourceBindings,omitempty"` // +optional OutputSourceBindings []SourceBinding `json:"outputSourceBindings,omitempty"` + // TODO(#68) Cluster should become a type of Resource + // +optional + ClusterBindings []ClusterBinding `json:"clusterBindings,omitempty"` // +optional Params []Param `json:"params,omitempty"` } diff --git a/pkg/apis/pipeline/v1alpha1/resource_types.go b/pkg/apis/pipeline/v1alpha1/resource_types.go index e049acc0065..748fa9ee1f2 100644 --- a/pkg/apis/pipeline/v1alpha1/resource_types.go +++ b/pkg/apis/pipeline/v1alpha1/resource_types.go @@ -57,6 +57,16 @@ type PipelineResourceSpec struct { Params []Param `json:"params"` } +// TaskResource defines an input or output Resource declared as a requirement +// by a Task. The Name field will be used to refer to these Resources within +// the Task definition, and when provided as an Input, the Name will be the +// path to the volume mounted containing this Resource as an input (e.g. +// an input Resource named `workspace` will be mounted at `/workspace`). +type TaskResource struct { + Name string `json:"name"` + Type PipelineResourceType `json:"type"` +} + // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/pipeline/v1alpha1/task_types.go b/pkg/apis/pipeline/v1alpha1/task_types.go index 01e545fc81f..6079a67f487 100644 --- a/pkg/apis/pipeline/v1alpha1/task_types.go +++ b/pkg/apis/pipeline/v1alpha1/task_types.go @@ -26,7 +26,7 @@ type TaskSpec struct { // +optional Inputs *Inputs `json:"inputs,omitempty"` // +optional - Outputs *Outputs `json:"outputs,omitempty"` + Outputs *Outputs `json:"outputs,omitempty"` BuildSpec buildv1alpha1.BuildSpec `json:"buildSpec"` } @@ -57,27 +57,14 @@ type Task struct { // Inputs are the requirements that a task needs to run a Build. type Inputs struct { // +optional - Sources []Source `json:"resources,omitempty"` + Resources []TaskResource `json:"resources,omitempty"` // +optional Params []Param `json:"params,omitempty"` + // TODO(#68) a cluster and/or deployment should be a type of Resource // +optional Clusters []Cluster `json:"clusters,omitempty"` } -// Source is data which is required by a Build/Task for context -// (e.g. a repo from which to build an image). The name of the input will be -// used as the name of the volume containing this context which will be mounted -// into the container executed by the Build/Task, e.g. a Source with the -// name "workspace" would be mounted into "/workspace". -// -// TODO(#62): Something is wrong here, this should be a reference to a resource, -// could just be that the names and comments are out of date. -type Source struct { - // name of the source should match the name of the SourceBinding in the pipeline - Name string `json:"name"` - Type PipelineResourceType `json:"type"` -} - // Param defines arbitrary parameters needed by a task beyond typed inputs // such as resources. type Param struct { @@ -91,7 +78,7 @@ type Outputs struct { // +optional Results []TestResult `json:"results,omitempty"` // +optional - Sources []Source `json:"resources,omitempty"` + Resources []TaskResource `json:"resources,omitempty"` } // TestResult allows a task to specify the location where test logs diff --git a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go index 4ad4524fdf8..93194ba9ead 100644 --- a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go @@ -91,9 +91,9 @@ func (in *ImageResource) DeepCopy() *ImageResource { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Inputs) DeepCopyInto(out *Inputs) { *out = *in - if in.Sources != nil { - in, out := &in.Sources, &out.Sources - *out = make([]Source, len(*in)) + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]TaskResource, len(*in)) copy(*out, *in) } if in.Params != nil { @@ -127,9 +127,9 @@ func (in *Outputs) DeepCopyInto(out *Outputs) { *out = make([]TestResult, len(*in)) copy(*out, *in) } - if in.Sources != nil { - in, out := &in.Sources, &out.Sources - *out = make([]Source, len(*in)) + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]TaskResource, len(*in)) copy(*out, *in) } return @@ -671,6 +671,11 @@ func (in *PipelineTask) DeepCopyInto(out *PipelineTask) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.ClusterBindings != nil { + in, out := &in.ClusterBindings, &out.ClusterBindings + *out = make([]ClusterBinding, len(*in)) + copy(*out, *in) + } if in.Params != nil { in, out := &in.Params, &out.Params *out = make([]Param, len(*in)) @@ -780,22 +785,6 @@ func (in *Results) DeepCopy() *Results { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Source) DeepCopyInto(out *Source) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Source. -func (in *Source) DeepCopy() *Source { - if in == nil { - return nil - } - out := new(Source) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SourceBinding) DeepCopyInto(out *SourceBinding) { *out = *in @@ -911,6 +900,22 @@ func (in *TaskRef) DeepCopy() *TaskRef { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskResource) DeepCopyInto(out *TaskResource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskResource. +func (in *TaskResource) DeepCopy() *TaskResource { + if in == nil { + return nil + } + out := new(TaskResource) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TaskRun) DeepCopyInto(out *TaskRun) { *out = *in diff --git a/samples/README.md b/samples/README.md deleted file mode 100644 index 9bcb134dd75..00000000000 --- a/samples/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Samples - -These are samples to demonstrate how the Pipeline CRD is intended to work. - -These samples are also duplicated in Go in the type tests in [./pkg/apis/pipeline/vqalpha1](./pkg/apis/pipeline/v1alpha1), -if updating these samples please update the tests too. - -This includes samples of: - -* [A pipeline](pipeline_v1alpha1_pipeline.yaml) -* [A task used in that pipeline](pipeline_v1alpha1_task.yaml) -* [Parameters to the pipeline](pipeline_v1alpha1_pipelineparams.yaml) \ No newline at end of file diff --git a/samples/pipeline_v1alpha1_pipeline.yaml b/samples/pipeline_v1alpha1_pipeline.yaml deleted file mode 100644 index 0a105ce1f72..00000000000 --- a/samples/pipeline_v1alpha1_pipeline.yaml +++ /dev/null @@ -1,68 +0,0 @@ -apiVersion: pipeline.knative.dev/v1alpha1 -kind: Pipeline -metadata: - name: wizzbang-pipeline - namespace: default -spec: - tasks: - - name: test - taskRef: - name: test-wizzbang-task - inputsourceBindings: - - name: repoUnderTest - key: workspace - resourceRef: - name: wizzbang-git - - name: buildPush - taskRef: - name: build-push-task - inputSourceBindings: - - name: wizzbangSrc - key: workspace - resourceRef: - name: wizzbang-git - passedConstraint: [test-wizzbang-task] - outputSourceBindings: - - name: wizzbangImage - key: builtImage - resourceRef: - name: wizzbang-image - params: - - name: pathToDockerfile - value: build/Dockerfile - - name: integrationTest - taskRef: - name: integration-test-wizzbang-task - inputSourceBindings: - - name: repoUnderTest - key: wizzbang - resourceRef: - name: wizzbang-git - passedConstraint: [test] - outputSourceBindings: - - name: wizzbangImage - key: builtImage - resourceRef: - name: wizzbang-image - passedConstraint: [build-push-task] - - name: deploy - taskRef: - name: deploy-with-helm - params: - - name: pathToHelmCharts - value: deploy/helm - inputSourceBindings: - - name: wizzbangSrc - key: wizzbang - resourceRef: - name: wizzbang-git - passedConstraint: [integration-test-wizzbang-task] - clusterBindings: - - inputName: prod - key: prod - outputSourceBindings: - - name: wizzbangImage - key: builtImage - resourceRef: - name: wizzbang-image - passedConstraint: [build-push-task] \ No newline at end of file diff --git a/samples/pipeline_v1alpha1_pipelineparams.yaml b/samples/pipeline_v1alpha1_pipelineparams.yaml deleted file mode 100644 index c6c9b4336d6..00000000000 --- a/samples/pipeline_v1alpha1_pipelineparams.yaml +++ /dev/null @@ -1,27 +0,0 @@ -apiVersion: pipeline.knative.dev/v1alpha1 -kind: PipelineParams -metadata: - name: wizzbang-pipeline-params - namespace: default -spec: - serviceAccount: 'wizzbangPipelineServiceAccount' - results: - runs: - name: 'runsBucket' - type: 'gcs' - url: 'gcs://somebucket/results/runs' - token: 'todo' - logs: - name: 'logBucket' - type: 'gcs' - url: 'gcs://somebucket/results/logs' - token: 'todo' - tests: - name: 'testBucket' - type: 'gcs' - url: 'gcs://somebucket/results/tests' - token: 'todo' - clusters: - - name: 'prod' - type: 'gke' - endpoint: 'https://prod.gke.corp.com' \ No newline at end of file diff --git a/samples/pipeline_v1alpha1_pipelinerun.yaml b/samples/pipeline_v1alpha1_pipelinerun.yaml deleted file mode 100644 index 73a6c21abd1..00000000000 --- a/samples/pipeline_v1alpha1_pipelinerun.yaml +++ /dev/null @@ -1,34 +0,0 @@ -apiVersion: pipeline.knative.dev/v1alpha1 -kind: PipelineRun -metadata: - name: wizzbang-pipeline-run-sd8f8dfasdfasdfas - namespace: default -spec: - pipelineRef: - name: wizzbang-pipeline - pipelineParamsRef: - name: wizzbang-pipeline-params - triggerRef: - type: manual -status: - taskRuns: - - taskRef: - name: test-wizzbang-task-run-sd8f8dfasdfasdfas - - taskRef: - name: build-push-task-run-sd8f8dfasdfasdfas - conditions: - - type: Started - status: "True" - lastTransitionTime: "2018-10-04T12:25:39Z" - reason: manualTrigger - message: "Pipeline has been triggered manually" - - type: Completed - status: "True" - lastTransitionTime: "2018-10-04T13:25:39Z" - reason: done - message: "Pipeline execution has finished" - - type: Successful - status: "False" - lastTransitionTime: "2018-10-04T13:25:39Z" - reason: taskFailure - message: "TaskRun `test-wizzbang-build-push-run-sd8f8dfasdfasdfas` had non-zero exit code" \ No newline at end of file diff --git a/samples/pipeline_v1alpha1_resources.yaml b/samples/pipeline_v1alpha1_resources.yaml deleted file mode 100644 index 6837fc6c562..00000000000 --- a/samples/pipeline_v1alpha1_resources.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: pipeline.knative.dev/v1alpha1 -kind: Resource -metadata: - name: wizzbang-git - namespace: default -spec: - type: git - params: - - name: url - value: github.com/wizzbangcorp/wizzbang - - name: revision - value: HEAD ---- -apiVersion: pipeline.knative.dev/v1alpha1 -kind: Resource -metadata: - name: wizzbang-image - namespace: default -spec: - type: image - params: - - name: url - value: gcr.io/wizzbang-staging \ No newline at end of file diff --git a/samples/pipeline_v1alpha1_task.yaml b/samples/pipeline_v1alpha1_task.yaml deleted file mode 100644 index 23d00311882..00000000000 --- a/samples/pipeline_v1alpha1_task.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: pipeline.knative.dev/v1alpha1 -kind: Task -metadata: - name: build-push-task - namespace: default -spec: - inputs: - resources: - - name: workspace - type: git - params: - - name: PATH_TO_DOCKERFILE - value: string - outputs: - resources: - - name: builtImage - buildSpec: - template: - name: kaniko - arguments: - - name: DOCKERFILE - value: ${PATH_TO_DOCKERFILE} - - name: REGISTRY - value: ${REGISTRY} \ No newline at end of file diff --git a/samples/pipeline_v1alpha1_taskrun.yaml b/samples/pipeline_v1alpha1_taskrun.yaml deleted file mode 100644 index 80367da56fc..00000000000 --- a/samples/pipeline_v1alpha1_taskrun.yaml +++ /dev/null @@ -1,59 +0,0 @@ -apiVersion: pipeline.knative.dev/v1alpha1 -kind: TaskRun -metadata: - name: integration-test-wizzbang-task-run-sd8f8dfasdfasdfas - namespace: default -spec: - taskRef: - name: integration-test-wizzbang-task - trigger: - triggerRef: - type: PipelineRun - name: wizzbangPipeline-sd8f8dfasdfasdfas - inputs: - resourcesVersion: - - resourceRef: - name: wizzbang - version: HEAD - params: - - name: 'image' - type: 'string' - value: 'gcr.io/wizzbang-staging/wizzbang@234324k32j432k32l4k2a' - outputs: - artifacts: - - name: builtImage - type: image - results: - runs: - name: 'runsBucket' - type: 'gcs' - url: 'gcs://somebucket/results/runs' - logs: - name: 'logBucket' - type: 'gcs' - url: 'gcs://somebucket/results/logs' - tests: - name: 'testBucket' - type: 'gcs' - url: 'gcs://somebucket/results/tests' -status: - steps: - - name: test - logsURL: 'gcs://somebucket/results/tests/test-wizzbang-task-run-sd8f8dfasdfasdfas/test' - exitCode: 0 - conditions: - - type: Started - status: "True" - lastTransitionTime: "2018-10-04T12:25:39Z" - reason: pipelineRun - message: "Task has been triggered by a Pipeline run" - - type: Completed - status: "True" - lastTransitionTime: "2018-10-04T13:25:39Z" - reason: done - message: "Pipeline execution has finished" - - type: Successful - status: "True" - lastTransitionTime: "2018-10-04T13:25:39Z" - reason: zeroExitCode - message: "All steps completed with an exit code of 0" \ No newline at end of file diff --git a/test/README.md b/test/README.md index 2a3024c454e..022e79a199e 100644 --- a/test/README.md +++ b/test/README.md @@ -84,10 +84,12 @@ pipelineRunsInformer.Informer().GetIndexer().Add(obj) ## Integration tests Integration tests live in this directory. To run these tests, you must provide `go` with -`-tags=e2e`, and you may want to use some of the [common flags](#common-flags): +`-tags=e2e`. By default the tests run agains your current kubeconfig context, + but you can change that and other settings with [the flags](#flags): ```shell go test -v -count=1 -tags=e2e ./test +go test -v -tags=e2e -count=1 ./test --kubeconfig ~/special/kubeconfig --cluster myspecialcluster ``` You can also use @@ -233,6 +235,11 @@ via the sections for `knative/build-pipeline`. ### Running presubmit integration tests +The presubmit integration tests entrypoint will run: + +* [The integration tests](#integration-tests) +* A sanity check deployment of [our example CRDs](../examples) + When run using Prow, integration tests will try to get a new cluster using [boskos](https://github.com/kubernetes/test-infra/tree/master/boskos) and [these hardcoded GKE projects](https://github.com/knative/test-infra/blob/master/ci/prow/boskos/resources.yaml#L15), which only [the `knative/test-infra` OWNERS](https://github.com/knative/test-infra/blob/master/OWNERS) diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index f7164f635f3..f90ecc24dc4 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -84,7 +84,10 @@ set +o xtrace # Wait for pods to be running in the namespaces we are deploying to wait_until_pods_running knative-build-pipeline || fail_test "Pipeline CRD did not come up" -# Actually run the tests +# Run the smoke tests for the examples dir to make sure they are valid +./examples/smoke-test.sh || fail_test + +# Run the integration tests report_go_test \ -v -tags=e2e -count=1 -timeout=20m ./test \ ${options} || fail_test