diff --git a/pkg/apis/addtoscheme_pipeline_v1beta1.go b/pkg/apis/addtoscheme_pipeline_v1beta1.go new file mode 100644 index 00000000000..8f35d4496ac --- /dev/null +++ b/pkg/apis/addtoscheme_pipeline_v1beta1.go @@ -0,0 +1,26 @@ +/* +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. +*/ + +package apis + +import ( + "github.com/knative/build-pipeline/pkg/apis/pipeline/v1beta1" +) + +func init() { + // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back + AddToSchemes = append(AddToSchemes, v1beta1.SchemeBuilder.AddToScheme) +} diff --git a/pkg/apis/apis.go b/pkg/apis/apis.go new file mode 100644 index 00000000000..b5955858802 --- /dev/null +++ b/pkg/apis/apis.go @@ -0,0 +1,33 @@ +/* +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. +*/ + +// Generate deepcopy for apis +//go:generate go run ../../vendor/k8s.io/code-generator/cmd/deepcopy-gen/main.go -O zz_generated.deepcopy -i ./... -h ../../hack/boilerplate.go.txt + +// Package apis contains Kubernetes API groups. +package apis + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +// AddToSchemes may be used to add all resources defined in the project to a Scheme +var AddToSchemes runtime.SchemeBuilder + +// AddToScheme adds all Resources to the Scheme +func AddToScheme(s *runtime.Scheme) error { + return AddToSchemes.AddToScheme(s) +} diff --git a/pkg/apis/pipeline/group.go b/pkg/apis/pipeline/group.go new file mode 100644 index 00000000000..78838add48a --- /dev/null +++ b/pkg/apis/pipeline/group.go @@ -0,0 +1,18 @@ +/* +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. +*/ + +// Package pipeline contains pipeline API versions +package pipeline diff --git a/pkg/apis/pipeline/v1beta1/doc.go b/pkg/apis/pipeline/v1beta1/doc.go new file mode 100644 index 00000000000..892dec8ad9d --- /dev/null +++ b/pkg/apis/pipeline/v1beta1/doc.go @@ -0,0 +1,23 @@ +/* +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. +*/ + +// Package v1beta1 contains API Schema definitions for the pipeline v1beta1 API group +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/knative/build-pipeline/pkg/apis/pipeline +// +k8s:defaulter-gen=TypeMeta +// +groupName=pipeline.knative.dev +package v1beta1 diff --git a/pkg/apis/pipeline/v1beta1/pipeline_types.go b/pkg/apis/pipeline/v1beta1/pipeline_types.go new file mode 100644 index 00000000000..5ac1dda10f9 --- /dev/null +++ b/pkg/apis/pipeline/v1beta1/pipeline_types.go @@ -0,0 +1,115 @@ +/* +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. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PipelineSpec defines the desired state of PipeLine. +type PipelineSpec struct { + Tasks []PipelineTask `json:"tasks"` +} + +// PipelineStatus defines the observed state of Pipeline +type PipelineStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Pipeline describes a DAG of Tasks to execute. It expresses how outputs +// of tasks feed into inputs of subsequent tasks, and how parameters from +// a PipelineParams should be fed into each task. The DAG is constructed +// from the 'prev' and 'next' of each PipelineTask as well as Task dependencies. +// +k8s:openapi-gen=true +type Pipeline struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec PipelineSpec `json:"spec,omitempty"` + Status PipelineStatus `json:"status,omitempty"` +} + +// PipelineTask defines a task in a Pipeline, passing inputs from both +// PipelineParams and from the output of previous tasks. +type PipelineTask struct { + Name string `json:"name"` + TaskRef TaskRef `json:"taskRef"` + SourceBindings []SourceBinding `json:"sourceBindings,omitempty"` + ArtifactStoreBindings []ArtifactStoreBinding `json:"artifactStoreBindings,omitempty"` + Params []PipelineTaskParam `json:"params,omitempty"` + ParamBindings []PipelineTaskParamBinding `json:"paramBindings,omitempty"` + + NextTasks []string `json:"nextTasks,omitempty"` + PrevTasks []string `json:"prevTasks,omitempty"` +} + +// PipelineTaskParamBinding is used to bind the outputs of a Task to the inputs of another Task. +type PipelineTaskParamBinding struct { + InputName string `json:"inputName"` + TaskName string `json:"taskName"` + TaskOutputName string `json:"taskOutputName"` +} + +// PipelineTaskParam is used to provide arbitrary string parameters to a Task. +type PipelineTaskParam struct { + Name string `json:"name"` + Value string `json:"value"` +} + +// SourceBinding is used to bind a Source from a PipelineParams to a source required +// as an input for a task. +type SourceBinding struct { + // InputName is the string the Task will use to identify this source in its inputs. + InputName string `json:"inputName"` + // SourceKey is the string that the PipelineParams will use to identify this source. + SourceKey string `json:"sourceKey"` +} + +// ArtifactStoreBinding is used to bind an ArtifactStore from a PipelineParams to +// artifacts that will be produced as output by a task. +type ArtifactStoreBinding struct { + // InputName is the string the Task will use to identify this source in its outputs. + StoreName string `json:"storeName"` + // StoreKey is the string that the PipelineParams will use to identify this artifact store. + StoreKey string `json:"storeKey"` +} + +// TaskRef can be used to refer to a specific instance of a task. +// Copied from CrossVersionObjectReference: https://github.com/kubernetes/kubernetes/blob/169df7434155cbbc22f1532cba8e0a9588e29ad8/pkg/apis/autoscaling/types.go#L64 +type TaskRef struct { + // Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names + Name string `json:"name"` + // API version of the referent + APIVersion string `json:"apiVersion,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PipelineList contains a list of Pipeline +type PipelineList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Pipeline `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Pipeline{}, &PipelineList{}) +} diff --git a/pkg/apis/pipeline/v1beta1/pipelineparams_types.go b/pkg/apis/pipeline/v1beta1/pipelineparams_types.go new file mode 100644 index 00000000000..00b9dc278d4 --- /dev/null +++ b/pkg/apis/pipeline/v1beta1/pipelineparams_types.go @@ -0,0 +1,131 @@ +/* +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. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PipelineParamsSpec is the spec for a Pipeline resource +type PipelineParamsSpec struct { + ServiceAccount string `json:"serviceAccount"` + Sources []Source `json:"sources"` + ArtifactStores []ArtifactStore `json:"artifactStores"` + Results Results `json:"results"` +} + +// Source is an endpoint from which to get data which is required +// by a Build/Task for context (e.g. a repo from which to build an image). +type Source struct { + Name string `json:"name"` + Type string `json:"type"` + URL string `json:"url"` + Branch string `json:"branch"` + Commit string `json:"commit,omitempty"` + ServiceAccount string `json:"serviceAccount,omitempty"` +} + +// PipelineParamsStatus defines the observed state of PipelineParams +type PipelineParamsStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PipelineParams is the Schema for the pipelineparams API +// +k8s:openapi-gen=true +type PipelineParams struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec PipelineParamsSpec `json:"spec,omitempty"` + Status PipelineParamsStatus `json:"status,omitempty"` +} + +// ArtifactStore defines an endpoint where artifacts can be stored, such as images. +type ArtifactStore struct { + Name string `json:"name"` + // TODO: maybe an enum, with values like 'registry', GCS bucket + Type string `json:"type"` + URL string `json:"url"` +} + +// Results tells a pipeline where to persist the results of runnign the pipeline. +type Results struct { + // Runs is used to store the yaml/json of TaskRuns and PipelineRuns. + // TODO(aaron-prindle) make this generic + // Runs []ResultTarget `json:"name"` + Runs []Run `json:"runs"` + + // Logs will store all logs output from running a task. + // TODO(aaron-prindle) make this generic + // Logs []ResultTarget `json:"type"` + Logs []Log `json:"logs"` + + // Tests will store test results, if a task provides them. + // TODO(aaron-prindle) make this generic + // Tests []ResultTarget `json:"tests,omitempty"` + Tests []Test `json:"tests,omitempty"` +} + +// TODO(aaron-prindle) make this generic +// ResultTarget is used to identify an endpoint where results can be uploaded. The +// serviceaccount used for the pipeline must have access to this endpoint. +// type ResultTarget struct { +// Name string `json:"name"` +// Type string `json:"type"` +// URL string `json:"url"` +// } + +// Run is used to identify an endpoint where results can be uploaded. The +// serviceaccount used for the pipeline must have access to this endpoint. +type Run struct { + Name string `json:"name"` + Type string `json:"type"` + URL string `json:"url"` +} + +// Log is used to identify an endpoint where results can be uploaded. The +// serviceaccount used for the pipeline must have access to this endpoint. +type Log struct { + Name string `json:"name"` + Type string `json:"type"` + URL string `json:"url"` +} + +// Test is used to identify an endpoint where results can be uploaded. The +// serviceaccount used for the pipeline must have access to this endpoint. +type Test struct { + Name string `json:"name"` + Type string `json:"type"` + URL string `json:"url"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PipelineParamsList contains a list of PipelineParams +type PipelineParamsList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []PipelineParams `json:"items"` +} + +func init() { + SchemeBuilder.Register(&PipelineParams{}, &PipelineParamsList{}) +} diff --git a/pkg/apis/pipeline/v1beta1/pipelinerun_types.go b/pkg/apis/pipeline/v1beta1/pipelinerun_types.go new file mode 100644 index 00000000000..d3ca0bcfc9d --- /dev/null +++ b/pkg/apis/pipeline/v1beta1/pipelinerun_types.go @@ -0,0 +1,118 @@ +/* +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. +*/ + +package v1beta1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// PipelineRunSpec defines the desired state of PipelineRun +type PipelineRunSpec struct { + // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +// PipelineRunStatus defines the observed state of PipelineRun +type PipelineRunStatus struct { + TaskRuns []PipelineTaskRun `json:"taskRuns,omitempty"` + Conditions []PipelineRunCondition `json:"conditions"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PipelineRun is the Schema for the pipelineruns API +// +k8s:openapi-gen=true +type PipelineRun struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec PipelineRunSpec `json:"spec,omitempty"` + Status PipelineRunStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PipelineRunList contains a list of PipelineRun +type PipelineRunList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []PipelineRun `json:"items"` +} + +// PipelineTaskRun reports the results of running a step in the Task. Each +// task has the potential to succeed or fail (based on the exit code) +// and produces logs. +type PipelineTaskRun struct { + Name string `json:"name"` +} + +// PipelineTaskRunRef refers to a TaskRun and also indicates which TaskRuns +// executed before and after it. +type PipelineTaskRunRef struct { + TaskRunRef + NextTasks []TaskRunRef `json:"nextTasks"` + PrevTasks []TaskRunRef `json:"prevTasks"` +} + +// TaskRunRef can be used to refer to a specific instance of a TaskRun. +// Copied from CrossVersionObjectReference: https://github.com/kubernetes/kubernetes/blob/169df7434155cbbc22f1532cba8e0a9588e29ad8/pkg/apis/autoscaling/types.go#L64 +type TaskRunRef struct { + // Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names + Name string `json:"name"` + // API version of the referent + APIVersion string `json:"apiVersion,omitempty"` +} + +// PipelineRunConditionType indicates the status of the execution of the PipelineRun. +type PipelineRunConditionType string + +const ( + // PipelineRunConditionTypeStarted indicates whether or not the PipelineRun + // has started actually executing. + PipelineRunConditionTypeStarted PipelineRunConditionType = "Started" + + //PipelineRunConditionTypeCompleted indicates whether or not the PipelineRun + // has finished executing. + PipelineRunConditionTypeCompleted PipelineRunConditionType = "Completed" + + // PipelineRunConditionTypeSucceeded indicates whether or not the PipelineRun + // was successful. + PipelineRunConditionTypeSucceeded PipelineRunConditionType = "Successful" +) + +// PipelineRunCondition holds a Condition that the PipelineRun has entered into while being executed. +type PipelineRunCondition struct { + Type PipelineRunConditionType `json:"type"` + + Status corev1.ConditionStatus `json:"status"` + + // TODO(bobcatfish): when I use `metav1.Time` here I can't figure out + // how to serialize :( + LastTransitionTime string `json:"lastTransitionTime"` + + Reason string `json:"reason,omitempty"` + Message string `json:"message,omitempty"` +} + +func init() { + SchemeBuilder.Register(&PipelineRun{}, &PipelineRunList{}) +} diff --git a/pkg/apis/pipeline/v1beta1/register.go b/pkg/apis/pipeline/v1beta1/register.go new file mode 100644 index 00000000000..ad2849a0425 --- /dev/null +++ b/pkg/apis/pipeline/v1beta1/register.go @@ -0,0 +1,38 @@ +/* +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. +*/ + +// NOTE: Boilerplate only. Ignore this file. + +// Package v1beta1 contains API Schema definitions for the pipeline v1beta1 API group +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/knative/build-pipeline/pkg/apis/pipeline +// +k8s:defaulter-gen=TypeMeta +// +groupName=pipeline.knative.dev +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/runtime/scheme" +) + +var ( + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: "pipeline.knative.dev", Version: "v1beta1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} +) diff --git a/pkg/apis/pipeline/v1beta1/sanity_test.go b/pkg/apis/pipeline/v1beta1/sanity_test.go new file mode 100644 index 00000000000..cf1467001f4 --- /dev/null +++ b/pkg/apis/pipeline/v1beta1/sanity_test.go @@ -0,0 +1,186 @@ +/* +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. +*/ + +package v1beta1 + +import ( + "log" + "os" + "path/filepath" + "reflect" + "testing" + + "github.com/knative/build-pipeline/test" + "golang.org/x/net/context" + runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/kubernetes/scheme" + "k8s.io/client-go/rest" + controllerClient "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/envtest" +) + +var client controllerClient.Client + +const namespace = "default" + +// assertResourceIsEuqal will retrive the resource with the name name into the fetched object +// and compare that value to expected. +func assertResourceIsEqual(t *testing.T, name string, expected, fetched runtime.Object) { + t.Helper() + + key := types.NamespacedName{Name: name, Namespace: namespace} + + c := context.Background() + if err := client.Get(c, key, fetched); err != nil { + t.Errorf("Couldn't retreive created resource %s from namespace %s: %s", name, namespace, err) + } + + if !reflect.DeepEqual(fetched, expected) { + t.Errorf("Fetched resource was different from created resource. Fetched: %v. Expected: %v.", fetched, expected) + } +} + +// createResource will load the resource at fileName into the object created. It will retrieve the +// object using name into fetched and assert that the retrieved object is equal to the one created. +func createResource(t *testing.T, fileName, name string, created, fetched runtime.Object) { + t.Helper() + + if err := test.DecodeTypeFromYamlSample(fileName, created); err != nil { + t.Fatalf("couldn't load resource from %s: %s", fileName, err) + } + + // Create the resource + c := context.Background() + if err := client.Create(c, created); err != nil { + t.Fatalf("Controller failed to create resource from %s: %s", fileName, err) + } + + // Retreive it + assertResourceIsEqual(t, name, created, fetched) +} + +// updateResoruce will update the resource with the name name to the values in updated, the retrieve +// name into expected and assert that the values match updated. +func updateResource(t *testing.T, name string, updated, fetched runtime.Object) { + c := context.Background() + + if err := client.Update(c, updated); err != nil { + t.Errorf("Failed to update resource %s: %s", name, err) + } + assertResourceIsEqual(t, name, updated, fetched) +} + +// deleteResource will delete resource, then try to retrieve it via the name ane assert that this fails. +func deleteResource(t *testing.T, name string, resource runtime.Object) { + c := context.Background() + + if err := client.Delete(c, resource); err != nil { + t.Fatalf("Failed to delete resource %s: %s", name, err) + } + + // It should no longer exist + key := types.NamespacedName{Name: name, Namespace: namespace} + err := client.Get(c, key, resource) + if err == nil { + t.Fatalf("Expected to get an error retrieving deleted resource %s", name) + } +} + +func TestMain(m *testing.M) { + var cfg *rest.Config + + t := &envtest.Environment{ + CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "..", "config", "crds")}, + } + + err := SchemeBuilder.AddToScheme(scheme.Scheme) + if err != nil { + log.Fatal(err) + } + + if cfg, err = t.Start(); err != nil { + log.Fatal(err) + } + + if client, err = controllerClient.New(cfg, controllerClient.Options{Scheme: scheme.Scheme}); err != nil { + log.Fatal(err) + } + + code := m.Run() + t.Stop() + os.Exit(code) +} + +func TestPipeline(t *testing.T) { + created, fetched := &Pipeline{}, &Pipeline{} + + createResource(t, test.PipelineFile, test.PipelineName, created, fetched) + + updated := created.DeepCopy() + updated.Labels = map[string]string{"hello": "world"} + updateResource(t, test.PipelineName, updated, fetched) + + deleteResource(t, test.PipelineName, created) +} + +func TestPipelineParams(t *testing.T) { + created, fetched := &PipelineParams{}, &PipelineParams{} + + createResource(t, test.PipelineParamsFile, test.PipelineParamsName, created, fetched) + + updated := created.DeepCopy() + updated.Labels = map[string]string{"hello": "world"} + updateResource(t, test.PipelineParamsName, updated, fetched) + + deleteResource(t, test.PipelineParamsName, created) +} + +func TestPipelineRun(t *testing.T) { + created, fetched := &PipelineRun{}, &PipelineRun{} + + createResource(t, test.PipelineRunFile, test.PipelineRunName, created, fetched) + + updated := created.DeepCopy() + updated.Labels = map[string]string{"hello": "world"} + updateResource(t, test.PipelineRunName, updated, fetched) + + deleteResource(t, test.PipelineRunName, created) +} + +func TestTask(t *testing.T) { + created, fetched := &Task{}, &Task{} + + createResource(t, test.TaskFile, test.TaskName, created, fetched) + + updated := created.DeepCopy() + updated.Labels = map[string]string{"hello": "world"} + updateResource(t, test.TaskName, updated, fetched) + + deleteResource(t, test.TaskName, created) +} + +func TestTaskRun(t *testing.T) { + created, fetched := &TaskRun{}, &TaskRun{} + + createResource(t, test.TaskRunFile, test.TaskRunName, created, fetched) + + updated := created.DeepCopy() + updated.Labels = map[string]string{"hello": "world"} + updateResource(t, test.TaskRunName, updated, fetched) + + deleteResource(t, test.TaskRunName, created) +} diff --git a/pkg/apis/pipeline/v1beta1/task_types.go b/pkg/apis/pipeline/v1beta1/task_types.go new file mode 100644 index 00000000000..28a8ee7fa5d --- /dev/null +++ b/pkg/apis/pipeline/v1beta1/task_types.go @@ -0,0 +1,116 @@ +/* +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. +*/ + +package v1beta1 + +import ( + buildv1alpha1 "github.com/knative/build/pkg/apis/build/v1alpha1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// TaskSpec defines the desired state of Task +type TaskSpec struct { + Inputs Inputs `json:"inputs,omitempty"` + Outputs Outputs `json:"outputs,omitempty"` + BuildSpec BuildSpec `json:"buildSpec"` +} + +// TaskStatus defines the observed state of Task +type TaskStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Task is the Schema for the tasks API +// +k8s:openapi-gen=true +type Task struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec TaskSpec `json:"spec,omitempty"` + Status TaskStatus `json:"status,omitempty"` +} + +// Inputs are the requirements that a task needs to run a Build. +type Inputs struct { + Sources []SourceInput `json:"sources,omitempty"` + Params []Param `json:"params,omitempty"` +} + +// SourceInput 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 SourceInput with the +// name "workspace" would be mounted into "/workspace". +type SourceInput struct { + Name string `json:"name"` +} + +// Param defines arbitrary parameters needed by a task beyond typed inputs +// such as Sources. +type Param struct { + Name string `json:"name"` + Type string `json:"type"` +} + +// Outputs allow a task to declare what data the Build/Task will be producing, +// i.e. results such as logs and artifacts such as images. +type Outputs struct { + Results []TestResult `json:"results,omitempty"` + Artifacts []Artifact `json:"artifacts,omitempty"` +} + +// TestResult allows a task to specify the location where test logs +// can be found and what format they will be in. +type TestResult struct { + Name string `json:"name"` + // TODO: maybe this is an enum with types like "go test", "junit", etc. + Format string `json:"format"` + Path string `json:"path"` +} + +// Artifact allows a Task to describe what artifacts it will be producing +// and specify where they will be stored. +type Artifact struct { + Name string `json:"name"` + Type string `json:"type"` + StoreKey string `json:"storeKey"` +} + +// BuildSpec describes how to create a Build for this Task. +// A BuildSpec will contain either a Template or a series of Steps. +type BuildSpec struct { + // Trying to emulate https://github.com/knative/build/blob/master/pkg/apis/build/v1alpha1/build_types.go + Steps []corev1.Container `json:"steps,omitempty"` + Template buildv1alpha1.TemplateInstantiationSpec `json:"template,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TaskList contains a list of Task +type TaskList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Task `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Task{}, &TaskList{}) +} diff --git a/pkg/apis/pipeline/v1beta1/taskrun_types.go b/pkg/apis/pipeline/v1beta1/taskrun_types.go new file mode 100644 index 00000000000..0b585271c30 --- /dev/null +++ b/pkg/apis/pipeline/v1beta1/taskrun_types.go @@ -0,0 +1,127 @@ +/* +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. +*/ + +package v1beta1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// TaskRunSpec defines the desired state of TaskRun +type TaskRunSpec struct { + TaskRef TaskRef `json:"taskRef"` + Trigger Trigger `json:"trigger"` + Inputs TaskRunInputs `json:"inputs,omitempty"` + Outputs Outputs `json:"outputs,omitempty"` + Results Results `json:"results"` +} + +// TaskRunInputs holds the input values that this task was invoked with. +type TaskRunInputs struct { + Sources []Source `json:"sources"` + Params []Param `json:"params,omitempty"` +} + +// Trigger defines a webhook style trigger to start a TaskRun +type Trigger struct { + TriggerRef TriggerRef `json:"triggerRef"` + PrevTasks []string `json:"prevTasks,omitempty"` + NextTasks []string `json:"nextTasks,omitempty"` +} + +// TriggerRef describes what triggered this Task. It could be triggered manually, +// or it may have been part of a PipelineRun in which case this ref would refer +// to the corresponding PipelineRun. +type TriggerRef struct { + Type string `json:"type"` + Name string `json:"name,omitempty"` +} + +// TaskRunStatus defines the observed state of TaskRun +type TaskRunStatus struct { + Steps []StepRun `json:"steps"` + Conditions []TaskRunCondition `json:"conditions"` +} + +// StepRun reports the results of running a step in the Task. Each +// task has the potential to succeed or fail (based on the exit code) +// and produces logs. +type StepRun struct { + Name string `json:"name"` + LogsURL string `json:"logsURL"` + ExitCode int `json:"exitCode"` +} + +// TaskRunConditionType indicates the status of the execution of the TaskRun. +type TaskRunConditionType string + +const ( + // TaskRunConditionTypeStarted indicates whether or not the TaskRun + // has started actually executing. + TaskRunConditionTypeStarted TaskRunConditionType = "Started" + + //TaskRunConditionTypeCompleted indicates whether or not the TaskRun + // has finished executing. + TaskRunConditionTypeCompleted TaskRunConditionType = "Completed" + + // TaskRunConditionTypeSucceeded indicates whether or not the TaskRun + // was successful. + TaskRunConditionTypeSucceeded TaskRunConditionType = "Successful" +) + +// TaskRunCondition holds a Condition that the TaskRun has entered into while being executed. +type TaskRunCondition struct { + Type TaskRunConditionType `json:"type"` + + Status corev1.ConditionStatus `json:"status"` + + // TODO(bobcatfish): when I use `metav1.Time` here I can't figure out + // how to serialize :( + LastTransitionTime string `json:"lastTransitionTime"` + + Reason string `json:"reason,omitempty"` + Message string `json:"message,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TaskRun is the Schema for the taskruns API +// +k8s:openapi-gen=true +type TaskRun struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec TaskRunSpec `json:"spec,omitempty"` + Status TaskRunStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TaskRunList contains a list of TaskRun +type TaskRunList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []TaskRun `json:"items"` +} + +func init() { + SchemeBuilder.Register(&TaskRun{}, &TaskRunList{}) +} diff --git a/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..711bab710f7 --- /dev/null +++ b/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go @@ -0,0 +1,1090 @@ +// +build !ignore_autogenerated + +/* +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. +*/ +// Code generated by main. DO NOT EDIT. + +package v1beta1 + +import ( + v1 "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Artifact) DeepCopyInto(out *Artifact) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Artifact. +func (in *Artifact) DeepCopy() *Artifact { + if in == nil { + return nil + } + out := new(Artifact) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ArtifactStore) DeepCopyInto(out *ArtifactStore) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArtifactStore. +func (in *ArtifactStore) DeepCopy() *ArtifactStore { + if in == nil { + return nil + } + out := new(ArtifactStore) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ArtifactStoreBinding) DeepCopyInto(out *ArtifactStoreBinding) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArtifactStoreBinding. +func (in *ArtifactStoreBinding) DeepCopy() *ArtifactStoreBinding { + if in == nil { + return nil + } + out := new(ArtifactStoreBinding) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BuildSpec) DeepCopyInto(out *BuildSpec) { + *out = *in + if in.Steps != nil { + in, out := &in.Steps, &out.Steps + *out = make([]v1.Container, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.Template.DeepCopyInto(&out.Template) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BuildSpec. +func (in *BuildSpec) DeepCopy() *BuildSpec { + if in == nil { + return nil + } + out := new(BuildSpec) + in.DeepCopyInto(out) + return out +} + +// 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([]SourceInput, len(*in)) + copy(*out, *in) + } + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make([]Param, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Inputs. +func (in *Inputs) DeepCopy() *Inputs { + if in == nil { + return nil + } + out := new(Inputs) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Log) DeepCopyInto(out *Log) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Log. +func (in *Log) DeepCopy() *Log { + if in == nil { + return nil + } + out := new(Log) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Outputs) DeepCopyInto(out *Outputs) { + *out = *in + if in.Results != nil { + in, out := &in.Results, &out.Results + *out = make([]TestResult, len(*in)) + copy(*out, *in) + } + if in.Artifacts != nil { + in, out := &in.Artifacts, &out.Artifacts + *out = make([]Artifact, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Outputs. +func (in *Outputs) DeepCopy() *Outputs { + if in == nil { + return nil + } + out := new(Outputs) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Param) DeepCopyInto(out *Param) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Param. +func (in *Param) DeepCopy() *Param { + if in == nil { + return nil + } + out := new(Param) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Pipeline) DeepCopyInto(out *Pipeline) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pipeline. +func (in *Pipeline) DeepCopy() *Pipeline { + if in == nil { + return nil + } + out := new(Pipeline) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Pipeline) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineList) DeepCopyInto(out *PipelineList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Pipeline, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineList. +func (in *PipelineList) DeepCopy() *PipelineList { + if in == nil { + return nil + } + out := new(PipelineList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PipelineList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineParams) DeepCopyInto(out *PipelineParams) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineParams. +func (in *PipelineParams) DeepCopy() *PipelineParams { + if in == nil { + return nil + } + out := new(PipelineParams) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PipelineParams) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineParamsList) DeepCopyInto(out *PipelineParamsList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PipelineParams, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineParamsList. +func (in *PipelineParamsList) DeepCopy() *PipelineParamsList { + if in == nil { + return nil + } + out := new(PipelineParamsList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PipelineParamsList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineParamsSpec) DeepCopyInto(out *PipelineParamsSpec) { + *out = *in + if in.Sources != nil { + in, out := &in.Sources, &out.Sources + *out = make([]Source, len(*in)) + copy(*out, *in) + } + if in.ArtifactStores != nil { + in, out := &in.ArtifactStores, &out.ArtifactStores + *out = make([]ArtifactStore, len(*in)) + copy(*out, *in) + } + in.Results.DeepCopyInto(&out.Results) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineParamsSpec. +func (in *PipelineParamsSpec) DeepCopy() *PipelineParamsSpec { + if in == nil { + return nil + } + out := new(PipelineParamsSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineParamsStatus) DeepCopyInto(out *PipelineParamsStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineParamsStatus. +func (in *PipelineParamsStatus) DeepCopy() *PipelineParamsStatus { + if in == nil { + return nil + } + out := new(PipelineParamsStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineRun) DeepCopyInto(out *PipelineRun) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineRun. +func (in *PipelineRun) DeepCopy() *PipelineRun { + if in == nil { + return nil + } + out := new(PipelineRun) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PipelineRun) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineRunCondition) DeepCopyInto(out *PipelineRunCondition) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineRunCondition. +func (in *PipelineRunCondition) DeepCopy() *PipelineRunCondition { + if in == nil { + return nil + } + out := new(PipelineRunCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineRunList) DeepCopyInto(out *PipelineRunList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PipelineRun, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineRunList. +func (in *PipelineRunList) DeepCopy() *PipelineRunList { + if in == nil { + return nil + } + out := new(PipelineRunList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PipelineRunList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineRunSpec) DeepCopyInto(out *PipelineRunSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineRunSpec. +func (in *PipelineRunSpec) DeepCopy() *PipelineRunSpec { + if in == nil { + return nil + } + out := new(PipelineRunSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineRunStatus) DeepCopyInto(out *PipelineRunStatus) { + *out = *in + if in.TaskRuns != nil { + in, out := &in.TaskRuns, &out.TaskRuns + *out = make([]PipelineTaskRun, len(*in)) + copy(*out, *in) + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]PipelineRunCondition, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineRunStatus. +func (in *PipelineRunStatus) DeepCopy() *PipelineRunStatus { + if in == nil { + return nil + } + out := new(PipelineRunStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineSpec) DeepCopyInto(out *PipelineSpec) { + *out = *in + if in.Tasks != nil { + in, out := &in.Tasks, &out.Tasks + *out = make([]PipelineTask, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineSpec. +func (in *PipelineSpec) DeepCopy() *PipelineSpec { + if in == nil { + return nil + } + out := new(PipelineSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineStatus) DeepCopyInto(out *PipelineStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineStatus. +func (in *PipelineStatus) DeepCopy() *PipelineStatus { + if in == nil { + return nil + } + out := new(PipelineStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineTask) DeepCopyInto(out *PipelineTask) { + *out = *in + out.TaskRef = in.TaskRef + if in.SourceBindings != nil { + in, out := &in.SourceBindings, &out.SourceBindings + *out = make([]SourceBinding, len(*in)) + copy(*out, *in) + } + if in.ArtifactStoreBindings != nil { + in, out := &in.ArtifactStoreBindings, &out.ArtifactStoreBindings + *out = make([]ArtifactStoreBinding, len(*in)) + copy(*out, *in) + } + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make([]PipelineTaskParam, len(*in)) + copy(*out, *in) + } + if in.ParamBindings != nil { + in, out := &in.ParamBindings, &out.ParamBindings + *out = make([]PipelineTaskParamBinding, len(*in)) + copy(*out, *in) + } + if in.NextTasks != nil { + in, out := &in.NextTasks, &out.NextTasks + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PrevTasks != nil { + in, out := &in.PrevTasks, &out.PrevTasks + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineTask. +func (in *PipelineTask) DeepCopy() *PipelineTask { + if in == nil { + return nil + } + out := new(PipelineTask) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineTaskParam) DeepCopyInto(out *PipelineTaskParam) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineTaskParam. +func (in *PipelineTaskParam) DeepCopy() *PipelineTaskParam { + if in == nil { + return nil + } + out := new(PipelineTaskParam) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineTaskParamBinding) DeepCopyInto(out *PipelineTaskParamBinding) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineTaskParamBinding. +func (in *PipelineTaskParamBinding) DeepCopy() *PipelineTaskParamBinding { + if in == nil { + return nil + } + out := new(PipelineTaskParamBinding) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineTaskRun) DeepCopyInto(out *PipelineTaskRun) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineTaskRun. +func (in *PipelineTaskRun) DeepCopy() *PipelineTaskRun { + if in == nil { + return nil + } + out := new(PipelineTaskRun) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineTaskRunRef) DeepCopyInto(out *PipelineTaskRunRef) { + *out = *in + out.TaskRunRef = in.TaskRunRef + if in.NextTasks != nil { + in, out := &in.NextTasks, &out.NextTasks + *out = make([]TaskRunRef, len(*in)) + copy(*out, *in) + } + if in.PrevTasks != nil { + in, out := &in.PrevTasks, &out.PrevTasks + *out = make([]TaskRunRef, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineTaskRunRef. +func (in *PipelineTaskRunRef) DeepCopy() *PipelineTaskRunRef { + if in == nil { + return nil + } + out := new(PipelineTaskRunRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Results) DeepCopyInto(out *Results) { + *out = *in + if in.Runs != nil { + in, out := &in.Runs, &out.Runs + *out = make([]Run, len(*in)) + copy(*out, *in) + } + if in.Logs != nil { + in, out := &in.Logs, &out.Logs + *out = make([]Log, len(*in)) + copy(*out, *in) + } + if in.Tests != nil { + in, out := &in.Tests, &out.Tests + *out = make([]Test, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Results. +func (in *Results) DeepCopy() *Results { + if in == nil { + return nil + } + out := new(Results) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Run) DeepCopyInto(out *Run) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Run. +func (in *Run) DeepCopy() *Run { + if in == nil { + return nil + } + out := new(Run) + in.DeepCopyInto(out) + 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 + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceBinding. +func (in *SourceBinding) DeepCopy() *SourceBinding { + if in == nil { + return nil + } + out := new(SourceBinding) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SourceInput) DeepCopyInto(out *SourceInput) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceInput. +func (in *SourceInput) DeepCopy() *SourceInput { + if in == nil { + return nil + } + out := new(SourceInput) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StepRun) DeepCopyInto(out *StepRun) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StepRun. +func (in *StepRun) DeepCopy() *StepRun { + if in == nil { + return nil + } + out := new(StepRun) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Task) DeepCopyInto(out *Task) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Task. +func (in *Task) DeepCopy() *Task { + if in == nil { + return nil + } + out := new(Task) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Task) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskList) DeepCopyInto(out *TaskList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Task, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskList. +func (in *TaskList) DeepCopy() *TaskList { + if in == nil { + return nil + } + out := new(TaskList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TaskList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskRef) DeepCopyInto(out *TaskRef) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRef. +func (in *TaskRef) DeepCopy() *TaskRef { + if in == nil { + return nil + } + out := new(TaskRef) + 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 + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRun. +func (in *TaskRun) DeepCopy() *TaskRun { + if in == nil { + return nil + } + out := new(TaskRun) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TaskRun) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskRunCondition) DeepCopyInto(out *TaskRunCondition) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRunCondition. +func (in *TaskRunCondition) DeepCopy() *TaskRunCondition { + if in == nil { + return nil + } + out := new(TaskRunCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskRunInputs) DeepCopyInto(out *TaskRunInputs) { + *out = *in + if in.Sources != nil { + in, out := &in.Sources, &out.Sources + *out = make([]Source, len(*in)) + copy(*out, *in) + } + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make([]Param, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRunInputs. +func (in *TaskRunInputs) DeepCopy() *TaskRunInputs { + if in == nil { + return nil + } + out := new(TaskRunInputs) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskRunList) DeepCopyInto(out *TaskRunList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TaskRun, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRunList. +func (in *TaskRunList) DeepCopy() *TaskRunList { + if in == nil { + return nil + } + out := new(TaskRunList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TaskRunList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskRunRef) DeepCopyInto(out *TaskRunRef) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRunRef. +func (in *TaskRunRef) DeepCopy() *TaskRunRef { + if in == nil { + return nil + } + out := new(TaskRunRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskRunSpec) DeepCopyInto(out *TaskRunSpec) { + *out = *in + out.TaskRef = in.TaskRef + in.Trigger.DeepCopyInto(&out.Trigger) + in.Inputs.DeepCopyInto(&out.Inputs) + in.Outputs.DeepCopyInto(&out.Outputs) + in.Results.DeepCopyInto(&out.Results) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRunSpec. +func (in *TaskRunSpec) DeepCopy() *TaskRunSpec { + if in == nil { + return nil + } + out := new(TaskRunSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskRunStatus) DeepCopyInto(out *TaskRunStatus) { + *out = *in + if in.Steps != nil { + in, out := &in.Steps, &out.Steps + *out = make([]StepRun, len(*in)) + copy(*out, *in) + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]TaskRunCondition, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRunStatus. +func (in *TaskRunStatus) DeepCopy() *TaskRunStatus { + if in == nil { + return nil + } + out := new(TaskRunStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskSpec) DeepCopyInto(out *TaskSpec) { + *out = *in + in.Inputs.DeepCopyInto(&out.Inputs) + in.Outputs.DeepCopyInto(&out.Outputs) + in.BuildSpec.DeepCopyInto(&out.BuildSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskSpec. +func (in *TaskSpec) DeepCopy() *TaskSpec { + if in == nil { + return nil + } + out := new(TaskSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskStatus) DeepCopyInto(out *TaskStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskStatus. +func (in *TaskStatus) DeepCopy() *TaskStatus { + if in == nil { + return nil + } + out := new(TaskStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Test) DeepCopyInto(out *Test) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Test. +func (in *Test) DeepCopy() *Test { + if in == nil { + return nil + } + out := new(Test) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TestResult) DeepCopyInto(out *TestResult) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestResult. +func (in *TestResult) DeepCopy() *TestResult { + if in == nil { + return nil + } + out := new(TestResult) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Trigger) DeepCopyInto(out *Trigger) { + *out = *in + out.TriggerRef = in.TriggerRef + if in.PrevTasks != nil { + in, out := &in.PrevTasks, &out.PrevTasks + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.NextTasks != nil { + in, out := &in.NextTasks, &out.NextTasks + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Trigger. +func (in *Trigger) DeepCopy() *Trigger { + if in == nil { + return nil + } + out := new(Trigger) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TriggerRef) DeepCopyInto(out *TriggerRef) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TriggerRef. +func (in *TriggerRef) DeepCopy() *TriggerRef { + if in == nil { + return nil + } + out := new(TriggerRef) + in.DeepCopyInto(out) + return out +}