From d75b034018d94a8f62b13d70851e47523d033f67 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Wed, 6 Nov 2019 15:19:21 +0100 Subject: [PATCH] wip: introduce v1alpha2 api with auto conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This introduces a new api version `v1alpha2` while still allowing user to use `v1alpha1` API. - Only one version of the CRD can be stored, so `v1alpha1` is the one stored - All the version of the CRD **must** be schema compatible (before 1.16) - `v1alpha1` gets **all** the fields, meaning : - the new ones (from `v1alpha2`, …) - the old deprecated ones (that will be removed from `v1alpha2`) - we may *only* document the "frozen" `v1alpha1` field (and not the new one that are coming from the other api versions) - `kubectl` get returns the highest priority version, aka the most recent one, here `v1alpha2`. To make *sure* any object created from any version are valid (while getting), we convert them using the admission webhook (#blackmagic 🧙). - Object created using `v1alpha1` API will automatically be converted (see below) - This has the downsize of not being able to `get` v1alpha1 object anymore (although it should be possible using the `client-go` and some even more #blackmagic 🧙 hack on the webhook side probably) - One benefit of this approach (`apis.Convertible`) is that once we *only* support 1.16 (the release with conversion webhook), this will be usable almost as is (for the conversion webhook) 👼. This is done in a quick and dirty way: - Lot's of code is duplicated where it would not be needed, it was just quicker to do so at that point in time - I completely skipped the *variable interpolation* validation for `Parameters` as those values would/will need to be automatically transformed too (but it was a bit complicated for what I wanted to experiment on) - I did not implement the **reconcilier** part of this. It should be simple as: - it will use only one object (the store one, aka `v1alpha1`) - it will make the assumption that the objects are fully transformed (either by the webhook or in-memory by the controller), meaning there will be no *handling backward-compatible* piece of code in the reconcilier (all is contained in the `Validable`, `Defaultable` and `Convertible` impl.). Possible next steps are: - Split this into smaller PR. - Introduce a `v1alpha2` package early but not exposing it before we are ready to. This will allow us to not have to rush this for 0.9, **and** to increment over this in smaller step. - Decide what `v1alpha2` should look like — I did this experiment with `TaskSpec.Inputs.Params` to `TaskSpec.Params` but we should decide what we want to change and target that. - Reduce duplication by reusing anything that didn't change from `v1alpha1` to `v1alpha2` in `v1alpha1` (aka refering the same type in go) - Related to this experiment, implement the variable interpolation validation thing **and** the reconcilier part too. - Need to figure out if the definition types (`Task`, `Pipeline`, …) need a `controller` (I don't think so but…) Signed-off-by: Vincent Demeester --- cmd/webhook/main.go | 11 +- config/300-clustertask.yaml | 8 +- config/300-condition.yaml | 8 +- config/300-pipeline.yaml | 8 +- config/300-pipelinerun.yaml | 8 +- config/300-resource.yaml | 8 +- config/300-task.yaml | 8 +- config/300-taskrun.yaml | 9 +- examples/pipelineruns/pipelinerun.yaml | 34 +- examples/taskruns/configmap.yaml | 51 +- hack/update-codegen.sh | 4 +- pkg/apis/pipeline/v1alpha1/task_conversion.go | 220 + pkg/apis/pipeline/v1alpha1/task_defaults.go | 21 +- pkg/apis/pipeline/v1alpha1/task_types.go | 12 +- pkg/apis/pipeline/v1alpha1/task_validation.go | 12 +- .../pipeline/v1alpha1/taskrun_conversion.go | 79 + .../pipeline/v1alpha1/taskrun_defaults.go | 10 + pkg/apis/pipeline/v1alpha1/taskrun_types.go | 3 +- .../pipeline/v1alpha1/taskrun_validation.go | 2 +- .../v1alpha1/zz_generated.deepcopy.go | 15 +- pkg/apis/pipeline/v1alpha2/artifact_bucket.go | 133 + .../pipeline/v1alpha2/artifact_bucket_test.go | 101 + pkg/apis/pipeline/v1alpha2/artifact_pvc.go | 93 + .../pipeline/v1alpha2/artifact_pvc_test.go | 117 + .../pipeline/v1alpha2/build_gcs_resource.go | 166 + .../v1alpha2/build_gcs_resource_test.go | 193 + .../pipeline/v1alpha2/cloud_event_resource.go | 88 + .../v1alpha2/cloud_event_resource_test.go | 119 + .../pipeline/v1alpha2/cluster_resource.go | 177 + .../v1alpha2/cluster_resource_test.go | 182 + .../v1alpha2/cluster_task_defaults.go | 25 + .../pipeline/v1alpha2/cluster_task_types.go | 66 + .../v1alpha2/cluster_task_validation.go | 30 + .../pipeline/v1alpha2/condition_defaults.go | 26 + pkg/apis/pipeline/v1alpha2/condition_types.go | 112 + .../pipeline/v1alpha2/condition_types_test.go | 55 + .../pipeline/v1alpha2/condition_validation.go | 42 + .../v1alpha2/condition_validation_test.go | 77 + pkg/apis/pipeline/v1alpha2/contexts.go | 54 + pkg/apis/pipeline/v1alpha2/dag.go | 136 + pkg/apis/pipeline/v1alpha2/dag_test.go | 328 + pkg/apis/pipeline/v1alpha2/doc.go | 23 + pkg/apis/pipeline/v1alpha2/gcs_resource.go | 162 + .../pipeline/v1alpha2/gcs_resource_test.go | 324 + pkg/apis/pipeline/v1alpha2/git_resource.go | 127 + .../pipeline/v1alpha2/git_resource_test.go | 141 + pkg/apis/pipeline/v1alpha2/image_resource.go | 93 + .../pipeline/v1alpha2/image_resource_test.go | 85 + pkg/apis/pipeline/v1alpha2/merge.go | 90 + pkg/apis/pipeline/v1alpha2/merge_test.go | 115 + .../pipeline/v1alpha2/metadata_validation.go | 45 + .../v1alpha2/metadata_validation_test.go | 37 + pkg/apis/pipeline/v1alpha2/param_types.go | 127 + .../pipeline/v1alpha2/param_types_test.go | 189 + .../pipeline/v1alpha2/pipeline_defaults.go | 34 + .../pipeline/v1alpha2/pipeline_interface.go | 26 + pkg/apis/pipeline/v1alpha2/pipeline_types.go | 217 + .../pipeline/v1alpha2/pipeline_validation.go | 241 + .../v1alpha2/pipeline_validation_test.go | 317 + .../v1alpha2/pipelineresource_validation.go | 136 + .../pipelineresource_validation_test.go | 197 + .../pipeline/v1alpha2/pipelinerun_defaults.go | 50 + .../v1alpha2/pipelinerun_defaults_test.go | 168 + .../pipeline/v1alpha2/pipelinerun_types.go | 300 + .../v1alpha2/pipelinerun_types_test.go | 273 + .../v1alpha2/pipelinerun_validation.go | 66 + .../v1alpha2/pipelinerun_validation_test.go | 201 + pkg/apis/pipeline/v1alpha2/pod.go | 58 + pkg/apis/pipeline/v1alpha2/pod_test.go | 17 + .../v1alpha2/pull_request_resource.go | 134 + .../v1alpha2/pull_request_resource_test.go | 147 + pkg/apis/pipeline/v1alpha2/register.go | 66 + .../pipeline/v1alpha2/resource_defaults.go | 26 + pkg/apis/pipeline/v1alpha2/resource_paths.go | 37 + .../pipeline/v1alpha2/resource_paths_test.go | 81 + pkg/apis/pipeline/v1alpha2/resource_types.go | 271 + .../pipeline/v1alpha2/resource_types_test.go | 144 + .../pipeline/v1alpha2/secret_volume_mount.go | 59 + .../pipeline/v1alpha2/step_replacements.go | 67 + .../v1alpha2/step_replacements_test.go | 146 + .../pipeline/v1alpha2/storage_resource.go | 96 + pkg/apis/pipeline/v1alpha2/substitution.go | 139 + .../pipeline/v1alpha2/substitution_test.go | 234 + pkg/apis/pipeline/v1alpha2/task_conversion.go | 34 + pkg/apis/pipeline/v1alpha2/task_defaults.go | 38 + pkg/apis/pipeline/v1alpha2/task_interface.go | 26 + pkg/apis/pipeline/v1alpha2/task_types.go | 160 + pkg/apis/pipeline/v1alpha2/task_validation.go | 330 + .../pipeline/v1alpha2/task_validation_test.go | 685 ++ .../pipeline/v1alpha2/taskrun_conversion.go | 34 + .../pipeline/v1alpha2/taskrun_defaults.go | 59 + .../v1alpha2/taskrun_defaults_test.go | 209 + pkg/apis/pipeline/v1alpha2/taskrun_types.go | 312 + .../pipeline/v1alpha2/taskrun_types_test.go | 221 + .../pipeline/v1alpha2/taskrun_validation.go | 134 + .../v1alpha2/taskrun_validation_test.go | 342 + pkg/apis/pipeline/v1alpha2/types_test.go | 33 + .../v1alpha2/zz_generated.deepcopy.go | 1903 ++++ pkg/client/clientset/versioned/clientset.go | 14 + .../versioned/fake/clientset_generated.go | 7 + .../clientset/versioned/fake/register.go | 2 + .../clientset/versioned/scheme/register.go | 2 + .../typed/pipeline/v1alpha2/clustertask.go | 147 + .../typed/pipeline/v1alpha2/condition.go | 157 + .../versioned/typed/pipeline/v1alpha2/doc.go | 20 + .../typed/pipeline/v1alpha2/fake/doc.go | 20 + .../v1alpha2/fake/fake_clustertask.go | 120 + .../pipeline/v1alpha2/fake/fake_condition.go | 128 + .../pipeline/v1alpha2/fake/fake_pipeline.go | 140 + .../v1alpha2/fake/fake_pipeline_client.go | 64 + .../v1alpha2/fake/fake_pipelineresource.go | 140 + .../v1alpha2/fake/fake_pipelinerun.go | 140 + .../typed/pipeline/v1alpha2/fake/fake_task.go | 128 + .../pipeline/v1alpha2/fake/fake_taskrun.go | 140 + .../pipeline/v1alpha2/generated_expansion.go | 33 + .../typed/pipeline/v1alpha2/pipeline.go | 174 + .../pipeline/v1alpha2/pipeline_client.go | 120 + .../pipeline/v1alpha2/pipelineresource.go | 174 + .../typed/pipeline/v1alpha2/pipelinerun.go | 174 + .../versioned/typed/pipeline/v1alpha2/task.go | 157 + .../typed/pipeline/v1alpha2/taskrun.go | 174 + .../informers/externalversions/generic.go | 17 + .../externalversions/pipeline/interface.go | 8 + .../pipeline/v1alpha2/clustertask.go | 88 + .../pipeline/v1alpha2/condition.go | 89 + .../pipeline/v1alpha2/interface.go | 87 + .../pipeline/v1alpha2/pipeline.go | 89 + .../pipeline/v1alpha2/pipelineresource.go | 89 + .../pipeline/v1alpha2/pipelinerun.go | 89 + .../pipeline/v1alpha2/task.go | 89 + .../pipeline/v1alpha2/taskrun.go | 89 + .../v1alpha2/clustertask/clustertask.go | 52 + .../v1alpha2/clustertask/fake/fake.go | 40 + .../pipeline/v1alpha2/condition/condition.go | 52 + .../pipeline/v1alpha2/condition/fake/fake.go | 40 + .../pipeline/v1alpha2/pipeline/fake/fake.go | 40 + .../pipeline/v1alpha2/pipeline/pipeline.go | 52 + .../v1alpha2/pipelineresource/fake/fake.go | 40 + .../pipelineresource/pipelineresource.go | 52 + .../v1alpha2/pipelinerun/fake/fake.go | 40 + .../v1alpha2/pipelinerun/pipelinerun.go | 52 + .../pipeline/v1alpha2/task/fake/fake.go | 40 + .../informers/pipeline/v1alpha2/task/task.go | 52 + .../pipeline/v1alpha2/taskrun/fake/fake.go | 40 + .../pipeline/v1alpha2/taskrun/taskrun.go | 52 + .../listers/pipeline/v1alpha2/clustertask.go | 65 + .../listers/pipeline/v1alpha2/condition.go | 94 + .../pipeline/v1alpha2/expansion_generated.go | 71 + .../listers/pipeline/v1alpha2/pipeline.go | 94 + .../pipeline/v1alpha2/pipelineresource.go | 94 + .../listers/pipeline/v1alpha2/pipelinerun.go | 94 + pkg/client/listers/pipeline/v1alpha2/task.go | 94 + .../listers/pipeline/v1alpha2/taskrun.go | 94 + pkg/reconciler/pipelinerun/pipelinerun.go | 6 +- .../resources/conditionresolution.go | 2 +- pkg/reconciler/taskrun/resources/apply.go | 2 +- pkg/reconciler/taskrun/taskrun.go | 10 +- pkg/reconciler/taskrun/validate_resources.go | 6 +- test/builder/task.go | 4 +- third_party/VENDOR-LICENSE | 9555 ----------------- 160 files changed, 17284 insertions(+), 9631 deletions(-) create mode 100644 pkg/apis/pipeline/v1alpha1/task_conversion.go create mode 100644 pkg/apis/pipeline/v1alpha1/taskrun_conversion.go create mode 100644 pkg/apis/pipeline/v1alpha2/artifact_bucket.go create mode 100644 pkg/apis/pipeline/v1alpha2/artifact_bucket_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/artifact_pvc.go create mode 100644 pkg/apis/pipeline/v1alpha2/artifact_pvc_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/build_gcs_resource.go create mode 100644 pkg/apis/pipeline/v1alpha2/build_gcs_resource_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/cloud_event_resource.go create mode 100644 pkg/apis/pipeline/v1alpha2/cloud_event_resource_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/cluster_resource.go create mode 100644 pkg/apis/pipeline/v1alpha2/cluster_resource_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/cluster_task_defaults.go create mode 100644 pkg/apis/pipeline/v1alpha2/cluster_task_types.go create mode 100644 pkg/apis/pipeline/v1alpha2/cluster_task_validation.go create mode 100644 pkg/apis/pipeline/v1alpha2/condition_defaults.go create mode 100644 pkg/apis/pipeline/v1alpha2/condition_types.go create mode 100644 pkg/apis/pipeline/v1alpha2/condition_types_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/condition_validation.go create mode 100644 pkg/apis/pipeline/v1alpha2/condition_validation_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/contexts.go create mode 100644 pkg/apis/pipeline/v1alpha2/dag.go create mode 100644 pkg/apis/pipeline/v1alpha2/dag_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/doc.go create mode 100644 pkg/apis/pipeline/v1alpha2/gcs_resource.go create mode 100644 pkg/apis/pipeline/v1alpha2/gcs_resource_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/git_resource.go create mode 100644 pkg/apis/pipeline/v1alpha2/git_resource_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/image_resource.go create mode 100644 pkg/apis/pipeline/v1alpha2/image_resource_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/merge.go create mode 100644 pkg/apis/pipeline/v1alpha2/merge_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/metadata_validation.go create mode 100644 pkg/apis/pipeline/v1alpha2/metadata_validation_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/param_types.go create mode 100644 pkg/apis/pipeline/v1alpha2/param_types_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/pipeline_defaults.go create mode 100644 pkg/apis/pipeline/v1alpha2/pipeline_interface.go create mode 100644 pkg/apis/pipeline/v1alpha2/pipeline_types.go create mode 100644 pkg/apis/pipeline/v1alpha2/pipeline_validation.go create mode 100644 pkg/apis/pipeline/v1alpha2/pipeline_validation_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/pipelineresource_validation.go create mode 100644 pkg/apis/pipeline/v1alpha2/pipelineresource_validation_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/pipelinerun_defaults.go create mode 100644 pkg/apis/pipeline/v1alpha2/pipelinerun_defaults_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/pipelinerun_types.go create mode 100644 pkg/apis/pipeline/v1alpha2/pipelinerun_types_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/pipelinerun_validation.go create mode 100644 pkg/apis/pipeline/v1alpha2/pipelinerun_validation_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/pod.go create mode 100644 pkg/apis/pipeline/v1alpha2/pod_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/pull_request_resource.go create mode 100644 pkg/apis/pipeline/v1alpha2/pull_request_resource_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/register.go create mode 100644 pkg/apis/pipeline/v1alpha2/resource_defaults.go create mode 100644 pkg/apis/pipeline/v1alpha2/resource_paths.go create mode 100644 pkg/apis/pipeline/v1alpha2/resource_paths_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/resource_types.go create mode 100644 pkg/apis/pipeline/v1alpha2/resource_types_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/secret_volume_mount.go create mode 100644 pkg/apis/pipeline/v1alpha2/step_replacements.go create mode 100644 pkg/apis/pipeline/v1alpha2/step_replacements_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/storage_resource.go create mode 100644 pkg/apis/pipeline/v1alpha2/substitution.go create mode 100644 pkg/apis/pipeline/v1alpha2/substitution_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/task_conversion.go create mode 100644 pkg/apis/pipeline/v1alpha2/task_defaults.go create mode 100644 pkg/apis/pipeline/v1alpha2/task_interface.go create mode 100644 pkg/apis/pipeline/v1alpha2/task_types.go create mode 100644 pkg/apis/pipeline/v1alpha2/task_validation.go create mode 100644 pkg/apis/pipeline/v1alpha2/task_validation_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/taskrun_conversion.go create mode 100644 pkg/apis/pipeline/v1alpha2/taskrun_defaults.go create mode 100644 pkg/apis/pipeline/v1alpha2/taskrun_defaults_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/taskrun_types.go create mode 100644 pkg/apis/pipeline/v1alpha2/taskrun_types_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/taskrun_validation.go create mode 100644 pkg/apis/pipeline/v1alpha2/taskrun_validation_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/types_test.go create mode 100644 pkg/apis/pipeline/v1alpha2/zz_generated.deepcopy.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/clustertask.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/condition.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/doc.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/doc.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_clustertask.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_condition.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipeline.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipeline_client.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipelineresource.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipelinerun.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_task.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_taskrun.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/generated_expansion.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipeline.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipeline_client.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipelineresource.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipelinerun.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/task.go create mode 100644 pkg/client/clientset/versioned/typed/pipeline/v1alpha2/taskrun.go create mode 100644 pkg/client/informers/externalversions/pipeline/v1alpha2/clustertask.go create mode 100644 pkg/client/informers/externalversions/pipeline/v1alpha2/condition.go create mode 100644 pkg/client/informers/externalversions/pipeline/v1alpha2/interface.go create mode 100644 pkg/client/informers/externalversions/pipeline/v1alpha2/pipeline.go create mode 100644 pkg/client/informers/externalversions/pipeline/v1alpha2/pipelineresource.go create mode 100644 pkg/client/informers/externalversions/pipeline/v1alpha2/pipelinerun.go create mode 100644 pkg/client/informers/externalversions/pipeline/v1alpha2/task.go create mode 100644 pkg/client/informers/externalversions/pipeline/v1alpha2/taskrun.go create mode 100644 pkg/client/injection/informers/pipeline/v1alpha2/clustertask/clustertask.go create mode 100644 pkg/client/injection/informers/pipeline/v1alpha2/clustertask/fake/fake.go create mode 100644 pkg/client/injection/informers/pipeline/v1alpha2/condition/condition.go create mode 100644 pkg/client/injection/informers/pipeline/v1alpha2/condition/fake/fake.go create mode 100644 pkg/client/injection/informers/pipeline/v1alpha2/pipeline/fake/fake.go create mode 100644 pkg/client/injection/informers/pipeline/v1alpha2/pipeline/pipeline.go create mode 100644 pkg/client/injection/informers/pipeline/v1alpha2/pipelineresource/fake/fake.go create mode 100644 pkg/client/injection/informers/pipeline/v1alpha2/pipelineresource/pipelineresource.go create mode 100644 pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun/fake/fake.go create mode 100644 pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun/pipelinerun.go create mode 100644 pkg/client/injection/informers/pipeline/v1alpha2/task/fake/fake.go create mode 100644 pkg/client/injection/informers/pipeline/v1alpha2/task/task.go create mode 100644 pkg/client/injection/informers/pipeline/v1alpha2/taskrun/fake/fake.go create mode 100644 pkg/client/injection/informers/pipeline/v1alpha2/taskrun/taskrun.go create mode 100644 pkg/client/listers/pipeline/v1alpha2/clustertask.go create mode 100644 pkg/client/listers/pipeline/v1alpha2/condition.go create mode 100644 pkg/client/listers/pipeline/v1alpha2/expansion_generated.go create mode 100644 pkg/client/listers/pipeline/v1alpha2/pipeline.go create mode 100644 pkg/client/listers/pipeline/v1alpha2/pipelineresource.go create mode 100644 pkg/client/listers/pipeline/v1alpha2/pipelinerun.go create mode 100644 pkg/client/listers/pipeline/v1alpha2/task.go create mode 100644 pkg/client/listers/pipeline/v1alpha2/taskrun.go diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go index 81751898637..ca970b63c01 100644 --- a/cmd/webhook/main.go +++ b/cmd/webhook/main.go @@ -23,6 +23,7 @@ import ( apiconfig "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" tklogging "github.com/tektoncd/pipeline/pkg/logging" "github.com/tektoncd/pipeline/pkg/system" "go.uber.org/zap" @@ -95,6 +96,14 @@ func main() { v1alpha1.SchemeGroupVersion.WithKind("TaskRun"): &v1alpha1.TaskRun{}, v1alpha1.SchemeGroupVersion.WithKind("PipelineRun"): &v1alpha1.PipelineRun{}, v1alpha1.SchemeGroupVersion.WithKind("Condition"): &v1alpha1.Condition{}, + + v1alpha2.SchemeGroupVersion.WithKind("Pipeline"): &v1alpha2.Pipeline{}, + v1alpha2.SchemeGroupVersion.WithKind("PipelineResource"): &v1alpha2.PipelineResource{}, + v1alpha2.SchemeGroupVersion.WithKind("Task"): &v1alpha2.Task{}, + v1alpha2.SchemeGroupVersion.WithKind("ClusterTask"): &v1alpha2.ClusterTask{}, + v1alpha2.SchemeGroupVersion.WithKind("TaskRun"): &v1alpha2.TaskRun{}, + v1alpha2.SchemeGroupVersion.WithKind("PipelineRun"): &v1alpha2.PipelineRun{}, + v1alpha2.SchemeGroupVersion.WithKind("Condition"): &v1alpha2.Condition{}, } resourceAdmissionController := webhook.NewResourceAdmissionController(resourceHandlers, options, true) @@ -104,7 +113,7 @@ func main() { // Decorate contexts with the current state of the config. ctxFunc := func(ctx context.Context) context.Context { - return v1alpha1.WithDefaultConfigurationName(store.ToContext(ctx)) + return v1alpha2.WithUpgradeViaDefaulting(store.ToContext(ctx)) } controller, err := webhook.New(kubeClient, options, admissionControllers, logger, ctxFunc) diff --git a/config/300-clustertask.yaml b/config/300-clustertask.yaml index 6dca5803d9b..51d0d1f1534 100644 --- a/config/300-clustertask.yaml +++ b/config/300-clustertask.yaml @@ -17,6 +17,13 @@ metadata: name: clustertasks.tekton.dev spec: group: tekton.dev + versions: + - name: v1alpha1 + served: true + storage: true + - name: v1alpha2 + served: true + storage: false names: kind: ClusterTask plural: clustertasks @@ -28,4 +35,3 @@ spec: # starts to increment subresources: status: {} - version: v1alpha1 diff --git a/config/300-condition.yaml b/config/300-condition.yaml index 746a01e8f75..c5612def187 100644 --- a/config/300-condition.yaml +++ b/config/300-condition.yaml @@ -17,6 +17,13 @@ metadata: name: conditions.tekton.dev spec: group: tekton.dev + versions: + - name: v1alpha1 + served: true + storage: true + - name: v1alpha2 + served: true + storage: false names: kind: Condition plural: conditions @@ -28,4 +35,3 @@ spec: # starts to increment subresources: status: {} - version: v1alpha1 \ No newline at end of file diff --git a/config/300-pipeline.yaml b/config/300-pipeline.yaml index b1858ad7730..5e0d79302cc 100644 --- a/config/300-pipeline.yaml +++ b/config/300-pipeline.yaml @@ -17,6 +17,13 @@ metadata: name: pipelines.tekton.dev spec: group: tekton.dev + versions: + - name: v1alpha1 + served: true + storage: true + - name: v1alpha2 + served: true + storage: false names: kind: Pipeline plural: pipelines @@ -28,4 +35,3 @@ spec: # starts to increment subresources: status: {} - version: v1alpha1 diff --git a/config/300-pipelinerun.yaml b/config/300-pipelinerun.yaml index 4a9dbb43133..2ba7e284a22 100644 --- a/config/300-pipelinerun.yaml +++ b/config/300-pipelinerun.yaml @@ -17,6 +17,13 @@ metadata: name: pipelineruns.tekton.dev spec: group: tekton.dev + versions: + - name: v1alpha1 + served: true + storage: true + - name: v1alpha2 + served: true + storage: false names: kind: PipelineRun plural: pipelineruns @@ -44,4 +51,3 @@ spec: # starts to increment subresources: status: {} - version: v1alpha1 diff --git a/config/300-resource.yaml b/config/300-resource.yaml index e251bfd3c10..734d53e6f95 100644 --- a/config/300-resource.yaml +++ b/config/300-resource.yaml @@ -17,6 +17,13 @@ metadata: name: pipelineresources.tekton.dev spec: group: tekton.dev + versions: + - name: v1alpha1 + served: true + storage: true + - name: v1alpha2 + served: true + storage: false names: kind: PipelineResource plural: pipelineresources @@ -28,4 +35,3 @@ spec: # starts to increment subresources: status: {} - version: v1alpha1 diff --git a/config/300-task.yaml b/config/300-task.yaml index 6cc664bd8e1..0bca15bf007 100644 --- a/config/300-task.yaml +++ b/config/300-task.yaml @@ -17,6 +17,13 @@ metadata: name: tasks.tekton.dev spec: group: tekton.dev + versions: + - name: v1alpha1 + served: true + storage: true + - name: v1alpha2 + served: true + storage: false names: kind: Task plural: tasks @@ -28,4 +35,3 @@ spec: # starts to increment subresources: status: {} - version: v1alpha1 diff --git a/config/300-taskrun.yaml b/config/300-taskrun.yaml index b711692a33e..8db74df5ece 100644 --- a/config/300-taskrun.yaml +++ b/config/300-taskrun.yaml @@ -17,6 +17,13 @@ metadata: name: taskruns.tekton.dev spec: group: tekton.dev + versions: + - name: v1alpha1 + served: true + storage: true + - name: v1alpha2 + served: true + storage: false names: kind: TaskRun plural: taskruns @@ -44,4 +51,4 @@ spec: # starts to increment subresources: status: {} - version: v1alpha1 + diff --git a/examples/pipelineruns/pipelinerun.yaml b/examples/pipelineruns/pipelinerun.yaml index e00261dd292..1e4948459d5 100644 --- a/examples/pipelineruns/pipelinerun.yaml +++ b/examples/pipelineruns/pipelinerun.yaml @@ -1,5 +1,5 @@ --- -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1alpha2 kind: PipelineResource metadata: name: skaffold-image-leeroy-app @@ -26,7 +26,7 @@ roleRef: name: cluster-admin apiGroup: rbac.authorization.k8s.io --- -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1alpha2 kind: PipelineResource metadata: name: skaffold-image-leeroy-web-pipelinerun @@ -36,7 +36,7 @@ spec: - name: url value: gcr.io/christiewilson-catfactory/leeroy-web --- -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1alpha2 kind: PipelineResource metadata: name: skaffold-git-pipelinerun @@ -48,7 +48,7 @@ spec: - name: url value: https://github.com/GoogleContainerTools/skaffold --- -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1alpha2 kind: Task metadata: name: unit-tests @@ -70,7 +70,7 @@ spec: args: - "pass" --- -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1alpha2 kind: Task metadata: name: build-push @@ -79,13 +79,13 @@ spec: resources: - name: workspace type: git - params: - - name: pathToDockerFile - description: The path to the dockerfile to build - default: /workspace/workspace/Dockerfile - - name: pathToContext - description: The build context used by Kaniko (https://github.com/GoogleContainerTools/kaniko#kaniko-build-contexts) - default: /workspace/workspace + params: + - name: pathToDockerFile + description: The path to the dockerfile to build + default: /workspace/workspace/Dockerfile + - name: pathToContext + description: The build context used by Kaniko (https://github.com/GoogleContainerTools/kaniko#kaniko-build-contexts) + default: /workspace/workspace outputs: resources: - name: builtImage @@ -100,9 +100,9 @@ spec: command: - /kaniko/executor args: - - --dockerfile=$(inputs.params.pathToDockerFile) + - --dockerfile=$(params.pathToDockerFile) - --destination=$(outputs.resources.builtImage.url) - - --context=$(inputs.params.pathToContext) + - --context=$(params.pathToContext) --- #This task deploys with kubectl apply -f apiVersion: tekton.dev/v1alpha1 @@ -131,7 +131,7 @@ spec: - "w" - "-i" - "$(inputs.params.yqArg)" - - "$(inputs.params.path)" + - "$kube(inputs.params.path)" - "$(inputs.params.yamlPathToImage)" - "$(inputs.resources.image.url)" - name: run-kubectl @@ -150,7 +150,7 @@ spec: # pushed are the ones that are deployed (that would require using the digest of # the built image, see https://github.com/tektoncd/pipeline/issues/216). -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1alpha2 kind: Pipeline metadata: name: demo-pipeline @@ -239,7 +239,7 @@ spec: - name: yamlPathToImage value: "spec.template.spec.containers[0].image" --- -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1alpha2 kind: PipelineRun metadata: name: demo-pipeline-run-1 diff --git a/examples/taskruns/configmap.yaml b/examples/taskruns/configmap.yaml index 067d336a5cf..f6c5f6e60ae 100644 --- a/examples/taskruns/configmap.yaml +++ b/examples/taskruns/configmap.yaml @@ -5,29 +5,36 @@ metadata: data: test.data: tasks are my jam --- -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1alpha2 +kind: Task +metadata: + name: foo +spec: + steps: + - name: secret + image: ubuntu + command: ['bash'] + args: + - '-c' + - '[[ $(cat /config/test.data) == $TEST_DATA ]]' + env: + - name: TEST_DATA + valueFrom: + configMapKeyRef: + name: config-for-testing-configmaps + key: test.data + volumeMounts: + - name: config-volume + mountPath: /config + volumes: + - name: config-volume + configMap: + name: config-for-testing-configmaps +--- +apiVersion: tekton.dev/v1alpha2 kind: TaskRun metadata: generateName: configmap- spec: - taskSpec: - steps: - - name: secret - image: ubuntu - command: ['bash'] - args: - - '-c' - - '[[ $(cat /config/test.data) == $TEST_DATA ]]' - env: - - name: TEST_DATA - valueFrom: - configMapKeyRef: - name: config-for-testing-configmaps - key: test.data - volumeMounts: - - name: config-volume - mountPath: /config - volumes: - - name: config-volume - configMap: - name: config-for-testing-configmaps + taskRef: + name: foo diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 4df6511210f..6726da80458 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -30,7 +30,7 @@ KNATIVE_CODEGEN_PKG=${KNATIVE_CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 ./ven # instead of the $GOPATH directly. For normal projects this can be dropped. ${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \ github.com/tektoncd/pipeline/pkg/client github.com/tektoncd/pipeline/pkg/apis \ - pipeline:v1alpha1 \ + pipeline:v1alpha1,v1alpha2 \ --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt # Depends on generate-groups.sh to install bin/deepcopy-gen @@ -42,7 +42,7 @@ ${GOPATH}/bin/deepcopy-gen \ # Knative Injection ${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh "injection" \ github.com/tektoncd/pipeline/pkg/client github.com/tektoncd/pipeline/pkg/apis \ - "pipeline:v1alpha1" \ + "pipeline:v1alpha1,v1alpha2" \ --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt # Make sure our dependencies are up-to-date diff --git a/pkg/apis/pipeline/v1alpha1/task_conversion.go b/pkg/apis/pipeline/v1alpha1/task_conversion.go new file mode 100644 index 00000000000..af12d1367ab --- /dev/null +++ b/pkg/apis/pipeline/v1alpha1/task_conversion.go @@ -0,0 +1,220 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "context" + "fmt" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "knative.dev/pkg/apis" +) + +func (source *Task) ConvertUp(ctx context.Context, obj apis.Convertible) error { + switch sink := obj.(type) { + case *v1alpha2.Task: + sink.ObjectMeta = source.ObjectMeta + return source.Spec.ConvertUp(ctx, &sink.Spec) + default: + return fmt.Errorf("unknown version, got: %T", sink) + } +} + +func (sink *Task) ConvertDown(ctx context.Context, obj apis.Convertible) error { + switch source := obj.(type) { + case *v1alpha2.Task: + sink.ObjectMeta = source.ObjectMeta + return sink.Spec.ConvertDown(ctx, source.Spec) + default: + return fmt.Errorf("unknown version, got: %T", source) + } +} + +func (source *TaskSpec) ConvertUp(ctx context.Context, sink *v1alpha2.TaskSpec) error { + if source.Inputs != nil && len(source.Inputs.DeprecatedParams) > 0 && len(source.Params) > 0 { + return fmt.Errorf("Cannot have inputs.params and params at the same time") + } + // FIXME(vdemeester) handle errors here + if source.Inputs != nil { + sink.Inputs = &v1alpha2.Inputs{} + } + source.Inputs.ConvertUp(ctx, sink.Inputs) + if source.Outputs != nil { + sink.Outputs = &v1alpha2.Outputs{} + } + source.Outputs.ConvertUp(ctx, sink.Outputs) + fmt.Println("-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*") + fmt.Println("source.inputs", source.Inputs) + fmt.Println("sink.inputs", sink.Inputs) + fmt.Println("source.outpust", source.Outputs) + fmt.Println("sink.outputs", sink.Outputs) + + if source.Inputs != nil && len(source.Inputs.DeprecatedParams) > 0 { + sink.Params = make([]v1alpha2.ParamSpec, len(source.Inputs.DeprecatedParams)) + for i := range source.Inputs.DeprecatedParams { + source.Inputs.DeprecatedParams[i].ConvertUp(ctx, &sink.Params[i]) + } + } else { + sink.Params = make([]v1alpha2.ParamSpec, len(sink.Params)) + for i := range source.Params { + source.Params[i].ConvertUp(ctx, &sink.Params[i]) + } + } + sink.Steps = make([]v1alpha2.Step, len(source.Steps)) + for i := range source.Steps { + source.Steps[i].ConvertUp(ctx, &sink.Steps[i]) + } + + sink.StepTemplate = source.StepTemplate + sink.Sidecars = source.Sidecars + sink.Volumes = source.Volumes + return nil +} + +func (sink *TaskSpec) ConvertDown(ctx context.Context, source v1alpha2.TaskSpec) error { + // FIXME(vdemeester) make this better (aka handle errors, …) + if source.Inputs != nil { + sink.Inputs = &Inputs{} + } + sink.Inputs.ConvertDown(ctx, source.Inputs) + if source.Outputs != nil { + sink.Outputs = &Outputs{} + } + sink.Outputs.ConvertDown(ctx, source.Outputs) + + sink.Params = make([]ParamSpec, len(source.Params)) + for i := range source.Params { + sink.Params[i].ConvertDown(ctx, source.Params[i]) + } + sink.Steps = make([]Step, len(source.Steps)) + for i := range source.Steps { + sink.Steps[i].ConvertDown(ctx, source.Steps[i]) + } + + sink.StepTemplate = source.StepTemplate + sink.Sidecars = source.Sidecars + sink.Volumes = source.Volumes + return nil +} + +func (source *Inputs) ConvertUp(ctx context.Context, sink *v1alpha2.Inputs) { + if source == nil { + return + } + sink.Resources = make([]v1alpha2.TaskResource, len(source.Resources)) + for i := range source.Resources { + source.Resources[i].ConvertUp(ctx, &sink.Resources[i]) + } +} + +func (sink *Inputs) ConvertDown(ctx context.Context, source *v1alpha2.Inputs) { + if source == nil { + return + } + sink.Resources = make([]TaskResource, len(source.Resources)) + for i := range source.Resources { + sink.Resources[i].ConvertDown(ctx, source.Resources[i]) + } +} + +func (sink *TaskResource) ConvertDown(ctx context.Context, source v1alpha2.TaskResource) { + sink.Name = source.Name + sink.Type = PipelineResourceType(source.Type) + sink.TargetPath = source.TargetPath +} + +func (source *TaskResource) ConvertUp(ctx context.Context, sink *v1alpha2.TaskResource) { + sink.Name = source.Name + sink.Type = v1alpha2.PipelineResourceType(source.Type) + sink.TargetPath = source.TargetPath +} + +func (sink *Outputs) ConvertDown(ctx context.Context, source *v1alpha2.Outputs) { + if source == nil { + return + } + sink.Resources = make([]TaskResource, len(source.Resources)) + for i := range source.Resources { + sink.Resources[i].ConvertDown(ctx, source.Resources[i]) + } + sink.Results = make([]TestResult, len(source.Results)) + for i := range source.Results { + sink.Results[i].ConvertDown(ctx, source.Results[i]) + } +} + +func (source *Outputs) ConvertUp(ctx context.Context, sink *v1alpha2.Outputs) { + if source == nil { + return + } + sink.Resources = make([]v1alpha2.TaskResource, len(source.Resources)) + for i := range source.Resources { + source.Resources[i].ConvertUp(ctx, &sink.Resources[i]) + } + sink.Results = make([]v1alpha2.TestResult, len(source.Results)) + for i := range source.Results { + source.Results[i].ConvertUp(ctx, &sink.Results[i]) + } +} + +func (sink *TestResult) ConvertDown(ctx context.Context, source v1alpha2.TestResult) { + sink.Name = source.Name + sink.Format = source.Format + sink.Path = source.Path +} + +func (source *TestResult) ConvertUp(ctx context.Context, sink *v1alpha2.TestResult) { + sink.Name = source.Name + sink.Format = source.Format + sink.Path = source.Path +} + +func (sink *Step) ConvertDown(ctx context.Context, source v1alpha2.Step) { + sink.Container = source.Container + sink.Script = source.Script +} + +func (source *Step) ConvertUp(ctx context.Context, sink *v1alpha2.Step) { + sink.Container = source.Container + sink.Script = source.Script +} + +func (sink *ParamSpec) ConvertDown(ctx context.Context, source v1alpha2.ParamSpec) { + sink.Name = source.Name + sink.Type = ParamType(source.Type) + sink.Description = source.Description + if source.Default != nil { + sink.Default = &ArrayOrString{ + Type: ParamType(source.Default.Type), + StringVal: source.Default.StringVal, + ArrayVal: source.Default.ArrayVal, + } + } +} + +func (source *ParamSpec) ConvertUp(ctx context.Context, sink *v1alpha2.ParamSpec) { + sink.Name = source.Name + sink.Type = v1alpha2.ParamType(source.Type) + sink.Description = source.Description + if source.Default != nil { + sink.Default = &v1alpha2.ArrayOrString{ + Type: v1alpha2.ParamType(source.Default.Type), + StringVal: source.Default.StringVal, + ArrayVal: source.Default.ArrayVal, + } + } +} diff --git a/pkg/apis/pipeline/v1alpha1/task_defaults.go b/pkg/apis/pipeline/v1alpha1/task_defaults.go index 7e18b0ab682..7b87681cc84 100644 --- a/pkg/apis/pipeline/v1alpha1/task_defaults.go +++ b/pkg/apis/pipeline/v1alpha1/task_defaults.go @@ -18,6 +18,9 @@ package v1alpha1 import ( "context" + "fmt" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" ) func (t *Task) SetDefaults(ctx context.Context) { @@ -26,13 +29,27 @@ func (t *Task) SetDefaults(ctx context.Context) { // SetDefaults set any defaults for the task spec func (ts *TaskSpec) SetDefaults(ctx context.Context) { + if v1alpha2.IsUpgradeViaDefaulting(ctx) { + fmt.Println("********************************************") + v := v1alpha2.TaskSpec{} + if ts.ConvertUp(ctx, &v) == nil { + fmt.Printf("v: %+v\n", v) + fmt.Printf("v.inputs: %+v\n", v.Inputs) + fmt.Printf("v.outputs: %+v\n", v.Outputs) + alpha1 := TaskSpec{} + if alpha1.ConvertDown(ctx, v) == nil { + *ts = alpha1 + } + } + } + fmt.Printf("ts: %+v\n", ts) if ts.Inputs != nil { ts.Inputs.SetDefaults(ctx) } } func (inputs *Inputs) SetDefaults(ctx context.Context) { - for i := range inputs.Params { - inputs.Params[i].SetDefaults(ctx) + for i := range inputs.DeprecatedParams { + inputs.DeprecatedParams[i].SetDefaults(ctx) } } diff --git a/pkg/apis/pipeline/v1alpha1/task_types.go b/pkg/apis/pipeline/v1alpha1/task_types.go index ec1fc7ac294..aa47b204b33 100644 --- a/pkg/apis/pipeline/v1alpha1/task_types.go +++ b/pkg/apis/pipeline/v1alpha1/task_types.go @@ -44,6 +44,11 @@ type TaskSpec struct { // Task is run. // +optional Outputs *Outputs `json:"outputs,omitempty"` + // Params is a list of input parameters required to run the task. Params + // must be supplied as inputs in TaskRuns unless they declare a default + // value. + // +optional + Params []ParamSpec `json:"params,omitempty"` // Steps are the steps of the build; each step is run sequentially with the // source mounted into /workspace. @@ -76,6 +81,7 @@ type Step struct { // Check that Task may be validated and defaulted. var _ apis.Validatable = (*Task)(nil) var _ apis.Defaultable = (*Task)(nil) +var _ apis.Convertible = (*Task)(nil) // +genclient // +genclient:noStatus @@ -104,11 +110,13 @@ type Inputs struct { // PipelineResources. // +optional Resources []TaskResource `json:"resources,omitempty"` - // Params is a list of input parameters required to run the task. Params + + // Depraceted + // DeprecatedParams is a list of input parameters required to run the task. Params // must be supplied as inputs in TaskRuns unless they declare a default // value. // +optional - Params []ParamSpec `json:"params,omitempty"` + DeprecatedParams []ParamSpec `json:"params,omitempty"` } // TaskResource defines an input or output Resource declared as a requirement diff --git a/pkg/apis/pipeline/v1alpha1/task_validation.go b/pkg/apis/pipeline/v1alpha1/task_validation.go index f3cb6b0ef99..d044bc28dd5 100644 --- a/pkg/apis/pipeline/v1alpha1/task_validation.go +++ b/pkg/apis/pipeline/v1alpha1/task_validation.go @@ -95,9 +95,11 @@ func (ts *TaskSpec) Validate(ctx context.Context) *apis.FieldError { } } - if err := validateInputParameterVariables(ts.Steps, ts.Inputs); err != nil { - return err - } + /* + if err := validateInputParameterVariables(ts.Steps, ts.Inputs); err != nil { + return err + } + */ if err := validateResourceVariables(ts.Steps, ts.Inputs, ts.Outputs); err != nil { return err } @@ -154,7 +156,7 @@ func validateSteps(steps []Step) *apis.FieldError { } func validateInputParameterTypes(inputs *Inputs) *apis.FieldError { - for _, p := range inputs.Params { + for _, p := range inputs.DeprecatedParams { // Ensure param has a valid type. validType := false for _, allowedType := range AllParamTypes { @@ -186,7 +188,7 @@ func validateInputParameterVariables(steps []Step, inputs *Inputs) *apis.FieldEr arrayParameterNames := map[string]struct{}{} if inputs != nil { - for _, p := range inputs.Params { + for _, p := range inputs.DeprecatedParams { parameterNames[p.Name] = struct{}{} if p.Type == ParamTypeArray { arrayParameterNames[p.Name] = struct{}{} diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_conversion.go b/pkg/apis/pipeline/v1alpha1/taskrun_conversion.go new file mode 100644 index 00000000000..59d8fb30de7 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha1/taskrun_conversion.go @@ -0,0 +1,79 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "context" + "fmt" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "knative.dev/pkg/apis" +) + +func (source *TaskRun) ConvertUp(ctx context.Context, obj apis.Convertible) error { + switch sink := obj.(type) { + case *v1alpha2.TaskRun: + sink.ObjectMeta = source.ObjectMeta + return source.Spec.ConvertUp(ctx, &sink.Spec) + default: + return fmt.Errorf("unknown version, got: %T", sink) + } +} + +func (source *TaskRunSpec) ConvertUp(ctx context.Context, sink *v1alpha2.TaskRunSpec) error { + if len(source.Inputs.DeprecatedParams) > 0 { + for _, p := range source.Inputs.DeprecatedParams { + param := v1alpha2.Param{ + Name: p.Name, + Value: v1alpha2.ArrayOrString{ + Type: v1alpha2.ParamType(p.Value.Type), + StringVal: p.Value.StringVal, + ArrayVal: p.Value.ArrayVal, + }, + } + sink.Params = append(sink.Params, param) + } + } + return nil +} + +func (sink *TaskRun) ConvertDown(ctx context.Context, obj apis.Convertible) error { + switch source := obj.(type) { + case *v1alpha2.TaskRun: + sink.ObjectMeta = source.ObjectMeta + return sink.Spec.ConvertDown(ctx, source.Spec) + default: + return fmt.Errorf("unknown version, got: %T", source) + } +} + +func (sink *TaskRunSpec) ConvertDown(ctx context.Context, source v1alpha2.TaskRunSpec) error { + if len(source.Params) > 0 { + for _, p := range source.Params { + param := Param{ + Name: p.Name, + Value: ArrayOrString{ + Type: ParamType(p.Value.Type), + StringVal: p.Value.StringVal, + ArrayVal: p.Value.ArrayVal, + }, + } + sink.Inputs.DeprecatedParams = append(sink.Inputs.DeprecatedParams, param) + } + } + return nil +} diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go b/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go index 5a6de5d1b22..39bc41bcb04 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go @@ -21,6 +21,7 @@ import ( "time" "github.com/tektoncd/pipeline/pkg/apis/config" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -29,6 +30,15 @@ func (tr *TaskRun) SetDefaults(ctx context.Context) { } func (trs *TaskRunSpec) SetDefaults(ctx context.Context) { + if v1alpha2.IsUpgradeViaDefaulting(ctx) { + v := v1alpha2.TaskRunSpec{} + if trs.ConvertUp(ctx, &v) == nil { + alpha1 := TaskRunSpec{} + if alpha1.ConvertDown(ctx, v) == nil { + *trs = alpha1 + } + } + } cfg := config.FromContextOrDefaults(ctx) if trs.TaskRef != nil && trs.TaskRef.Kind == "" { trs.TaskRef.Kind = NamespacedTaskKind diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_types.go b/pkg/apis/pipeline/v1alpha1/taskrun_types.go index 8a3fe0c8145..76b3d51ab64 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_types.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_types.go @@ -30,6 +30,7 @@ import ( // Check that TaskRun may be validated and defaulted. var _ apis.Validatable = (*TaskRun)(nil) var _ apis.Defaultable = (*TaskRun)(nil) +var _ apis.Convertible = (*TaskRun)(nil) // TaskRunSpec defines the desired state of TaskRun type TaskRunSpec struct { @@ -75,7 +76,7 @@ type TaskRunInputs struct { // +optional Resources []TaskResourceBinding `json:"resources,omitempty"` // +optional - Params []Param `json:"params,omitempty"` + DeprecatedParams []Param `json:"params,omitempty"` } // TaskResourceBinding points to the PipelineResource that diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_validation.go b/pkg/apis/pipeline/v1alpha1/taskrun_validation.go index 5051dcbf473..8f0b7b612ca 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_validation.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_validation.go @@ -80,7 +80,7 @@ func (i TaskRunInputs) Validate(ctx context.Context, path string) *apis.FieldErr if err := validatePipelineResources(ctx, i.Resources, fmt.Sprintf("%s.Resources.Name", path)); err != nil { return err } - return validateParameters(i.Params) + return validateParameters(i.DeprecatedParams) } func (o TaskRunOutputs) Validate(ctx context.Context, path string) *apis.FieldError { diff --git a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go index 1ef0379f39c..9a5b4df0863 100644 --- a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go @@ -487,8 +487,8 @@ func (in *Inputs) DeepCopyInto(out *Inputs) { *out = make([]TaskResource, len(*in)) copy(*out, *in) } - if in.Params != nil { - in, out := &in.Params, &out.Params + if in.DeprecatedParams != nil { + in, out := &in.DeprecatedParams, &out.DeprecatedParams *out = make([]ParamSpec, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) @@ -1673,8 +1673,8 @@ func (in *TaskRunInputs) DeepCopyInto(out *TaskRunInputs) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.Params != nil { - in, out := &in.Params, &out.Params + if in.DeprecatedParams != nil { + in, out := &in.DeprecatedParams, &out.DeprecatedParams *out = make([]Param, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) @@ -1847,6 +1847,13 @@ func (in *TaskSpec) DeepCopyInto(out *TaskSpec) { *out = new(Outputs) (*in).DeepCopyInto(*out) } + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make([]ParamSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } if in.Steps != nil { in, out := &in.Steps, &out.Steps *out = make([]Step, len(*in)) diff --git a/pkg/apis/pipeline/v1alpha2/artifact_bucket.go b/pkg/apis/pipeline/v1alpha2/artifact_bucket.go new file mode 100644 index 00000000000..5b29d6d81f7 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/artifact_bucket.go @@ -0,0 +1,133 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "fmt" + + "github.com/tektoncd/pipeline/pkg/names" + corev1 "k8s.io/api/core/v1" +) + +const ( + // BucketConfigName is the name of the configmap containing all + // customizations for the storage bucket. + BucketConfigName = "config-artifact-bucket" + + // BucketLocationKey is the name of the configmap entry that specifies + // loction of the bucket. + BucketLocationKey = "location" + + // BucketServiceAccountSecretName is the name of the configmap entry that specifies + // the name of the secret that will provide the servie account with bucket access. + // This secret must have a key called serviceaccount that will have a value with + // the service account with access to the bucket + BucketServiceAccountSecretName = "bucket.service.account.secret.name" + + // BucketServiceAccountSecretKey is the name of the configmap entry that specifies + // the secret key that will have a value with the service account json with access + // to the bucket + BucketServiceAccountSecretKey = "bucket.service.account.secret.key" + + // BucketServiceAccountFieldName is the name of the configmap entry that specifies + // the field name that should be used for the service account. + // Valid values: GOOGLE_APPLICATION_CREDENTIALS, BOTO_CONFIG. Defaults to GOOGLE_APPLICATION_CREDENTIALS. + BucketServiceAccountFieldName = "bucket.service.account.field.name" +) + +const ( + // PipelineResourceTypeGit indicates that this source is a GitHub repo. + ArtifactStorageBucketType = "bucket" + + // PipelineResourceTypeStorage indicates that this source is a storage blob resource. + ArtifactStoragePVCType = "pvc" +) + +// For some reason gosec thinks this string has enough entropy to be a potential secret. +// The nosec comment disables it for this line. +/* #nosec */ +var secretVolumeMountPath = "/var/bucketsecret" + +// ArtifactBucket contains the Storage bucket configuration defined in the +// Bucket config map. +type ArtifactBucket struct { + Name string + Location string + Secrets []SecretParam + + ShellImage string + GsutilImage string +} + +// GetType returns the type of the artifact storage +func (b *ArtifactBucket) GetType() string { + return ArtifactStorageBucketType +} + +// StorageBasePath returns the path to be used to store artifacts in a pipelinerun temporary storage +func (b *ArtifactBucket) StorageBasePath(pr *PipelineRun) string { + return fmt.Sprintf("%s-%s-bucket", pr.Name, pr.Namespace) +} + +// GetCopyFromStorageToSteps returns a container used to download artifacts from temporary storage +func (b *ArtifactBucket) GetCopyFromStorageToSteps(name, sourcePath, destinationPath string) []Step { + envVars, secretVolumeMount := getSecretEnvVarsAndVolumeMounts("bucket", secretVolumeMountPath, b.Secrets) + + return []Step{{Container: corev1.Container{ + Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf("artifact-dest-mkdir-%s", name)), + Image: b.ShellImage, + Command: []string{"mkdir", "-p", destinationPath}, + }}, {Container: corev1.Container{ + Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf("artifact-copy-from-%s", name)), + Image: b.GsutilImage, + Command: []string{"gsutil"}, + Args: []string{"cp", "-P", "-r", fmt.Sprintf("%s/%s/*", b.Location, sourcePath), destinationPath}, + Env: envVars, + VolumeMounts: secretVolumeMount, + }}} +} + +// GetCopyToStorageFromSteps returns a container used to upload artifacts for temporary storage +func (b *ArtifactBucket) GetCopyToStorageFromSteps(name, sourcePath, destinationPath string) []Step { + envVars, secretVolumeMount := getSecretEnvVarsAndVolumeMounts("bucket", secretVolumeMountPath, b.Secrets) + + return []Step{{Container: corev1.Container{ + Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf("artifact-copy-to-%s", name)), + Image: b.GsutilImage, + Command: []string{"gsutil"}, + Args: []string{"cp", "-P", "-r", sourcePath, fmt.Sprintf("%s/%s", b.Location, destinationPath)}, + Env: envVars, + VolumeMounts: secretVolumeMount, + }}} +} + +// GetSecretsVolumes returns the list of volumes for secrets to be mounted +// on pod +func (b *ArtifactBucket) GetSecretsVolumes() []corev1.Volume { + volumes := []corev1.Volume{} + for _, sec := range b.Secrets { + volumes = append(volumes, corev1.Volume{ + Name: fmt.Sprintf("volume-bucket-%s", sec.SecretName), + VolumeSource: corev1.VolumeSource{ + Secret: &corev1.SecretVolumeSource{ + SecretName: sec.SecretName, + }, + }, + }) + } + return volumes +} diff --git a/pkg/apis/pipeline/v1alpha2/artifact_bucket_test.go b/pkg/apis/pipeline/v1alpha2/artifact_bucket_test.go new file mode 100644 index 00000000000..3e0a14b58fe --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/artifact_bucket_test.go @@ -0,0 +1,101 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "fmt" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/test/names" + corev1 "k8s.io/api/core/v1" +) + +const ( + secretName = "secret1" +) + +var ( + expectedVolumeName = fmt.Sprintf("volume-bucket-%s", secretName) + + bucket = v1alpha1.ArtifactBucket{ + Location: "gs://fake-bucket", + Secrets: []v1alpha1.SecretParam{{ + FieldName: "GOOGLE_APPLICATION_CREDENTIALS", + SecretName: secretName, + SecretKey: "serviceaccount", + }}, + ShellImage: "busybox", + GsutilImage: "google/cloud-sdk", + } +) + +func TestBucketGetCopyFromContainerSpec(t *testing.T) { + names.TestingSeed() + + want := []v1alpha1.Step{{Container: corev1.Container{ + Name: "artifact-dest-mkdir-workspace-9l9zj", + Image: "busybox", + Command: []string{"mkdir", "-p", "/workspace/destination"}, + }}, {Container: corev1.Container{ + Name: "artifact-copy-from-workspace-mz4c7", + Image: "google/cloud-sdk", + Command: []string{"gsutil"}, + Args: []string{"cp", "-P", "-r", "gs://fake-bucket/src-path/*", "/workspace/destination"}, + Env: []corev1.EnvVar{{Name: "GOOGLE_APPLICATION_CREDENTIALS", Value: fmt.Sprintf("/var/bucketsecret/%s/serviceaccount", secretName)}}, + VolumeMounts: []corev1.VolumeMount{{Name: expectedVolumeName, MountPath: fmt.Sprintf("/var/bucketsecret/%s", secretName)}}, + }}} + + got := bucket.GetCopyFromStorageToSteps("workspace", "src-path", "/workspace/destination") + if d := cmp.Diff(got, want); d != "" { + t.Errorf("Diff:\n%s", d) + } +} + +func TestBucketGetCopyToContainerSpec(t *testing.T) { + names.TestingSeed() + want := []v1alpha1.Step{{Container: corev1.Container{ + Name: "artifact-copy-to-workspace-9l9zj", + Image: "google/cloud-sdk", + Command: []string{"gsutil"}, + Args: []string{"cp", "-P", "-r", "src-path", "gs://fake-bucket/workspace/destination"}, + Env: []corev1.EnvVar{{Name: "GOOGLE_APPLICATION_CREDENTIALS", Value: fmt.Sprintf("/var/bucketsecret/%s/serviceaccount", secretName)}}, + VolumeMounts: []corev1.VolumeMount{{Name: expectedVolumeName, MountPath: fmt.Sprintf("/var/bucketsecret/%s", secretName)}}, + }}} + + got := bucket.GetCopyToStorageFromSteps("workspace", "src-path", "workspace/destination") + if d := cmp.Diff(got, want); d != "" { + t.Errorf("Diff:\n%s", d) + } +} + +func TestGetSecretsVolumes(t *testing.T) { + names.TestingSeed() + want := []corev1.Volume{{ + Name: expectedVolumeName, + VolumeSource: corev1.VolumeSource{ + Secret: &corev1.SecretVolumeSource{ + SecretName: secretName, + }, + }, + }} + got := bucket.GetSecretsVolumes() + if d := cmp.Diff(got, want); d != "" { + t.Errorf("Diff:\n%s", d) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/artifact_pvc.go b/pkg/apis/pipeline/v1alpha2/artifact_pvc.go new file mode 100644 index 00000000000..08c4ea77ef1 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/artifact_pvc.go @@ -0,0 +1,93 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "fmt" + "strings" + + "github.com/tektoncd/pipeline/pkg/names" + corev1 "k8s.io/api/core/v1" +) + +var ( + pvcDir = "/pvc" +) + +// ArtifactPVC represents the pvc created by the pipelinerun for artifacts temporary storage. +type ArtifactPVC struct { + Name string + PersistentVolumeClaim *corev1.PersistentVolumeClaim + + ShellImage string +} + +// GetType returns the type of the artifact storage. +func (p *ArtifactPVC) GetType() string { + return ArtifactStoragePVCType +} + +// StorageBasePath returns the path to be used to store artifacts in a pipelinerun temporary storage. +func (p *ArtifactPVC) StorageBasePath(pr *PipelineRun) string { + return pvcDir +} + +// GetCopyFromStorageToSteps returns a container used to download artifacts from temporary storage. +func (p *ArtifactPVC) GetCopyFromStorageToSteps(name, sourcePath, destinationPath string) []Step { + return []Step{{Container: corev1.Container{ + Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf("source-copy-%s", name)), + Image: p.ShellImage, + Command: []string{"cp", "-r", fmt.Sprintf("%s/.", sourcePath), destinationPath}, + }}} +} + +// GetCopyToStorageFromSteps returns a container used to upload artifacts for temporary storage. +func (p *ArtifactPVC) GetCopyToStorageFromSteps(name, sourcePath, destinationPath string) []Step { + return []Step{{Container: corev1.Container{ + Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf("source-mkdir-%s", name)), + Image: p.ShellImage, + Command: []string{"mkdir", "-p", destinationPath}, + VolumeMounts: []corev1.VolumeMount{GetPvcMount(p.Name)}, + }}, {Container: corev1.Container{ + Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf("source-copy-%s", name)), + Image: p.ShellImage, + Command: []string{"cp", "-r", fmt.Sprintf("%s/.", sourcePath), destinationPath}, + VolumeMounts: []corev1.VolumeMount{GetPvcMount(p.Name)}, + }}} +} + +// GetPvcMount returns a mounting of the volume with the mount path /pvc. +func GetPvcMount(name string) corev1.VolumeMount { + return corev1.VolumeMount{ + Name: name, // taskrun pvc name + MountPath: pvcDir, // nothing should be mounted here + } +} + +// CreateDirStep returns a container step to create a dir at destinationPath. The name +// of the step will include name. +func CreateDirStep(shellImage string, name, destinationPath string) Step { + return Step{Container: corev1.Container{ + Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf("create-dir-%s", strings.ToLower(name))), + Image: shellImage, + Command: []string{"mkdir", "-p", destinationPath}, + }} +} + +// GetSecretsVolumes returns the list of volumes for secrets to be mounted on +// pod. +func (p *ArtifactPVC) GetSecretsVolumes() []corev1.Volume { return nil } diff --git a/pkg/apis/pipeline/v1alpha2/artifact_pvc_test.go b/pkg/apis/pipeline/v1alpha2/artifact_pvc_test.go new file mode 100644 index 00000000000..ce577b3e187 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/artifact_pvc_test.go @@ -0,0 +1,117 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/test/names" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func TestPVCGetCopyFromContainerSpec(t *testing.T) { + names.TestingSeed() + + pvc := v1alpha1.ArtifactPVC{ + Name: "pipelinerun-pvc", + ShellImage: "busybox", + } + want := []v1alpha1.Step{{Container: corev1.Container{ + Name: "source-copy-workspace-9l9zj", + Image: "busybox", + + Command: []string{"cp", "-r", "src-path/.", "/workspace/destination"}, + }}} + + got := pvc.GetCopyFromStorageToSteps("workspace", "src-path", "/workspace/destination") + if d := cmp.Diff(got, want); d != "" { + t.Errorf("Diff:\n%s", d) + } +} + +func TestPVCGetCopyToContainerSpec(t *testing.T) { + names.TestingSeed() + + pvc := v1alpha1.ArtifactPVC{ + Name: "pipelinerun-pvc", + ShellImage: "busybox", + } + want := []v1alpha1.Step{{Container: corev1.Container{ + Name: "source-mkdir-workspace-9l9zj", + Image: "busybox", + Command: []string{"mkdir", "-p", "/workspace/destination"}, + VolumeMounts: []corev1.VolumeMount{{MountPath: "/pvc", Name: "pipelinerun-pvc"}}, + }}, {Container: corev1.Container{ + Name: "source-copy-workspace-mz4c7", + Image: "busybox", + Command: []string{"cp", "-r", "src-path/.", "/workspace/destination"}, + VolumeMounts: []corev1.VolumeMount{{MountPath: "/pvc", Name: "pipelinerun-pvc"}}, + }}} + + got := pvc.GetCopyToStorageFromSteps("workspace", "src-path", "/workspace/destination") + if d := cmp.Diff(got, want); d != "" { + t.Errorf("Diff:\n%s", d) + } +} + +func TestPVCGetPvcMount(t *testing.T) { + names.TestingSeed() + name := "pipelinerun-pvc" + pvcDir := "/pvc" + + want := corev1.VolumeMount{ + Name: name, + MountPath: pvcDir, + } + got := v1alpha1.GetPvcMount(name) + if d := cmp.Diff(got, want); d != "" { + t.Errorf("Diff:\n%s", d) + } +} + +func TestPVCGetMakeStep(t *testing.T) { + names.TestingSeed() + + want := v1alpha1.Step{Container: corev1.Container{ + Name: "create-dir-workspace-9l9zj", + Image: "busybox", + Command: []string{"mkdir", "-p", "/workspace/destination"}, + }} + got := v1alpha1.CreateDirStep("busybox", "workspace", "/workspace/destination") + if d := cmp.Diff(got, want); d != "" { + t.Errorf("Diff:\n%s", d) + } +} + +func TestStorageBasePath(t *testing.T) { + pvc := v1alpha1.ArtifactPVC{ + Name: "pipelinerun-pvc", + } + pipelinerun := &v1alpha1.PipelineRun{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "foo", + Name: "pipelineruntest", + }, + } + got := pvc.StorageBasePath(pipelinerun) + if d := cmp.Diff(got, "/pvc"); d != "" { + t.Errorf("Diff:\n%s", d) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/build_gcs_resource.go b/pkg/apis/pipeline/v1alpha2/build_gcs_resource.go new file mode 100644 index 00000000000..8928a587bee --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/build_gcs_resource.go @@ -0,0 +1,166 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "fmt" + "strings" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline" + "github.com/tektoncd/pipeline/pkg/names" + "golang.org/x/xerrors" + corev1 "k8s.io/api/core/v1" +) + +// GCSArtifactType defines a type of GCS resource. +type GCSArtifactType string + +const ( + // GCSZipArchive indicates that the resource should be fetched and + // extracted as a .zip file. + // + // Deprecated: Use GCSZipArchive instead. + GCSArchive GCSArtifactType = "Archive" + + // GCSZipArchive indicates that the resource should be fetched and + // extracted as a .zip file. + GCSZipArchive GCSArtifactType = "ZipArchive" + + // GCSTarGzArchive indicates that the resource should be fetched and + // extracted as a .tar.gz file. + GCSTarGzArchive GCSArtifactType = "TarGzArchive" + + // GCSManifest indicates that resource should be fetched using a + // manifest-based protocol which enables incremental source upload. + GCSManifest GCSArtifactType = "Manifest" +) + +var validArtifactTypes = []GCSArtifactType{ + GCSArchive, + GCSManifest, + GCSZipArchive, + GCSTarGzArchive, +} + +// BuildGCSResource describes a resource in the form of an archive, +// or a source manifest describing files to fetch. +// BuildGCSResource does incremental uploads for files in directory. +type BuildGCSResource struct { + Name string + Type PipelineResourceType + Location string + ArtifactType GCSArtifactType + + ShellImage string `json:"-"` + BuildGCSFetcherImage string `json:"-"` +} + +// NewBuildGCSResource creates a new BuildGCS resource to pass to a Task. +func NewBuildGCSResource(images pipeline.Images, r *PipelineResource) (*BuildGCSResource, error) { + if r.Spec.Type != PipelineResourceTypeStorage { + return nil, xerrors.Errorf("BuildGCSResource: Cannot create a BuildGCS resource from a %s Pipeline Resource", r.Spec.Type) + } + if r.Spec.SecretParams != nil { + return nil, xerrors.Errorf("BuildGCSResource: %s cannot support artifacts on private bucket", r.Name) + } + var location string + var aType GCSArtifactType + for _, param := range r.Spec.Params { + switch { + case strings.EqualFold(param.Name, "Location"): + location = param.Value + case strings.EqualFold(param.Name, "ArtifactType"): + var err error + aType, err = getArtifactType(param.Value) + if err != nil { + return nil, xerrors.Errorf("BuildGCSResource %s : %w", r.Name, err) + } + } + } + if location == "" { + return nil, xerrors.Errorf("BuildGCSResource: Need Location to be specified in order to create BuildGCS resource %s", r.Name) + } + if aType == GCSArtifactType("") { + return nil, xerrors.Errorf("BuildGCSResource: Need ArtifactType to be specified to create BuildGCS resource %s", r.Name) + } + return &BuildGCSResource{ + Name: r.Name, + Type: r.Spec.Type, + Location: location, + ArtifactType: aType, + ShellImage: images.ShellImage, + BuildGCSFetcherImage: images.BuildGCSFetcherImage, + }, nil +} + +// GetName returns the name of the resource. +func (s BuildGCSResource) GetName() string { return s.Name } + +// GetType returns the type of the resource, in this case "storage". +func (s BuildGCSResource) GetType() PipelineResourceType { return PipelineResourceTypeStorage } + +// GetSecretParams returns nil because it takes no secret params. +func (s *BuildGCSResource) GetSecretParams() []SecretParam { return nil } + +// Replacements returns the set of available replacements for this resource. +func (s *BuildGCSResource) Replacements() map[string]string { + return map[string]string{ + "name": s.Name, + "type": string(s.Type), + "location": s.Location, + } +} + +// GetInputTaskModifier returns a TaskModifier that prepends a step to a Task to fetch the archive or manifest. +func (s *BuildGCSResource) GetInputTaskModifier(ts *TaskSpec, sourcePath string) (TaskModifier, error) { + args := []string{"--type", string(s.ArtifactType), "--location", s.Location} + // dest_dir is the destination directory for GCS files to be copies" + if sourcePath != "" { + args = append(args, "--dest_dir", sourcePath) + } + + steps := []Step{ + CreateDirStep(s.ShellImage, s.Name, sourcePath), + {Container: corev1.Container{ + Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf("storage-fetch-%s", s.Name)), + Command: []string{"/ko-app/gcs-fetcher"}, + Image: s.BuildGCSFetcherImage, + Args: args, + }}} + + volumes := getStorageVolumeSpec(s, *ts) + + return &InternalTaskModifier{ + StepsToPrepend: steps, + Volumes: volumes, + }, nil +} + +// GetOutputTaskModifier returns a No-op TaskModifier. +func (s *BuildGCSResource) GetOutputTaskModifier(ts *TaskSpec, sourcePath string) (TaskModifier, error) { + return &InternalTaskModifier{}, nil +} + +func getArtifactType(val string) (GCSArtifactType, error) { + a := GCSArtifactType(val) + for _, v := range validArtifactTypes { + if a == v { + return a, nil + } + } + return "", xerrors.Errorf("Invalid ArtifactType %s. Should be one of %s", val, validArtifactTypes) +} diff --git a/pkg/apis/pipeline/v1alpha2/build_gcs_resource_test.go b/pkg/apis/pipeline/v1alpha2/build_gcs_resource_test.go new file mode 100644 index 00000000000..c4c56bb47cc --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/build_gcs_resource_test.go @@ -0,0 +1,193 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + tb "github.com/tektoncd/pipeline/test/builder" + "github.com/tektoncd/pipeline/test/names" + corev1 "k8s.io/api/core/v1" +) + +var images = pipeline.Images{ + EntryPointImage: "override-with-entrypoint:latest", + NopImage: "tianon/true", + GitImage: "override-with-git:latest", + CredsImage: "override-with-creds:latest", + KubeconfigWriterImage: "override-with-kubeconfig-writer:latest", + ShellImage: "busybox", + GsutilImage: "google/cloud-sdk", + BuildGCSFetcherImage: "gcr.io/cloud-builders/gcs-fetcher:latest", + PRImage: "override-with-pr:latest", + ImageDigestExporterImage: "override-with-imagedigest-exporter-image:latest", +} + +func Test_Invalid_BuildGCSResource(t *testing.T) { + for _, tc := range []struct { + name string + pipelineResource *v1alpha1.PipelineResource + }{{ + name: "no location params", + pipelineResource: tb.PipelineResource("buildgcs-resource-with-no-location-param", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("NotLocation", "doesntmatter"), + tb.PipelineResourceSpecParam("type", "build-gcs"), + )), + }, { + name: "location param with empty value", + pipelineResource: tb.PipelineResource("buildgcs-resource-with-empty-location-param", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("Location", ""), + tb.PipelineResourceSpecParam("type", "build-gcs"), + )), + }, { + name: "no artifactType params", + pipelineResource: tb.PipelineResource("buildgcs-resource-with-no-artifactType-param", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("Location", "gs://test"), + tb.PipelineResourceSpecParam("type", "build-gcs"), + )), + }, { + name: "artifactType param with empty value", + pipelineResource: tb.PipelineResource("buildgcs-resource-with-empty-artifactType-param", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("Location", "gs://test"), + tb.PipelineResourceSpecParam("type", "build-gcs"), + tb.PipelineResourceSpecParam("ArtifactType", ""), + )), + }, { + name: "artifactType param with invalid value", + pipelineResource: tb.PipelineResource("buildgcs-resource-with-invalid-artifactType-param", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("Location", "gs://test"), + tb.PipelineResourceSpecParam("type", "build-gcs"), + tb.PipelineResourceSpecParam("ArtifactType", "invalid-type"), + )), + }, { + name: "artifactType param with secrets value", + pipelineResource: tb.PipelineResource("buildgcs-resource-with-invalid-artifactType-param-and-secrets", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("Location", "gs://test"), + tb.PipelineResourceSpecParam("type", "build-gcs"), + tb.PipelineResourceSpecParam("ArtifactType", "invalid-type"), + tb.PipelineResourceSpecSecretParam("secretKey", "secretName", "GOOGLE_APPLICATION_CREDENTIALS"), + )), + }} { + t.Run(tc.name, func(t *testing.T) { + _, err := v1alpha1.NewStorageResource(images, tc.pipelineResource) + if err == nil { + t.Error("Expected error creating BuildGCS resource") + } + }) + } +} + +func Test_Valid_NewBuildGCSResource(t *testing.T) { + pr := tb.PipelineResource("build-gcs-resource", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("Location", "gs://fake-bucket"), + tb.PipelineResourceSpecParam("type", "build-gcs"), + tb.PipelineResourceSpecParam("ArtifactType", "Manifest"), + )) + expectedGCSResource := &v1alpha1.BuildGCSResource{ + Name: "build-gcs-resource", + Location: "gs://fake-bucket", + Type: v1alpha1.PipelineResourceTypeStorage, + ArtifactType: "Manifest", + ShellImage: "busybox", + BuildGCSFetcherImage: "gcr.io/cloud-builders/gcs-fetcher:latest", + } + + r, err := v1alpha1.NewBuildGCSResource(images, pr) + if err != nil { + t.Fatalf("Unexpected error creating BuildGCS resource: %s", err) + } + if d := cmp.Diff(expectedGCSResource, r); d != "" { + t.Errorf("Mismatch of BuildGCS resource: %s", d) + } +} + +func Test_BuildGCSGetReplacements(t *testing.T) { + r := &v1alpha1.BuildGCSResource{ + Name: "gcs-resource", + Location: "gs://fake-bucket", + Type: v1alpha1.PipelineResourceTypeBuildGCS, + } + expectedReplacementMap := map[string]string{ + "name": "gcs-resource", + "type": "build-gcs", + "location": "gs://fake-bucket", + } + if d := cmp.Diff(r.Replacements(), expectedReplacementMap); d != "" { + t.Errorf("BuildGCS Replacement map mismatch: %s", d) + } +} + +func Test_BuildGCSGetInputSteps(t *testing.T) { + for _, at := range []v1alpha1.GCSArtifactType{ + v1alpha1.GCSArchive, + v1alpha1.GCSZipArchive, + v1alpha1.GCSTarGzArchive, + v1alpha1.GCSManifest, + } { + t.Run(string(at), func(t *testing.T) { + resource := &v1alpha1.BuildGCSResource{ + Name: "gcs-valid", + Location: "gs://some-bucket", + ArtifactType: at, + ShellImage: "busybox", + BuildGCSFetcherImage: "gcr.io/cloud-builders/gcs-fetcher:latest", + } + wantSteps := []v1alpha1.Step{{Container: corev1.Container{ + Name: "create-dir-gcs-valid-9l9zj", + Image: "busybox", + Command: []string{"mkdir", "-p", "/workspace"}, + }}, {Container: corev1.Container{ + Name: "storage-fetch-gcs-valid-mz4c7", + Image: "gcr.io/cloud-builders/gcs-fetcher:latest", + Args: []string{"--type", string(at), "--location", "gs://some-bucket", "--dest_dir", "/workspace"}, + Command: []string{"/ko-app/gcs-fetcher"}, + }}} + names.TestingSeed() + + ts := v1alpha1.TaskSpec{} + got, err := resource.GetInputTaskModifier(&ts, "/workspace") + if err != nil { + t.Fatalf("GetDownloadSteps: %v", err) + } + if d := cmp.Diff(got.GetStepsToPrepend(), wantSteps); d != "" { + t.Errorf("Error mismatch between download steps: %s", d) + } + }) + } +} + +func TestBuildGCS_InvalidArtifactType(t *testing.T) { + pr := tb.PipelineResource("build-gcs-resource", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("Location", "gs://fake-bucket"), + tb.PipelineResourceSpecParam("type", "build-gcs"), + tb.PipelineResourceSpecParam("ArtifactType", "InVaLiD"), + )) + if _, err := v1alpha1.NewBuildGCSResource(images, pr); err == nil { + t.Error("NewBuildGCSResource: expected error") + } +} diff --git a/pkg/apis/pipeline/v1alpha2/cloud_event_resource.go b/pkg/apis/pipeline/v1alpha2/cloud_event_resource.go new file mode 100644 index 00000000000..c4053c67e56 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/cloud_event_resource.go @@ -0,0 +1,88 @@ +/* +Copyright 2019 The Tekton Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "fmt" + "strings" +) + +// CloudEventResource is an event sink to which events are delivered when a TaskRun has finished +type CloudEventResource struct { + // Name is the name used to reference to the PipelineResource + Name string `json:"name"` + // Type must be `PipelineResourceTypeCloudEvent` + Type PipelineResourceType `json:"type"` + // TargetURI is the URI of the sink which the cloud event is develired to + TargetURI string `json:"targetURI"` +} + +// NewCloudEventResource creates a new CloudEvent resource to pass to a Task +func NewCloudEventResource(r *PipelineResource) (*CloudEventResource, error) { + if r.Spec.Type != PipelineResourceTypeCloudEvent { + return nil, fmt.Errorf("CloudEventResource: Cannot create a Cloud Event resource from a %s Pipeline Resource", r.Spec.Type) + } + var targetURI string + var targetURISpecified bool + + for _, param := range r.Spec.Params { + if strings.EqualFold(param.Name, "TargetURI") { + targetURI = param.Value + if param.Value != "" { + targetURISpecified = true + } + } + } + + if !targetURISpecified { + return nil, fmt.Errorf("CloudEventResource: Need URI to be specified in order to create a CloudEvent resource %s", r.Name) + } + return &CloudEventResource{ + Name: r.Name, + Type: r.Spec.Type, + TargetURI: targetURI, + }, nil +} + +// GetName returns the name of the resource +func (s CloudEventResource) GetName() string { + return s.Name +} + +// GetType returns the type of the resource, in this case "cloudEvent" +func (s CloudEventResource) GetType() PipelineResourceType { + return PipelineResourceTypeCloudEvent +} + +// Replacements is used for template replacement on an CloudEventResource inside of a Taskrun. +func (s *CloudEventResource) Replacements() map[string]string { + return map[string]string{ + "name": s.Name, + "type": string(s.Type), + "target-uri": s.TargetURI, + } +} + +// GetInputTaskModifier returns the TaskModifier to be used when this resource is an input. +func (s *CloudEventResource) GetInputTaskModifier(_ *TaskSpec, _ string) (TaskModifier, error) { + return &InternalTaskModifier{}, nil +} + +// GetOutputTaskModifier returns a No-op TaskModifier. +func (s *CloudEventResource) GetOutputTaskModifier(_ *TaskSpec, _ string) (TaskModifier, error) { + return &InternalTaskModifier{}, nil +} diff --git a/pkg/apis/pipeline/v1alpha2/cloud_event_resource_test.go b/pkg/apis/pipeline/v1alpha2/cloud_event_resource_test.go new file mode 100644 index 00000000000..5eaf8b5db32 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/cloud_event_resource_test.go @@ -0,0 +1,119 @@ +/* +Copyright 2019 The Tekton Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + + tb "github.com/tektoncd/pipeline/test/builder" +) + +func Test_NewCloudEventResource_Invalid(t *testing.T) { + testcases := []struct { + name string + pipelineResource *v1alpha1.PipelineResource + }{{ + name: "create resource with no parameter", + pipelineResource: tb.PipelineResource("cloud-event-resource-no-uri", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeCloudEvent, + )), + }, { + name: "create resource with invalid type", + pipelineResource: tb.PipelineResource("git-resource", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeGit, + tb.PipelineResourceSpecParam("URL", "git://fake/repo"), + tb.PipelineResourceSpecParam("Revision", "fake_rev"), + )), + }} + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + _, err := v1alpha1.NewCloudEventResource(tc.pipelineResource) + if err == nil { + t.Error("Expected error creating CloudEvent resource") + } + }) + } +} + +func Test_NewCloudEventResource_Valid(t *testing.T) { + pr := tb.PipelineResource("cloud-event-resource-uri", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeCloudEvent, + tb.PipelineResourceSpecParam("TargetURI", "http://fake-sink"), + )) + expectedCloudEventResource := &v1alpha1.CloudEventResource{ + Name: "cloud-event-resource-uri", + TargetURI: "http://fake-sink", + Type: v1alpha1.PipelineResourceTypeCloudEvent, + } + + r, err := v1alpha1.NewCloudEventResource(pr) + if err != nil { + t.Fatalf("Unexpected error creating CloudEvent resource: %s", err) + } + if d := cmp.Diff(expectedCloudEventResource, r); d != "" { + t.Errorf("Mismatch of CloudEvent resource: %s", d) + } +} + +func Test_CloudEventGetReplacements(t *testing.T) { + r := &v1alpha1.CloudEventResource{ + Name: "cloud-event-resource", + TargetURI: "http://fake-uri", + Type: v1alpha1.PipelineResourceTypeCloudEvent, + } + expectedReplacementMap := map[string]string{ + "name": "cloud-event-resource", + "type": "cloudEvent", + "target-uri": "http://fake-uri", + } + if d := cmp.Diff(r.Replacements(), expectedReplacementMap); d != "" { + t.Errorf("CloudEvent Replacement map mismatch: %s", d) + } +} + +func Test_CloudEventInputContainerSpec(t *testing.T) { + r := &v1alpha1.CloudEventResource{ + Name: "cloud-event-resource", + TargetURI: "http://fake-uri", + Type: v1alpha1.PipelineResourceTypeCloudEvent, + } + d, e := r.GetInputTaskModifier(&v1alpha1.TaskSpec{}, "") + if d.GetStepsToPrepend() != nil { + t.Errorf("Did not expect a download container for CloudEventResource") + } + if e != nil { + t.Errorf("Did not expect an error %s when getting a download container for CloudEventResource", e) + } +} + +func Test_CloudEventOutputContainerSpec(t *testing.T) { + r := &v1alpha1.CloudEventResource{ + Name: "cloud-event-resource", + TargetURI: "http://fake-uri", + Type: v1alpha1.PipelineResourceTypeCloudEvent, + } + d, e := r.GetOutputTaskModifier(&v1alpha1.TaskSpec{}, "") + if d.GetStepsToAppend() != nil { + t.Errorf("Did not expect an upload container for CloudEventResource") + } + if e != nil { + t.Errorf("Did not expect an error %s when getting an upload container for CloudEventResource", e) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/cluster_resource.go b/pkg/apis/pipeline/v1alpha2/cluster_resource.go new file mode 100644 index 00000000000..73e8d76f1b4 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/cluster_resource.go @@ -0,0 +1,177 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + b64 "encoding/base64" + "encoding/json" + "strconv" + "strings" + + "github.com/tektoncd/pipeline/pkg/names" + "golang.org/x/xerrors" + corev1 "k8s.io/api/core/v1" +) + +// ClusterResource represents a cluster configuration (kubeconfig) +// that can be accessed by tasks in the pipeline +type ClusterResource struct { + Name string `json:"name"` + Type PipelineResourceType `json:"type"` + // URL must be a host string + URL string `json:"url"` + Revision string `json:"revision"` + // Server requires Basic authentication + Username string `json:"username"` + Password string `json:"password"` + Namespace string `json:"namespace"` + // Server requires Bearer authentication. This client will not attempt to use + // refresh tokens for an OAuth2 flow. + // Token overrides userame and password + Token string `json:"token"` + // Server should be accessed without verifying the TLS certificate. For testing only. + Insecure bool + // CAData holds PEM-encoded bytes (typically read from a root certificates bundle). + // CAData takes precedence over CAFile + CAData []byte `json:"cadata"` + //Secrets holds a struct to indicate a field name and corresponding secret name to populate it + Secrets []SecretParam `json:"secrets"` + + KubeconfigWriterImage string `json:"-"` +} + +// NewClusterResource create a new k8s cluster resource to pass to a pipeline task +func NewClusterResource(kubeconfigWriterImage string, r *PipelineResource) (*ClusterResource, error) { + if r.Spec.Type != PipelineResourceTypeCluster { + return nil, xerrors.Errorf("ClusterResource: Cannot create a Cluster resource from a %s Pipeline Resource", r.Spec.Type) + } + clusterResource := ClusterResource{ + Type: r.Spec.Type, + KubeconfigWriterImage: kubeconfigWriterImage, + } + for _, param := range r.Spec.Params { + switch { + case strings.EqualFold(param.Name, "Name"): + clusterResource.Name = param.Value + case strings.EqualFold(param.Name, "URL"): + clusterResource.URL = param.Value + case strings.EqualFold(param.Name, "Revision"): + clusterResource.Revision = param.Value + case strings.EqualFold(param.Name, "Username"): + clusterResource.Username = param.Value + case strings.EqualFold(param.Name, "Namespace"): + clusterResource.Namespace = param.Value + case strings.EqualFold(param.Name, "Password"): + clusterResource.Password = param.Value + case strings.EqualFold(param.Name, "Token"): + clusterResource.Token = param.Value + case strings.EqualFold(param.Name, "Insecure"): + b, _ := strconv.ParseBool(param.Value) + clusterResource.Insecure = b + case strings.EqualFold(param.Name, "CAData"): + if param.Value != "" { + sDec, _ := b64.StdEncoding.DecodeString(param.Value) + clusterResource.CAData = sDec + } + } + } + clusterResource.Secrets = r.Spec.SecretParams + + if len(clusterResource.CAData) == 0 { + clusterResource.Insecure = true + for _, secret := range clusterResource.Secrets { + if strings.EqualFold(secret.FieldName, "CAData") { + clusterResource.Insecure = false + break + } + } + } + + return &clusterResource, nil +} + +// GetName returns the name of the resource +func (s ClusterResource) GetName() string { + return s.Name +} + +// GetType returns the type of the resource, in this case "cluster" +func (s ClusterResource) GetType() PipelineResourceType { + return PipelineResourceTypeCluster +} + +// GetURL returns the url to be used with this resource +func (s *ClusterResource) GetURL() string { + return s.URL +} + +// Replacements is used for template replacement on a ClusterResource inside of a Taskrun. +func (s *ClusterResource) Replacements() map[string]string { + return map[string]string{ + "name": s.Name, + "type": string(s.Type), + "url": s.URL, + "revision": s.Revision, + "username": s.Username, + "password": s.Password, + "namespace": s.Namespace, + "token": s.Token, + "insecure": strconv.FormatBool(s.Insecure), + "cadata": string(s.CAData), + } +} + +func (s ClusterResource) String() string { + json, _ := json.Marshal(s) + return string(json) +} + +// GetOutputTaskModifier returns a No-op TaskModifier. +func (s *ClusterResource) GetOutputTaskModifier(_ *TaskSpec, _ string) (TaskModifier, error) { + return &InternalTaskModifier{}, nil +} + +// GetInputTaskModifier returns the TaskModifier to be used when this resource is an input. +func (s *ClusterResource) GetInputTaskModifier(ts *TaskSpec, path string) (TaskModifier, error) { + var envVars []corev1.EnvVar + for _, sec := range s.Secrets { + ev := corev1.EnvVar{ + Name: strings.ToUpper(sec.FieldName), + ValueFrom: &corev1.EnvVarSource{ + SecretKeyRef: &corev1.SecretKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: sec.SecretName, + }, + Key: sec.SecretKey, + }, + }, + } + envVars = append(envVars, ev) + } + step := Step{Container: corev1.Container{ + Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix("kubeconfig"), + Image: s.KubeconfigWriterImage, + Command: []string{"/ko-app/kubeconfigwriter"}, + Args: []string{ + "-clusterConfig", s.String(), + }, + Env: envVars, + }} + return &InternalTaskModifier{ + StepsToPrepend: []Step{step}, + }, nil +} diff --git a/pkg/apis/pipeline/v1alpha2/cluster_resource_test.go b/pkg/apis/pipeline/v1alpha2/cluster_resource_test.go new file mode 100644 index 00000000000..991202322f9 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/cluster_resource_test.go @@ -0,0 +1,182 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + tb "github.com/tektoncd/pipeline/test/builder" + "github.com/tektoncd/pipeline/test/names" + corev1 "k8s.io/api/core/v1" +) + +func TestNewClusterResource(t *testing.T) { + for _, c := range []struct { + desc string + resource *v1alpha1.PipelineResource + want *v1alpha1.ClusterResource + }{{ + desc: "basic cluster resource", + resource: tb.PipelineResource("test-cluster-resource", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeCluster, + tb.PipelineResourceSpecParam("name", "test_cluster_resource"), + tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), + tb.PipelineResourceSpecParam("cadata", "bXktY2x1c3Rlci1jZXJ0Cg"), + tb.PipelineResourceSpecParam("token", "my-token"), + )), + want: &v1alpha1.ClusterResource{ + Name: "test_cluster_resource", + Type: v1alpha1.PipelineResourceTypeCluster, + URL: "http://10.10.10.10", + CAData: []byte("my-cluster-cert"), + Token: "my-token", + KubeconfigWriterImage: "override-with-kubeconfig-writer:latest", + }, + }, { + desc: "resource with password instead of token", + resource: tb.PipelineResource("test-cluster-resource", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeCluster, + tb.PipelineResourceSpecParam("name", "test_cluster_resource"), + tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), + tb.PipelineResourceSpecParam("cadata", "bXktY2x1c3Rlci1jZXJ0Cg"), + tb.PipelineResourceSpecParam("username", "user"), + tb.PipelineResourceSpecParam("password", "pass"), + )), + want: &v1alpha1.ClusterResource{ + Name: "test_cluster_resource", + Type: v1alpha1.PipelineResourceTypeCluster, + URL: "http://10.10.10.10", + CAData: []byte("my-cluster-cert"), + Username: "user", + Password: "pass", + KubeconfigWriterImage: "override-with-kubeconfig-writer:latest", + }, + }, { + desc: "set insecure flag to true when there is no cert", + resource: tb.PipelineResource("test-cluster-resource", "foo", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeCluster, + tb.PipelineResourceSpecParam("name", "test.cluster.resource"), + tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), + tb.PipelineResourceSpecParam("token", "my-token"), + )), + want: &v1alpha1.ClusterResource{ + Name: "test.cluster.resource", + Type: v1alpha1.PipelineResourceTypeCluster, + URL: "http://10.10.10.10", + Token: "my-token", + Insecure: true, + KubeconfigWriterImage: "override-with-kubeconfig-writer:latest", + }, + }, { + desc: "basic cluster resource with namespace", + resource: tb.PipelineResource("test-cluster-resource", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeCluster, + tb.PipelineResourceSpecParam("name", "test_cluster_resource"), + tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), + tb.PipelineResourceSpecParam("cadata", "bXktY2x1c3Rlci1jZXJ0Cg"), + tb.PipelineResourceSpecParam("token", "my-token"), + tb.PipelineResourceSpecParam("namespace", "my-namespace"), + )), + want: &v1alpha1.ClusterResource{ + Name: "test_cluster_resource", + Type: v1alpha1.PipelineResourceTypeCluster, + URL: "http://10.10.10.10", + CAData: []byte("my-cluster-cert"), + Token: "my-token", + Namespace: "my-namespace", + KubeconfigWriterImage: "override-with-kubeconfig-writer:latest", + }, + }, { + desc: "basic resource with secrets", + resource: tb.PipelineResource("test-cluster-resource", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeCluster, + tb.PipelineResourceSpecParam("name", "test-cluster-resource"), + tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), + tb.PipelineResourceSpecSecretParam("cadata", "secret1", "cadatakey"), + tb.PipelineResourceSpecSecretParam("token", "secret1", "tokenkey"), + )), + want: &v1alpha1.ClusterResource{ + Name: "test-cluster-resource", + Type: v1alpha1.PipelineResourceTypeCluster, + URL: "http://10.10.10.10", + Secrets: []v1alpha1.SecretParam{{ + FieldName: "cadata", + SecretKey: "cadatakey", + SecretName: "secret1", + }, { + FieldName: "token", + SecretKey: "tokenkey", + SecretName: "secret1", + }}, + KubeconfigWriterImage: "override-with-kubeconfig-writer:latest", + }, + }} { + t.Run(c.desc, func(t *testing.T) { + got, err := v1alpha1.NewClusterResource("override-with-kubeconfig-writer:latest", c.resource) + if err != nil { + t.Errorf("Test: %q; TestNewClusterResource() error = %v", c.desc, err) + } + if d := cmp.Diff(got, c.want); d != "" { + t.Errorf("Diff:\n%s", d) + } + }) + } +} + +func Test_ClusterResource_GetInputTaskModifier(t *testing.T) { + names.TestingSeed() + clusterResource := &v1alpha1.ClusterResource{ + Name: "test-cluster-resource", + Type: v1alpha1.PipelineResourceTypeCluster, + URL: "http://10.10.10.10", + Secrets: []v1alpha1.SecretParam{{ + FieldName: "cadata", + SecretKey: "cadatakey", + SecretName: "secret1", + }}, + KubeconfigWriterImage: "override-with-kubeconfig-writer:latest", + } + + ts := v1alpha1.TaskSpec{} + wantSteps := []v1alpha1.Step{{Container: corev1.Container{ + Name: "kubeconfig-9l9zj", + Image: "override-with-kubeconfig-writer:latest", + Command: []string{"/ko-app/kubeconfigwriter"}, + Args: []string{"-clusterConfig", `{"name":"test-cluster-resource","type":"cluster","url":"http://10.10.10.10","revision":"","username":"","password":"","namespace":"","token":"","Insecure":false,"cadata":null,"secrets":[{"fieldName":"cadata","secretKey":"cadatakey","secretName":"secret1"}]}`}, + Env: []corev1.EnvVar{{ + Name: "CADATA", + ValueFrom: &corev1.EnvVarSource{ + SecretKeyRef: &corev1.SecretKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "secret1", + }, + Key: "cadatakey", + }, + }, + }}, + }}} + + got, err := clusterResource.GetInputTaskModifier(&ts, "") + if err != nil { + t.Fatalf("GetDownloadSteps: %v", err) + } + if d := cmp.Diff(got.GetStepsToPrepend(), wantSteps); d != "" { + t.Errorf("Error mismatch between download steps: %s", d) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/cluster_task_defaults.go b/pkg/apis/pipeline/v1alpha2/cluster_task_defaults.go new file mode 100644 index 00000000000..eab58edb59e --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/cluster_task_defaults.go @@ -0,0 +1,25 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "context" +) + +func (t *ClusterTask) SetDefaults(ctx context.Context) { + t.Spec.SetDefaults(ctx) +} diff --git a/pkg/apis/pipeline/v1alpha2/cluster_task_types.go b/pkg/apis/pipeline/v1alpha2/cluster_task_types.go new file mode 100644 index 00000000000..fb086bf8d48 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/cluster_task_types.go @@ -0,0 +1,66 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/apis" +) + +// Check that Task may be validated and defaulted. +var _ apis.Validatable = (*ClusterTask)(nil) +var _ apis.Defaultable = (*ClusterTask)(nil) + +// +genclient +// +genclient:noStatus +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ClusterTask is a Task with a cluster scope. ClusterTasks are used to +// represent Tasks that should be publicly addressable from any namespace in the +// cluster. +type ClusterTask struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec holds the desired state of the Task from the client + // +optional + Spec TaskSpec `json:"spec,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ClusterTaskList contains a list of ClusterTask +type ClusterTaskList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterTask `json:"items"` +} + +func (t *ClusterTask) TaskSpec() TaskSpec { + return t.Spec +} + +func (t *ClusterTask) TaskMetadata() metav1.ObjectMeta { + return t.ObjectMeta +} + +func (t *ClusterTask) Copy() TaskInterface { + return t.DeepCopy() +} diff --git a/pkg/apis/pipeline/v1alpha2/cluster_task_validation.go b/pkg/apis/pipeline/v1alpha2/cluster_task_validation.go new file mode 100644 index 00000000000..79ca959d2c4 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/cluster_task_validation.go @@ -0,0 +1,30 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "context" + + "knative.dev/pkg/apis" +) + +func (t *ClusterTask) Validate(ctx context.Context) *apis.FieldError { + if err := validateObjectMetadata(t.GetObjectMeta()); err != nil { + return err.ViaField("metadata") + } + return t.Spec.Validate(ctx) +} diff --git a/pkg/apis/pipeline/v1alpha2/condition_defaults.go b/pkg/apis/pipeline/v1alpha2/condition_defaults.go new file mode 100644 index 00000000000..8bffdd43f26 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/condition_defaults.go @@ -0,0 +1,26 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import "context" + +func (c *Condition) SetDefaults(ctx context.Context) { + c.Spec.SetDefaults(ctx) +} + +func (cs *ConditionSpec) SetDefaults(ctx context.Context) { +} diff --git a/pkg/apis/pipeline/v1alpha2/condition_types.go b/pkg/apis/pipeline/v1alpha2/condition_types.go new file mode 100644 index 00000000000..76858f94c06 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/condition_types.go @@ -0,0 +1,112 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/apis" + duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" +) + +// Check that Task may be validated and defaulted. +var _ apis.Validatable = (*Condition)(nil) +var _ apis.Defaultable = (*Condition)(nil) + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Condition declares a step that is used to gate the execution of a Task in a Pipeline. +// A condition execution (ConditionCheck) evaluates to either true or false +// +k8s:openapi-gen=true +type Condition struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata"` + + // Spec holds the desired state of the Condition from the client + // +optional + Spec ConditionSpec `json:"spec"` +} + +// ConditionCheckStatus defines the observed state of ConditionCheck +type ConditionCheckStatus struct { + duckv1beta1.Status `json:",inline"` + + // PodName is the name of the pod responsible for executing this condition check. + PodName string `json:"podName"` + + // StartTime is the time the check is actually started. + // +optional + StartTime *metav1.Time `json:"startTime,omitempty"` + + // CompletionTime is the time the check pod completed. + // +optional + CompletionTime *metav1.Time `json:"completionTime,omitempty"` + + // Check describes the state of the check container. + // +optional + Check corev1.ContainerState `json:"check,omitempty"` +} + +// ConditionSpec defines the desired state of the Condition +type ConditionSpec struct { + // Check declares container whose exit code determines where a condition is true or false + Check corev1.Container `json:"check,omitempty"` + + // Params is an optional set of parameters which must be supplied by the user when a Condition + // is evaluated + // +optional + Params []ParamSpec `json:"params,omitempty"` + + // Resources is a list of the ConditionResources required to run the condition. + // +optional + Resources []ResourceDeclaration `json:"resources,omitempty"` +} + +// ConditionCheck represents a single evaluation of a Condition step. +type ConditionCheck TaskRun + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ConditionList contains a list of Conditions +type ConditionList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []Condition `json:"items"` +} + +func NewConditionCheck(tr *TaskRun) *ConditionCheck { + if tr == nil { + return nil + } + + cc := ConditionCheck(*tr) + return &cc +} + +// IsDone returns true if the ConditionCheck's status indicates that it is done. +func (cc *ConditionCheck) IsDone() bool { + return !cc.Status.GetCondition(apis.ConditionSucceeded).IsUnknown() +} + +// IsSuccessful returns true if the ConditionCheck's status indicates that it is done. +func (cc *ConditionCheck) IsSuccessful() bool { + return cc.Status.GetCondition(apis.ConditionSucceeded).IsTrue() +} diff --git a/pkg/apis/pipeline/v1alpha2/condition_types_test.go b/pkg/apis/pipeline/v1alpha2/condition_types_test.go new file mode 100644 index 00000000000..d8d5521b721 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/condition_types_test.go @@ -0,0 +1,55 @@ +/* + Copyright 2019 The Tekton Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package v1alpha2_test + +import ( + "testing" + + corev1 "k8s.io/api/core/v1" + "knative.dev/pkg/apis" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + tb "github.com/tektoncd/pipeline/test/builder" +) + +func TestConditionCheck_IsDone(t *testing.T) { + tr := tb.TaskRun("", "", tb.TaskRunStatus(tb.StatusCondition( + apis.Condition{ + Type: apis.ConditionSucceeded, + Status: corev1.ConditionFalse, + }, + ))) + + cc := v1alpha1.ConditionCheck(*tr) + if !cc.IsDone() { + t.Fatal("Expected conditionCheck status to be done") + } +} + +func TestConditionCheck_IsSuccessful(t *testing.T) { + tr := tb.TaskRun("", "", tb.TaskRunStatus(tb.StatusCondition( + apis.Condition{ + Type: apis.ConditionSucceeded, + Status: corev1.ConditionTrue, + }, + ))) + + cc := v1alpha1.ConditionCheck(*tr) + if !cc.IsSuccessful() { + t.Fatal("Expected conditionCheck status to be done") + } +} diff --git a/pkg/apis/pipeline/v1alpha2/condition_validation.go b/pkg/apis/pipeline/v1alpha2/condition_validation.go new file mode 100644 index 00000000000..b9348fa1ac9 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/condition_validation.go @@ -0,0 +1,42 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "context" + + "k8s.io/apimachinery/pkg/api/equality" + "knative.dev/pkg/apis" +) + +func (c Condition) Validate(ctx context.Context) *apis.FieldError { + if err := validateObjectMetadata(c.GetObjectMeta()); err != nil { + return err.ViaField("metadata") + } + return c.Spec.Validate(ctx).ViaField("Spec") +} + +func (cs *ConditionSpec) Validate(ctx context.Context) *apis.FieldError { + if equality.Semantic.DeepEqual(cs, ConditionSpec{}) { + return apis.ErrMissingField(apis.CurrentField) + } + + if cs.Check.Image == "" { + return apis.ErrMissingField("Check.Image") + } + return nil +} diff --git a/pkg/apis/pipeline/v1alpha2/condition_validation_test.go b/pkg/apis/pipeline/v1alpha2/condition_validation_test.go new file mode 100644 index 00000000000..4016acf560a --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/condition_validation_test.go @@ -0,0 +1,77 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "context" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "knative.dev/pkg/apis" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + tb "github.com/tektoncd/pipeline/test/builder" +) + +func TestCondition_Validate(t *testing.T) { + c := tb.Condition("condname", "foo", + tb.ConditionSpec( + tb.ConditionSpecCheck("cname", "ubuntu"), + tb.ConditionParamSpec("paramname", v1alpha1.ParamTypeString), + )) + + if err := c.Validate(context.Background()); err != nil { + t.Errorf("Condition.Validate() unexpected error = %v", err) + } +} + +func TestCondition_Invalidate(t *testing.T) { + tcs := []struct { + name string + cond *v1alpha1.Condition + expectedError apis.FieldError + }{{ + name: "invalid meta", + cond: tb.Condition("invalid.,name", ""), + expectedError: apis.FieldError{ + Message: "Invalid resource name: special character . must not be present", + Paths: []string{"metadata.name"}, + }, + }, { + name: "no image", + cond: tb.Condition("cond", "foo", tb.ConditionSpec( + tb.ConditionSpecCheck("", ""), + )), + expectedError: apis.FieldError{ + Message: "missing field(s)", + Paths: []string{"Spec.Check.Image"}, + }, + }} + + for _, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + err := tc.cond.Validate(context.Background()) + if err == nil { + t.Fatalf("Expected an Error, got nothing for %v", tc) + } + if d := cmp.Diff(tc.expectedError, *err, cmpopts.IgnoreUnexported(apis.FieldError{})); d != "" { + t.Errorf("Condition.Validate() errors diff -want, +got: %v", d) + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/contexts.go b/pkg/apis/pipeline/v1alpha2/contexts.go new file mode 100644 index 00000000000..54a95823688 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/contexts.go @@ -0,0 +1,54 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import "context" + +// hdcnKey is used as the key for associating information +// with a context.Context. +type hdcnKey struct{} + +// WithDefaultConfigurationName notes on the context for nested validation +// that there is a default configuration name, which affects how an empty +// configurationName is validated. +func WithDefaultConfigurationName(ctx context.Context) context.Context { + return context.WithValue(ctx, hdcnKey{}, struct{}{}) +} + +// HasDefaultConfigurationName checks to see whether the given context has +// been marked as having a default configurationName. +func HasDefaultConfigurationName(ctx context.Context) bool { + return ctx.Value(hdcnKey{}) != nil +} + +// lemonadeKey is used as the key for associating information +// with a context.Context. This variable doesn't really matter, so it's +// a total random name (for history purpose, used lemonade as it was written +// in an hot summer day). +type lemonadeKey struct{} + +// WithUpgradeViaDefaulting notes on the context that we want defaulting to rewrite +// from v1alpha1 pre-defaults to v1alpha1 post-defaults. +func WithUpgradeViaDefaulting(ctx context.Context) context.Context { + return context.WithValue(ctx, lemonadeKey{}, struct{}{}) +} + +// IsUpgradeViaDefaulting checks whether we should be "defaulting" from v1alpha1 pre-defaults to +// the v1alpha1 post-defaults subset. +func IsUpgradeViaDefaulting(ctx context.Context) bool { + return ctx.Value(lemonadeKey{}) != nil +} diff --git a/pkg/apis/pipeline/v1alpha2/dag.go b/pkg/apis/pipeline/v1alpha2/dag.go new file mode 100644 index 00000000000..f3c177d2a52 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/dag.go @@ -0,0 +1,136 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "strings" + + "golang.org/x/xerrors" +) + +// Node represents a Task in a pipeline. +type Node struct { + // Task represent the PipelineTask in Pipeline + Task PipelineTask + // Prev represent all the Previous task Nodes for the current Task + Prev []*Node + // Next represent all the Next task Nodes for the current Task + Next []*Node +} + +// DAG represents the Pipeline DAG +type DAG struct { + //Nodes represent map of PipelineTask name to Node in Pipeline DAG + Nodes map[string]*Node +} + +// Returns an empty Pipeline DAG +func newDAG() *DAG { + return &DAG{Nodes: map[string]*Node{}} +} + +func (g *DAG) addPipelineTask(t PipelineTask) (*Node, error) { + if _, ok := g.Nodes[t.Name]; ok { + return nil, xerrors.New("duplicate pipeline task") + } + newNode := &Node{ + Task: t, + } + g.Nodes[t.Name] = newNode + return newNode, nil +} + +func linkPipelineTasks(prev *Node, next *Node) error { + // Check for self cycle + if prev.Task.Name == next.Task.Name { + return xerrors.Errorf("cycle detected; task %q depends on itself", next.Task.Name) + } + // Check if we are adding cycles. + visited := map[string]bool{prev.Task.Name: true, next.Task.Name: true} + path := []string{next.Task.Name, prev.Task.Name} + if err := visit(next.Task.Name, prev.Prev, path, visited); err != nil { + return xerrors.Errorf("cycle detected: %w", err) + } + next.Prev = append(next.Prev, prev) + prev.Next = append(prev.Next, next) + return nil +} + +func visit(currentName string, nodes []*Node, path []string, visited map[string]bool) error { + for _, n := range nodes { + path = append(path, n.Task.Name) + if _, ok := visited[n.Task.Name]; ok { + return xerrors.New(getVisitedPath(path)) + } + visited[currentName+"."+n.Task.Name] = true + if err := visit(n.Task.Name, n.Prev, path, visited); err != nil { + return err + } + } + return nil +} + +func getVisitedPath(path []string) string { + // Reverse the path since we traversed the DAG using prev pointers. + for i := len(path)/2 - 1; i >= 0; i-- { + opp := len(path) - 1 - i + path[i], path[opp] = path[opp], path[i] + } + return strings.Join(path, " -> ") +} + +func addLink(pt PipelineTask, previousTask string, nodes map[string]*Node) error { + prev, ok := nodes[previousTask] + if !ok { + return xerrors.Errorf("Task %s depends on %s but %s wasn't present in Pipeline", pt.Name, previousTask, previousTask) + } + next := nodes[pt.Name] + if err := linkPipelineTasks(prev, next); err != nil { + return xerrors.Errorf("Couldn't create link from %s to %s: %w", prev.Task.Name, next.Task.Name, err) + } + return nil +} + +// BuildDAG returns a valid pipeline DAG. Returns error if the pipeline is invalid +func BuildDAG(tasks []PipelineTask) (*DAG, error) { + d := newDAG() + + // Add all Tasks mentioned in the `PipelineSpec` + for _, pt := range tasks { + if _, err := d.addPipelineTask(pt); err != nil { + return nil, xerrors.Errorf("task %s is already present in DAG, can't add it again: %w", pt.Name, err) + } + } + // Process all from and runAfter constraints to add task dependency + for _, pt := range tasks { + for _, previousTask := range pt.RunAfter { + if err := addLink(pt, previousTask, d.Nodes); err != nil { + return nil, xerrors.Errorf("couldn't add link between %s and %s: %w", pt.Name, previousTask, err) + } + } + if pt.Resources != nil { + for _, rd := range pt.Resources.Inputs { + for _, previousTask := range rd.From { + if err := addLink(pt, previousTask, d.Nodes); err != nil { + return nil, xerrors.Errorf("couldn't add link between %s and %s: %w", pt.Name, previousTask, err) + } + } + } + } + } + return d, nil +} diff --git a/pkg/apis/pipeline/v1alpha2/dag_test.go b/pkg/apis/pipeline/v1alpha2/dag_test.go new file mode 100644 index 00000000000..157182ddb74 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/dag_test.go @@ -0,0 +1,328 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "testing" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/list" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func sameNodes(l, r []*v1alpha1.Node) error { + lNames, rNames := []string{}, []string{} + for _, n := range l { + lNames = append(lNames, n.Task.Name) + } + for _, n := range r { + rNames = append(rNames, n.Task.Name) + } + + return list.IsSame(lNames, rNames) +} + +func assertSameDAG(t *testing.T, l, r *v1alpha1.DAG) { + t.Helper() + lKeys, rKeys := []string{}, []string{} + + for k := range l.Nodes { + lKeys = append(lKeys, k) + } + for k := range r.Nodes { + rKeys = append(rKeys, k) + } + + // For the DAGs to be the same, they must contain the same nodes + err := list.IsSame(lKeys, rKeys) + if err != nil { + t.Fatalf("DAGS contain different nodes: %v", err) + } + + // If they contain the same nodes, the DAGs will be the same if all + // of the nodes have the same linkages + for k, rn := range r.Nodes { + ln := l.Nodes[k] + + err := sameNodes(rn.Prev, ln.Prev) + if err != nil { + t.Errorf("The %s nodes in the DAG have different previous nodes: %v", k, err) + } + err = sameNodes(rn.Next, ln.Next) + if err != nil { + t.Errorf("The %s nodes in the DAG have different next nodes: %v", k, err) + } + } +} + +func TestBuild_Parallel(t *testing.T) { + a := v1alpha1.PipelineTask{Name: "a"} + b := v1alpha1.PipelineTask{Name: "b"} + c := v1alpha1.PipelineTask{Name: "c"} + + // This test make sure we can create a Pipeline with no links between any Tasks + // (all tasks run in parallel) + // a b c + p := &v1alpha1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1alpha1.PipelineSpec{ + Tasks: []v1alpha1.PipelineTask{a, b, c}, + }, + } + expectedDAG := &v1alpha1.DAG{ + Nodes: map[string]*v1alpha1.Node{ + "a": {Task: a}, + "b": {Task: b}, + "c": {Task: c}, + }, + } + g, err := v1alpha1.BuildDAG(p.Spec.Tasks) + if err != nil { + t.Fatalf("didn't expect error creating valid Pipeline %v but got %v", p, err) + } + assertSameDAG(t, expectedDAG, g) +} + +func TestBuild_JoinMultipleRoots(t *testing.T) { + a := v1alpha1.PipelineTask{Name: "a"} + b := v1alpha1.PipelineTask{Name: "b"} + c := v1alpha1.PipelineTask{Name: "c"} + xDependsOnA := v1alpha1.PipelineTask{ + Name: "x", + Resources: &v1alpha1.PipelineTaskResources{ + Inputs: []v1alpha1.PipelineTaskInputResource{{From: []string{"a"}}}, + }, + } + yDependsOnARunsAfterB := v1alpha1.PipelineTask{ + Name: "y", + RunAfter: []string{"b"}, + Resources: &v1alpha1.PipelineTaskResources{ + Inputs: []v1alpha1.PipelineTaskInputResource{{From: []string{"a"}}}, + }, + } + zDependsOnX := v1alpha1.PipelineTask{ + Name: "z", + Resources: &v1alpha1.PipelineTaskResources{ + Inputs: []v1alpha1.PipelineTaskInputResource{{From: []string{"x"}}}, + }, + } + + // a b c + // | \ / + // x y + // | + // z + + nodeA := &v1alpha1.Node{Task: a} + nodeB := &v1alpha1.Node{Task: b} + nodeC := &v1alpha1.Node{Task: c} + nodeX := &v1alpha1.Node{Task: xDependsOnA} + nodeY := &v1alpha1.Node{Task: yDependsOnARunsAfterB} + nodeZ := &v1alpha1.Node{Task: zDependsOnX} + + nodeA.Next = []*v1alpha1.Node{nodeX, nodeY} + nodeB.Next = []*v1alpha1.Node{nodeY} + nodeX.Prev = []*v1alpha1.Node{nodeA} + nodeX.Next = []*v1alpha1.Node{nodeZ} + nodeY.Prev = []*v1alpha1.Node{nodeA, nodeB} + nodeZ.Prev = []*v1alpha1.Node{nodeX} + + expectedDAG := &v1alpha1.DAG{ + Nodes: map[string]*v1alpha1.Node{ + "a": nodeA, + "b": nodeB, + "c": nodeC, + "x": nodeX, + "y": nodeY, + "z": nodeZ}, + } + p := &v1alpha1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1alpha1.PipelineSpec{ + Tasks: []v1alpha1.PipelineTask{a, xDependsOnA, yDependsOnARunsAfterB, zDependsOnX, b, c}, + }, + } + g, err := v1alpha1.BuildDAG(p.Spec.Tasks) + if err != nil { + t.Fatalf("didn't expect error creating valid Pipeline %v but got %v", p, err) + } + assertSameDAG(t, expectedDAG, g) +} + +func TestBuild_FanInFanOut(t *testing.T) { + a := v1alpha1.PipelineTask{Name: "a"} + dDependsOnA := v1alpha1.PipelineTask{ + Name: "d", + Resources: &v1alpha1.PipelineTaskResources{ + Inputs: []v1alpha1.PipelineTaskInputResource{{From: []string{"a"}}}, + }, + } + eRunsAfterA := v1alpha1.PipelineTask{ + Name: "e", + RunAfter: []string{"a"}, + } + fDependsOnDAndE := v1alpha1.PipelineTask{ + Name: "f", + Resources: &v1alpha1.PipelineTaskResources{ + Inputs: []v1alpha1.PipelineTaskInputResource{{From: []string{"d", "e"}}}, + }, + } + gRunsAfterF := v1alpha1.PipelineTask{ + Name: "g", + RunAfter: []string{"f"}, + } + + // This test make sure we don't detect cycle (A -> B -> B -> …) when there is not. + // This means we "visit" a twice, from two different path ; but there is no cycle. + // a + // / \ + // d e + // \ / + // f + // | + // g + nodeA := &v1alpha1.Node{Task: a} + nodeD := &v1alpha1.Node{Task: dDependsOnA} + nodeE := &v1alpha1.Node{Task: eRunsAfterA} + nodeF := &v1alpha1.Node{Task: fDependsOnDAndE} + nodeG := &v1alpha1.Node{Task: gRunsAfterF} + + nodeA.Next = []*v1alpha1.Node{nodeD, nodeE} + nodeD.Prev = []*v1alpha1.Node{nodeA} + nodeD.Next = []*v1alpha1.Node{nodeF} + nodeE.Prev = []*v1alpha1.Node{nodeA} + nodeE.Next = []*v1alpha1.Node{nodeF} + nodeF.Prev = []*v1alpha1.Node{nodeD, nodeE} + nodeF.Next = []*v1alpha1.Node{nodeG} + nodeG.Prev = []*v1alpha1.Node{nodeF} + + expectedDAG := &v1alpha1.DAG{ + Nodes: map[string]*v1alpha1.Node{ + "a": nodeA, + "d": nodeD, + "e": nodeE, + "f": nodeF, + "g": nodeG, + }, + } + p := &v1alpha1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, + Spec: v1alpha1.PipelineSpec{ + Tasks: []v1alpha1.PipelineTask{a, dDependsOnA, eRunsAfterA, fDependsOnDAndE, gRunsAfterF}, + }, + } + g, err := v1alpha1.BuildDAG(p.Spec.Tasks) + if err != nil { + t.Fatalf("didn't expect error creating valid Pipeline %v but got %v", p, err) + } + assertSameDAG(t, expectedDAG, g) +} + +func TestBuild_Invalid(t *testing.T) { + a := v1alpha1.PipelineTask{Name: "a"} + xDependsOnA := v1alpha1.PipelineTask{ + Name: "x", + Resources: &v1alpha1.PipelineTaskResources{ + Inputs: []v1alpha1.PipelineTaskInputResource{{From: []string{"a"}}}, + }, + } + zDependsOnX := v1alpha1.PipelineTask{ + Name: "z", + Resources: &v1alpha1.PipelineTaskResources{ + Inputs: []v1alpha1.PipelineTaskInputResource{{From: []string{"x"}}}, + }, + } + aDependsOnZ := v1alpha1.PipelineTask{ + Name: "a", + Resources: &v1alpha1.PipelineTaskResources{ + Inputs: []v1alpha1.PipelineTaskInputResource{{From: []string{"z"}}}, + }, + } + xAfterA := v1alpha1.PipelineTask{ + Name: "x", + RunAfter: []string{"a"}, + } + zAfterX := v1alpha1.PipelineTask{ + Name: "z", + RunAfter: []string{"x"}, + } + aAfterZ := v1alpha1.PipelineTask{ + Name: "a", + RunAfter: []string{"z"}, + } + selfLinkFrom := v1alpha1.PipelineTask{ + Name: "a", + Resources: &v1alpha1.PipelineTaskResources{ + Inputs: []v1alpha1.PipelineTaskInputResource{{From: []string{"a"}}}, + }, + } + selfLinkAfter := v1alpha1.PipelineTask{ + Name: "a", + RunAfter: []string{"a"}, + } + invalidTaskFrom := v1alpha1.PipelineTask{ + Name: "a", + Resources: &v1alpha1.PipelineTaskResources{ + Inputs: []v1alpha1.PipelineTaskInputResource{{From: []string{"none"}}}, + }, + } + invalidTaskAfter := v1alpha1.PipelineTask{ + Name: "a", + RunAfter: []string{"none"}, + } + + tcs := []struct { + name string + spec v1alpha1.PipelineSpec + }{{ + name: "self-link-from", + spec: v1alpha1.PipelineSpec{Tasks: []v1alpha1.PipelineTask{selfLinkFrom}}, + }, { + name: "self-link-after", + spec: v1alpha1.PipelineSpec{Tasks: []v1alpha1.PipelineTask{selfLinkAfter}}, + }, { + name: "cycle-from", + spec: v1alpha1.PipelineSpec{Tasks: []v1alpha1.PipelineTask{xDependsOnA, zDependsOnX, aDependsOnZ}}, + }, { + name: "cycle-runAfter", + spec: v1alpha1.PipelineSpec{Tasks: []v1alpha1.PipelineTask{xAfterA, zAfterX, aAfterZ}}, + }, { + name: "cycle-both", + spec: v1alpha1.PipelineSpec{Tasks: []v1alpha1.PipelineTask{xDependsOnA, zAfterX, aDependsOnZ}}, + }, { + name: "duplicate-tasks", + spec: v1alpha1.PipelineSpec{Tasks: []v1alpha1.PipelineTask{a, a}}, + }, { + name: "invalid-task-name-from", + spec: v1alpha1.PipelineSpec{Tasks: []v1alpha1.PipelineTask{invalidTaskFrom}}, + }, { + name: "invalid-task-name-after", + spec: v1alpha1.PipelineSpec{Tasks: []v1alpha1.PipelineTask{invalidTaskAfter}}, + }, + } + for _, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + p := &v1alpha1.Pipeline{ + ObjectMeta: metav1.ObjectMeta{Name: tc.name}, + Spec: tc.spec, + } + if _, err := v1alpha1.BuildDAG(p.Spec.Tasks); err == nil { + t.Errorf("expected to see an error for invalid DAG in pipeline %v but had none", tc.spec) + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/doc.go b/pkg/apis/pipeline/v1alpha2/doc.go new file mode 100644 index 00000000000..e4a37606fe4 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/doc.go @@ -0,0 +1,23 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// package v1alpha2 contains API Schema definitions for the pipeline v1alpha1 API group +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/tektoncd/pipeline/pkg/apis/pipeline +// +k8s:defaulter-gen=TypeMeta +// +groupName=tekton.dev +package v1alpha2 diff --git a/pkg/apis/pipeline/v1alpha2/gcs_resource.go b/pkg/apis/pipeline/v1alpha2/gcs_resource.go new file mode 100644 index 00000000000..2d8617b99a7 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/gcs_resource.go @@ -0,0 +1,162 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "fmt" + "path/filepath" + "strings" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline" + "github.com/tektoncd/pipeline/pkg/names" + "golang.org/x/xerrors" + corev1 "k8s.io/api/core/v1" +) + +var ( + gcsSecretVolumeMountPath = "/var/secret" +) + +// GCSResource is a GCS endpoint from which to get artifacts which is required +// by a Build/Task for context (e.g. a archive from which to build an image). +type GCSResource struct { + Name string `json:"name"` + Type PipelineResourceType `json:"type"` + Location string `json:"location"` + TypeDir bool `json:"typeDir"` + //Secret holds a struct to indicate a field name and corresponding secret name to populate it + Secrets []SecretParam `json:"secrets"` + + ShellImage string `json:"-"` + GsutilImage string `json:"-"` +} + +// NewGCSResource creates a new GCS resource to pass to a Task +func NewGCSResource(images pipeline.Images, r *PipelineResource) (*GCSResource, error) { + if r.Spec.Type != PipelineResourceTypeStorage { + return nil, xerrors.Errorf("GCSResource: Cannot create a GCS resource from a %s Pipeline Resource", r.Spec.Type) + } + var location string + var locationSpecified, dir bool + + for _, param := range r.Spec.Params { + switch { + case strings.EqualFold(param.Name, "Location"): + location = param.Value + if param.Value != "" { + locationSpecified = true + } + case strings.EqualFold(param.Name, "Dir"): + dir = true // if dir flag is present then its a dir + } + } + + if !locationSpecified { + return nil, xerrors.Errorf("GCSResource: Need Location to be specified in order to create GCS resource %s", r.Name) + } + return &GCSResource{ + Name: r.Name, + Type: r.Spec.Type, + Location: location, + TypeDir: dir, + Secrets: r.Spec.SecretParams, + ShellImage: images.ShellImage, + GsutilImage: images.GsutilImage, + }, nil +} + +// GetName returns the name of the resource +func (s GCSResource) GetName() string { + return s.Name +} + +// GetType returns the type of the resource, in this case "storage" +func (s GCSResource) GetType() PipelineResourceType { + return PipelineResourceTypeStorage +} + +// GetSecretParams returns the resource secret params +func (s *GCSResource) GetSecretParams() []SecretParam { return s.Secrets } + +// Replacements is used for template replacement on an GCSResource inside of a Taskrun. +func (s *GCSResource) Replacements() map[string]string { + return map[string]string{ + "name": s.Name, + "type": string(s.Type), + "location": s.Location, + } +} + +// GetOutputTaskModifier returns the TaskModifier to be used when this resource is an output. +func (s *GCSResource) GetOutputTaskModifier(ts *TaskSpec, path string) (TaskModifier, error) { + var args []string + if s.TypeDir { + args = []string{"rsync", "-d", "-r", path, s.Location} + } else { + args = []string{"cp", filepath.Join(path, "*"), s.Location} + } + + envVars, secretVolumeMount := getSecretEnvVarsAndVolumeMounts(s.Name, gcsSecretVolumeMountPath, s.Secrets) + + step := Step{Container: corev1.Container{ + Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf("upload-%s", s.Name)), + Image: s.GsutilImage, + Command: []string{"gsutil"}, + Args: args, + VolumeMounts: secretVolumeMount, + Env: envVars}, + } + + volumes := getStorageVolumeSpec(s, *ts) + + return &InternalTaskModifier{ + StepsToAppend: []Step{step}, + Volumes: volumes, + }, nil +} + +// GetInputTaskModifier returns the TaskModifier to be used when this resource is an input. +func (s *GCSResource) GetInputTaskModifier(ts *TaskSpec, path string) (TaskModifier, error) { + if path == "" { + return nil, xerrors.Errorf("GCSResource: Expect Destination Directory param to be set %s", s.Name) + } + var args []string + if s.TypeDir { + args = []string{"rsync", "-d", "-r", s.Location, path} + } else { + args = []string{"cp", s.Location, path} + } + + envVars, secretVolumeMount := getSecretEnvVarsAndVolumeMounts(s.Name, gcsSecretVolumeMountPath, s.Secrets) + steps := []Step{ + CreateDirStep(s.ShellImage, s.Name, path), + {Container: corev1.Container{ + Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf("fetch-%s", s.Name)), + Image: s.GsutilImage, + Command: []string{"gsutil"}, + Args: args, + Env: envVars, + VolumeMounts: secretVolumeMount, + }}} + + volumes := getStorageVolumeSpec(s, *ts) + + return &InternalTaskModifier{ + StepsToPrepend: steps, + Volumes: volumes, + }, nil +} diff --git a/pkg/apis/pipeline/v1alpha2/gcs_resource_test.go b/pkg/apis/pipeline/v1alpha2/gcs_resource_test.go new file mode 100644 index 00000000000..e6b6c39c303 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/gcs_resource_test.go @@ -0,0 +1,324 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + tb "github.com/tektoncd/pipeline/test/builder" + "github.com/tektoncd/pipeline/test/names" + corev1 "k8s.io/api/core/v1" +) + +func Test_Invalid_NewStorageResource(t *testing.T) { + for _, tc := range []struct { + name string + pipelineResource *v1alpha1.PipelineResource + }{{ + name: "wrong-resource-type", + pipelineResource: tb.PipelineResource("gcs-resource", "default", + tb.PipelineResourceSpec(v1alpha1.PipelineResourceTypeGit), + ), + }, { + name: "unimplemented type", + pipelineResource: tb.PipelineResource("gcs-resource", "default", + tb.PipelineResourceSpec(v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("Location", "gs://fake-bucket"), + tb.PipelineResourceSpecParam("type", "non-existent-type"), + ), + ), + }, { + name: "no type", + pipelineResource: tb.PipelineResource("gcs-resource", "default", + tb.PipelineResourceSpec(v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("Location", "gs://fake-bucket"), + ), + ), + }, { + name: "no location params", + pipelineResource: tb.PipelineResource("gcs-resource", "default", + tb.PipelineResourceSpec(v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("NotLocation", "doesntmatter"), + tb.PipelineResourceSpecParam("type", "gcs"), + ), + ), + }, { + name: "location param with empty value", + pipelineResource: tb.PipelineResource("gcs-resource", "default", + tb.PipelineResourceSpec(v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("Location", ""), + tb.PipelineResourceSpecParam("type", "gcs"), + ), + ), + }} { + t.Run(tc.name, func(t *testing.T) { + _, err := v1alpha1.NewStorageResource(images, tc.pipelineResource) + if err == nil { + t.Error("Expected error creating GCS resource") + } + }) + } +} + +func Test_Valid_NewGCSResource(t *testing.T) { + pr := tb.PipelineResource("gcs-resource", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("Location", "gs://fake-bucket"), + tb.PipelineResourceSpecParam("type", "gcs"), + tb.PipelineResourceSpecParam("dir", "anything"), + tb.PipelineResourceSpecSecretParam("GOOGLE_APPLICATION_CREDENTIALS", "secretName", "secretKey"), + )) + expectedGCSResource := &v1alpha1.GCSResource{ + Name: "gcs-resource", + Location: "gs://fake-bucket", + Type: v1alpha1.PipelineResourceTypeStorage, + TypeDir: true, + Secrets: []v1alpha1.SecretParam{{ + SecretName: "secretName", + SecretKey: "secretKey", + FieldName: "GOOGLE_APPLICATION_CREDENTIALS", + }}, + ShellImage: "busybox", + GsutilImage: "google/cloud-sdk", + } + + gcsRes, err := v1alpha1.NewGCSResource(images, pr) + if err != nil { + t.Fatalf("Unexpected error creating GCS resource: %s", err) + } + if d := cmp.Diff(expectedGCSResource, gcsRes); d != "" { + t.Errorf("Mismatch of GCS resource: %s", d) + } +} + +func Test_GCSGetReplacements(t *testing.T) { + gcsResource := &v1alpha1.GCSResource{ + Name: "gcs-resource", + Location: "gs://fake-bucket", + Type: v1alpha1.PipelineResourceTypeGCS, + } + expectedReplacementMap := map[string]string{ + "name": "gcs-resource", + "type": "gcs", + "location": "gs://fake-bucket", + } + if d := cmp.Diff(gcsResource.Replacements(), expectedReplacementMap); d != "" { + t.Errorf("GCS Replacement map mismatch: %s", d) + } +} + +func Test_GetParams(t *testing.T) { + pr := tb.PipelineResource("gcs-resource", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("Location", "gcs://some-bucket.zip"), + tb.PipelineResourceSpecParam("type", "gcs"), + tb.PipelineResourceSpecSecretParam("test-field-name", "test-secret-name", "test-secret-key"), + )) + gcsResource, err := v1alpha1.NewStorageResource(images, pr) + if err != nil { + t.Fatalf("Error creating storage resource: %s", err.Error()) + } + expectedSp := []v1alpha1.SecretParam{{ + SecretKey: "test-secret-key", + SecretName: "test-secret-name", + FieldName: "test-field-name", + }} + if d := cmp.Diff(gcsResource.GetSecretParams(), expectedSp); d != "" { + t.Errorf("Error mismatch on storage secret params: %s", d) + } +} + +func Test_GetInputSteps(t *testing.T) { + names.TestingSeed() + + for _, tc := range []struct { + name string + gcsResource *v1alpha1.GCSResource + wantSteps []v1alpha1.Step + wantErr bool + }{{ + name: "valid download protected buckets", + gcsResource: &v1alpha1.GCSResource{ + Name: "gcs-valid", + Location: "gs://some-bucket", + TypeDir: true, + Secrets: []v1alpha1.SecretParam{{ + SecretName: "secretName", + FieldName: "GOOGLE_APPLICATION_CREDENTIALS", + SecretKey: "key.json", + }}, + ShellImage: "busybox", + GsutilImage: "google/cloud-sdk", + }, + wantSteps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "create-dir-gcs-valid-9l9zj", + Image: "busybox", + Command: []string{"mkdir", "-p", "/workspace"}, + }}, {Container: corev1.Container{ + Name: "fetch-gcs-valid-mz4c7", + Image: "google/cloud-sdk", + Command: []string{"gsutil"}, + Args: []string{"rsync", "-d", "-r", "gs://some-bucket", "/workspace"}, + Env: []corev1.EnvVar{{ + Name: "GOOGLE_APPLICATION_CREDENTIALS", + Value: "/var/secret/secretName/key.json", + }}, + VolumeMounts: []corev1.VolumeMount{{ + Name: "volume-gcs-valid-secretName", + MountPath: "/var/secret/secretName", + }}, + }}}, + }, { + name: "duplicate secret mount paths", + gcsResource: &v1alpha1.GCSResource{ + Name: "gcs-valid", + Location: "gs://some-bucket", + Secrets: []v1alpha1.SecretParam{{ + SecretName: "secretName", + FieldName: "fieldName", + SecretKey: "key.json", + }, { + SecretKey: "key.json", + SecretName: "secretName", + FieldName: "GOOGLE_APPLICATION_CREDENTIALS", + }}, + ShellImage: "busybox", + GsutilImage: "google/cloud-sdk", + }, + wantSteps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "create-dir-gcs-valid-mssqb", + Image: "busybox", + Command: []string{"mkdir", "-p", "/workspace"}, + }}, {Container: corev1.Container{ + Name: "fetch-gcs-valid-78c5n", + Image: "google/cloud-sdk", + Command: []string{"gsutil"}, + Args: []string{"cp", "gs://some-bucket", "/workspace"}, + Env: []corev1.EnvVar{{ + Name: "GOOGLE_APPLICATION_CREDENTIALS", + Value: "/var/secret/secretName/key.json", + }}, + VolumeMounts: []corev1.VolumeMount{{ + Name: "volume-gcs-valid-secretName", + MountPath: "/var/secret/secretName", + }}, + }}}, + }} { + t.Run(tc.name, func(t *testing.T) { + ts := v1alpha1.TaskSpec{} + gotSpec, err := tc.gcsResource.GetInputTaskModifier(&ts, "/workspace") + if tc.wantErr && err == nil { + t.Fatalf("Expected error to be %t but got %v:", tc.wantErr, err) + } + if d := cmp.Diff(gotSpec.GetStepsToPrepend(), tc.wantSteps); d != "" { + t.Errorf("Error mismatch between download containers spec: %s", d) + } + }) + } +} + +func Test_GetOutputTaskModifier(t *testing.T) { + names.TestingSeed() + + for _, tc := range []struct { + name string + gcsResource *v1alpha1.GCSResource + wantSteps []v1alpha1.Step + wantErr bool + }{{ + name: "valid upload to protected buckets with directory paths", + gcsResource: &v1alpha1.GCSResource{ + Name: "gcs-valid", + Location: "gs://some-bucket", + TypeDir: true, + Secrets: []v1alpha1.SecretParam{{ + SecretName: "secretName", + FieldName: "GOOGLE_APPLICATION_CREDENTIALS", + SecretKey: "key.json", + }}, + GsutilImage: "google/cloud-sdk", + }, + wantSteps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "upload-gcs-valid-9l9zj", + Image: "google/cloud-sdk", + Command: []string{"gsutil"}, + Args: []string{"rsync", "-d", "-r", "/workspace/", "gs://some-bucket"}, + Env: []corev1.EnvVar{{Name: "GOOGLE_APPLICATION_CREDENTIALS", Value: "/var/secret/secretName/key.json"}}, + VolumeMounts: []corev1.VolumeMount{{ + Name: "volume-gcs-valid-secretName", + MountPath: "/var/secret/secretName", + }}, + }}}, + }, { + name: "duplicate secret mount paths", + gcsResource: &v1alpha1.GCSResource{ + Name: "gcs-valid", + Location: "gs://some-bucket", + Secrets: []v1alpha1.SecretParam{{ + SecretName: "secretName", + FieldName: "GOOGLE_APPLICATION_CREDENTIALS", + SecretKey: "key.json", + }, { + SecretKey: "key.json", + SecretName: "secretName", + FieldName: "GOOGLE_APPLICATION_CREDENTIALS", + }}, + GsutilImage: "google/cloud-sdk", + }, + wantSteps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "upload-gcs-valid-mz4c7", + Image: "google/cloud-sdk", + Command: []string{"gsutil"}, + Args: []string{"cp", "/workspace/*", "gs://some-bucket"}, + Env: []corev1.EnvVar{ + {Name: "GOOGLE_APPLICATION_CREDENTIALS", Value: "/var/secret/secretName/key.json"}, + }, + VolumeMounts: []corev1.VolumeMount{{ + Name: "volume-gcs-valid-secretName", + MountPath: "/var/secret/secretName", + }}, + }}}, + }, { + name: "valid upload to protected buckets with single file", + gcsResource: &v1alpha1.GCSResource{ + Name: "gcs-valid", + Location: "gs://some-bucket", + TypeDir: false, + GsutilImage: "google/cloud-sdk", + }, + wantSteps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "upload-gcs-valid-mssqb", + Image: "google/cloud-sdk", + Command: []string{"gsutil"}, + Args: []string{"cp", "/workspace/*", "gs://some-bucket"}, + }}}, + }} { + t.Run(tc.name, func(t *testing.T) { + ts := v1alpha1.TaskSpec{} + got, err := tc.gcsResource.GetOutputTaskModifier(&ts, "/workspace/") + if (err != nil) != tc.wantErr { + t.Fatalf("Expected error to be %t but got %v:", tc.wantErr, err) + } + + if d := cmp.Diff(got.GetStepsToAppend(), tc.wantSteps); d != "" { + t.Errorf("Error mismatch between upload containers spec: %s", d) + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/git_resource.go b/pkg/apis/pipeline/v1alpha2/git_resource.go new file mode 100644 index 00000000000..1c31860f4ac --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/git_resource.go @@ -0,0 +1,127 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "strings" + + "github.com/tektoncd/pipeline/pkg/names" + "golang.org/x/xerrors" + corev1 "k8s.io/api/core/v1" +) + +const WorkspaceDir = "/workspace" + +var ( + gitSource = "git-source" +) + +// GitResource 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 GitResource struct { + Name string `json:"name"` + Type PipelineResourceType `json:"type"` + URL string `json:"url"` + // Git revision (branch, tag, commit SHA or ref) to clone. See + // https://git-scm.com/docs/gitrevisions#_specifying_revisions for more + // information. + Revision string `json:"revision"` + + GitImage string `json:"-"` +} + +// NewGitResource creates a new git resource to pass to a Task +func NewGitResource(gitImage string, r *PipelineResource) (*GitResource, error) { + if r.Spec.Type != PipelineResourceTypeGit { + return nil, xerrors.Errorf("GitResource: Cannot create a Git resource from a %s Pipeline Resource", r.Spec.Type) + } + gitResource := GitResource{ + Name: r.Name, + Type: r.Spec.Type, + GitImage: gitImage, + } + for _, param := range r.Spec.Params { + switch { + case strings.EqualFold(param.Name, "URL"): + gitResource.URL = param.Value + case strings.EqualFold(param.Name, "Revision"): + gitResource.Revision = param.Value + } + } + // default revision to master if nothing is provided + if gitResource.Revision == "" { + gitResource.Revision = "master" + } + return &gitResource, nil +} + +// GetName returns the name of the resource +func (s GitResource) GetName() string { + return s.Name +} + +// GetType returns the type of the resource, in this case "Git" +func (s GitResource) GetType() PipelineResourceType { + return PipelineResourceTypeGit +} + +// GetURL returns the url to be used with this resource +func (s *GitResource) GetURL() string { + return s.URL +} + +// Replacements is used for template replacement on a GitResource inside of a Taskrun. +func (s *GitResource) Replacements() map[string]string { + return map[string]string{ + "name": s.Name, + "type": string(s.Type), + "url": s.URL, + "revision": s.Revision, + } +} + +// GetInputTaskModifier returns the TaskModifier to be used when this resource is an input. +func (s *GitResource) GetInputTaskModifier(_ *TaskSpec, path string) (TaskModifier, error) { + args := []string{"-url", s.URL, + "-revision", s.Revision, + } + + args = append(args, []string{"-path", path}...) + + step := Step{ + Container: corev1.Container{ + Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(gitSource + "-" + s.Name), + Image: s.GitImage, + Command: []string{"/ko-app/git-init"}, + Args: args, + WorkingDir: WorkspaceDir, + // This is used to populate the ResourceResult status. + Env: []corev1.EnvVar{{ + Name: "TEKTON_RESOURCE_NAME", + Value: s.Name, + }}, + }, + } + return &InternalTaskModifier{ + StepsToPrepend: []Step{step}, + }, nil +} + +// GetOutputTaskModifier returns a No-op TaskModifier. +func (s *GitResource) GetOutputTaskModifier(_ *TaskSpec, _ string) (TaskModifier, error) { + return &InternalTaskModifier{}, nil +} diff --git a/pkg/apis/pipeline/v1alpha2/git_resource_test.go b/pkg/apis/pipeline/v1alpha2/git_resource_test.go new file mode 100644 index 00000000000..cd676072f2b --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/git_resource_test.go @@ -0,0 +1,141 @@ +/* +Copyright 2019 The Tekton Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + tb "github.com/tektoncd/pipeline/test/builder" + "github.com/tektoncd/pipeline/test/names" + corev1 "k8s.io/api/core/v1" +) + +func Test_Invalid_NewGitResource(t *testing.T) { + if _, err := v1alpha1.NewGitResource("override-with-git:latest", tb.PipelineResource("git-resource", "default", tb.PipelineResourceSpec(v1alpha1.PipelineResourceTypeGCS))); err == nil { + t.Error("Expected error creating Git resource") + } +} + +func Test_Valid_NewGitResource(t *testing.T) { + for _, tc := range []struct { + desc string + pipelineResource *v1alpha1.PipelineResource + want *v1alpha1.GitResource + }{{ + desc: "With Revision", + pipelineResource: tb.PipelineResource("git-resource", "default", + tb.PipelineResourceSpec(v1alpha1.PipelineResourceTypeGit, + tb.PipelineResourceSpecParam("URL", "git@github.com:test/test.git"), + tb.PipelineResourceSpecParam("Revision", "test"), + ), + ), + want: &v1alpha1.GitResource{ + Name: "git-resource", + Type: v1alpha1.PipelineResourceTypeGit, + URL: "git@github.com:test/test.git", + Revision: "test", + GitImage: "override-with-git:latest", + }, + }, { + desc: "Without Revision", + pipelineResource: tb.PipelineResource("git-resource", "default", + tb.PipelineResourceSpec(v1alpha1.PipelineResourceTypeGit, + tb.PipelineResourceSpecParam("URL", "git@github.com:test/test.git"), + ), + ), + want: &v1alpha1.GitResource{ + Name: "git-resource", + Type: v1alpha1.PipelineResourceTypeGit, + URL: "git@github.com:test/test.git", + Revision: "master", + GitImage: "override-with-git:latest", + }, + }} { + t.Run(tc.desc, func(t *testing.T) { + got, err := v1alpha1.NewGitResource("override-with-git:latest", tc.pipelineResource) + if err != nil { + t.Fatalf("Unexpected error creating Git resource: %s", err) + } + + if diff := cmp.Diff(tc.want, got); diff != "" { + t.Errorf("Mismatch of Git resource: %s", diff) + } + }) + } +} + +func Test_GitResource_Replacements(t *testing.T) { + r := &v1alpha1.GitResource{ + Name: "git-resource", + Type: v1alpha1.PipelineResourceTypeGit, + URL: "git@github.com:test/test.git", + Revision: "master", + } + + want := map[string]string{ + "name": "git-resource", + "type": string(v1alpha1.PipelineResourceTypeGit), + "url": "git@github.com:test/test.git", + "revision": "master", + } + + got := r.Replacements() + + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("Mismatch of GitResource Replacements: %s", diff) + } +} + +func Test_GitResource_GetDownloadTaskModifier(t *testing.T) { + names.TestingSeed() + + r := &v1alpha1.GitResource{ + Name: "git-resource", + Type: v1alpha1.PipelineResourceTypeGit, + URL: "git@github.com:test/test.git", + Revision: "master", + GitImage: "override-with-git:latest", + } + + ts := v1alpha1.TaskSpec{} + modifier, err := r.GetInputTaskModifier(&ts, "/test/test") + if err != nil { + t.Fatalf("Unexpected error getting GetDownloadTaskModifier: %s", err) + } + + want := []v1alpha1.Step{{Container: corev1.Container{ + Name: "git-source-git-resource-9l9zj", + Image: "override-with-git:latest", + Command: []string{"/ko-app/git-init"}, + Args: []string{ + "-url", + "git@github.com:test/test.git", + "-revision", + "master", + "-path", + "/test/test", + }, + WorkingDir: "/workspace", + Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "git-resource"}}, + }}} + + if diff := cmp.Diff(want, modifier.GetStepsToPrepend()); diff != "" { + t.Errorf("Mismatch of GitResource DownloadContainerSpec: %s", diff) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/image_resource.go b/pkg/apis/pipeline/v1alpha2/image_resource.go new file mode 100644 index 00000000000..7c32b769e48 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/image_resource.go @@ -0,0 +1,93 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "encoding/json" + "strings" + + "golang.org/x/xerrors" +) + +// NewImageResource creates a new ImageResource from a PipelineResource. +func NewImageResource(r *PipelineResource) (*ImageResource, error) { + if r.Spec.Type != PipelineResourceTypeImage { + return nil, xerrors.Errorf("ImageResource: Cannot create an Image resource from a %s Pipeline Resource", r.Spec.Type) + } + ir := &ImageResource{ + Name: r.Name, + Type: PipelineResourceTypeImage, + } + + for _, param := range r.Spec.Params { + switch { + case strings.EqualFold(param.Name, "URL"): + ir.URL = param.Value + case strings.EqualFold(param.Name, "Digest"): + ir.Digest = param.Value + } + } + + return ir, nil +} + +// ImageResource defines an endpoint where artifacts can be stored, such as images. +type ImageResource struct { + Name string `json:"name"` + Type PipelineResourceType `json:"type"` + URL string `json:"url"` + Digest string `json:"digest"` + OutputImageDir string +} + +// GetName returns the name of the resource +func (s ImageResource) GetName() string { + return s.Name +} + +// GetType returns the type of the resource, in this case "image" +func (s ImageResource) GetType() PipelineResourceType { + return PipelineResourceTypeImage +} + +// Replacements is used for template replacement on an ImageResource inside of a Taskrun. +func (s *ImageResource) Replacements() map[string]string { + return map[string]string{ + "name": s.Name, + "type": string(s.Type), + "url": s.URL, + "digest": s.Digest, + } +} + +// GetInputTaskModifier returns the TaskModifier to be used when this resource is an input. +func (s *ImageResource) GetInputTaskModifier(_ *TaskSpec, _ string) (TaskModifier, error) { + return &InternalTaskModifier{}, nil +} + +// GetOutputTaskModifier returns a No-op TaskModifier. +func (s *ImageResource) GetOutputTaskModifier(_ *TaskSpec, _ string) (TaskModifier, error) { + return &InternalTaskModifier{}, nil +} + +func (s ImageResource) String() string { + // the String() func implements the Stringer interface, and therefore + // cannot return an error + // if the Marshal func gives an error, the returned string will be empty + json, _ := json.Marshal(s) + return string(json) +} diff --git a/pkg/apis/pipeline/v1alpha2/image_resource_test.go b/pkg/apis/pipeline/v1alpha2/image_resource_test.go new file mode 100644 index 00000000000..815c7d50fb0 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/image_resource_test.go @@ -0,0 +1,85 @@ +/* +Copyright 2019 The Tekton Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + tb "github.com/tektoncd/pipeline/test/builder" +) + +func Test_Invalid_NewImageResource(t *testing.T) { + r := tb.PipelineResource("git-resource", "default", tb.PipelineResourceSpec(v1alpha1.PipelineResourceTypeGit)) + + _, err := v1alpha1.NewImageResource(r) + if err == nil { + t.Error("Expected error creating Image resource") + } +} + +func Test_Valid_NewImageResource(t *testing.T) { + want := &v1alpha1.ImageResource{ + Name: "image-resource", + Type: v1alpha1.PipelineResourceTypeImage, + URL: "https://test.com/test/test", + Digest: "test", + } + + r := tb.PipelineResource( + "image-resource", + "default", + tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeImage, + tb.PipelineResourceSpecParam("URL", "https://test.com/test/test"), + tb.PipelineResourceSpecParam("Digest", "test"), + ), + ) + + got, err := v1alpha1.NewImageResource(r) + if err != nil { + t.Fatalf("Unexpected error creating Image resource: %s", err) + } + + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("Mismatch of Image resource: %s", diff) + } +} + +func Test_ImageResource_Replacements(t *testing.T) { + ir := &v1alpha1.ImageResource{ + Name: "image-resource", + Type: v1alpha1.PipelineResourceTypeImage, + URL: "https://test.com/test/test", + Digest: "test", + } + + want := map[string]string{ + "name": "image-resource", + "type": string(v1alpha1.PipelineResourceTypeImage), + "url": "https://test.com/test/test", + "digest": "test", + } + + got := ir.Replacements() + + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("Mismatch of ImageResource Replacements: %s", diff) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/merge.go b/pkg/apis/pipeline/v1alpha2/merge.go new file mode 100644 index 00000000000..a3333fc3836 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/merge.go @@ -0,0 +1,90 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "encoding/json" + + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/util/strategicpatch" +) + +// MergeStepsWithStepTemplate takes a possibly nil container template and a +// list of steps, merging each of the steps with the container template, if +// it's not nil, and returning the resulting list. +func MergeStepsWithStepTemplate(template *v1.Container, steps []Step) ([]Step, error) { + if template == nil { + return steps, nil + } + + // We need JSON bytes to generate a patch to merge the step containers + // onto the template container, so marshal the template. + templateAsJSON, err := json.Marshal(template) + if err != nil { + return nil, err + } + // We need to do a three-way merge to actually merge the template and + // step containers, so we need an empty container as the "original" + emptyAsJSON, err := json.Marshal(&v1.Container{}) + if err != nil { + return nil, err + } + + for i, s := range steps { + // Marshal the step's to JSON + stepAsJSON, err := json.Marshal(s.Container) + if err != nil { + return nil, err + } + + // Get the patch meta for Container, which is needed for generating and applying the merge patch. + patchSchema, err := strategicpatch.NewPatchMetaFromStruct(template) + + if err != nil { + return nil, err + } + + // Create a merge patch, with the empty JSON as the original, the step JSON as the modified, and the template + // JSON as the current - this lets us do a deep merge of the template and step containers, with awareness of + // the "patchMerge" tags. + patch, err := strategicpatch.CreateThreeWayMergePatch(emptyAsJSON, stepAsJSON, templateAsJSON, patchSchema, true) + if err != nil { + return nil, err + } + + // Actually apply the merge patch to the template JSON. + mergedAsJSON, err := strategicpatch.StrategicMergePatchUsingLookupPatchMeta(templateAsJSON, patch, patchSchema) + if err != nil { + return nil, err + } + + // Unmarshal the merged JSON to a Container pointer, and return it. + merged := &v1.Container{} + err = json.Unmarshal(mergedAsJSON, merged) + if err != nil { + return nil, err + } + + // If the container's args is nil, reset it to empty instead + if merged.Args == nil && s.Args != nil { + merged.Args = []string{} + } + + steps[i] = Step{Container: *merged} + } + return steps, nil +} diff --git a/pkg/apis/pipeline/v1alpha2/merge_test.go b/pkg/apis/pipeline/v1alpha2/merge_test.go new file mode 100644 index 00000000000..1f8ea6fbd4f --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/merge_test.go @@ -0,0 +1,115 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" +) + +func TestMergeStepsWithStepTemplate(t *testing.T) { + resourceQuantityCmp := cmp.Comparer(func(x, y resource.Quantity) bool { + return x.Cmp(y) == 0 + }) + + for _, tc := range []struct { + name string + template *corev1.Container + steps []Step + expected []Step + }{{ + name: "nil-template", + template: nil, + steps: []Step{{Container: corev1.Container{ + Image: "some-image", + }}}, + expected: []Step{{Container: corev1.Container{ + Image: "some-image", + }}}, + }, { + name: "not-overlapping", + template: &corev1.Container{ + Command: []string{"/somecmd"}, + }, + steps: []Step{{Container: corev1.Container{ + Image: "some-image", + }}}, + expected: []Step{{Container: corev1.Container{ + Command: []string{"/somecmd"}, + Image: "some-image", + }}}, + }, { + name: "overwriting-one-field", + template: &corev1.Container{ + Image: "some-image", + Command: []string{"/somecmd"}, + }, + steps: []Step{{Container: corev1.Container{ + Image: "some-other-image", + }}}, + expected: []Step{{Container: corev1.Container{ + Command: []string{"/somecmd"}, + Image: "some-other-image", + }}}, + }, { + name: "merge-and-overwrite-slice", + template: &corev1.Container{ + Env: []corev1.EnvVar{{ + Name: "KEEP_THIS", + Value: "A_VALUE", + }, { + Name: "SOME_KEY", + Value: "ORIGINAL_VALUE", + }}, + }, + steps: []Step{{Container: corev1.Container{ + Env: []corev1.EnvVar{{ + Name: "NEW_KEY", + Value: "A_VALUE", + }, { + Name: "SOME_KEY", + Value: "NEW_VALUE", + }}, + }}}, + expected: []Step{{Container: corev1.Container{ + Env: []corev1.EnvVar{{ + Name: "NEW_KEY", + Value: "A_VALUE", + }, { + Name: "KEEP_THIS", + Value: "A_VALUE", + }, { + Name: "SOME_KEY", + Value: "NEW_VALUE", + }}, + }}}, + }} { + t.Run(tc.name, func(t *testing.T) { + result, err := MergeStepsWithStepTemplate(tc.template, tc.steps) + if err != nil { + t.Errorf("expected no error. Got error %v", err) + } + + if d := cmp.Diff(tc.expected, result, resourceQuantityCmp); d != "" { + t.Errorf("merged steps don't match, diff: %s", d) + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/metadata_validation.go b/pkg/apis/pipeline/v1alpha2/metadata_validation.go new file mode 100644 index 00000000000..56cecbed60a --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/metadata_validation.go @@ -0,0 +1,45 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "strings" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/apis" +) + +const maxLength = 63 + +func validateObjectMetadata(meta metav1.Object) *apis.FieldError { + name := meta.GetName() + + if strings.Contains(name, ".") { + return &apis.FieldError{ + Message: "Invalid resource name: special character . must not be present", + Paths: []string{"name"}, + } + } + + if len(name) > maxLength { + return &apis.FieldError{ + Message: "Invalid resource name: length must be no more than 63 characters", + Paths: []string{"name"}, + } + } + return nil +} diff --git a/pkg/apis/pipeline/v1alpha2/metadata_validation_test.go b/pkg/apis/pipeline/v1alpha2/metadata_validation_test.go new file mode 100644 index 00000000000..4846f71bfc9 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/metadata_validation_test.go @@ -0,0 +1,37 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "strings" + "testing" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func TestMetadataInvalidLongName(t *testing.T) { + + invalidMetas := []*metav1.ObjectMeta{ + {Name: strings.Repeat("s", maxLength+1)}, + {Name: "bad.name"}, + } + for _, invalidMeta := range invalidMetas { + if err := validateObjectMetadata(invalidMeta); err == nil { + t.Errorf("Failed to validate object meta data: %s", err) + } + } +} diff --git a/pkg/apis/pipeline/v1alpha2/param_types.go b/pkg/apis/pipeline/v1alpha2/param_types.go new file mode 100644 index 00000000000..59346995aab --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/param_types.go @@ -0,0 +1,127 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "context" + "encoding/json" + "fmt" +) + +// ParamSpec defines arbitrary parameters needed beyond typed inputs (such as +// resources). Parameter values are provided by users as inputs on a TaskRun +// or PipelineRun. +type ParamSpec struct { + // Name declares the name by which a parameter is referenced. + Name string `json:"name"` + // Type is the user-specified type of the parameter. The possible types + // are currently "string" and "array", and "string" is the default. + // +optional + Type ParamType `json:"type,omitempty"` + // Description is a user-facing description of the parameter that may be + // used to populate a UI. + // +optional + Description string `json:"description,omitempty"` + // Default is the value a parameter takes if no input value is supplied. If + // default is set, a Task may be executed without a supplied value for the + // parameter. + // +optional + Default *ArrayOrString `json:"default,omitempty"` +} + +func (pp *ParamSpec) SetDefaults(ctx context.Context) { + if pp != nil && pp.Type == "" { + if pp.Default != nil { + // propagate the parsed ArrayOrString's type to the parent ParamSpec's type + pp.Type = pp.Default.Type + } else { + // ParamTypeString is the default value (when no type can be inferred from the default value) + pp.Type = ParamTypeString + } + } +} + +// ResourceParam declares a string value to use for the parameter called Name, and is used in +// the specific context of PipelineResources. +type ResourceParam struct { + Name string `json:"name"` + Value string `json:"value"` +} + +// Param declares an ArrayOrString to use for the parameter called name. +type Param struct { + Name string `json:"name"` + Value ArrayOrString `json:"value"` +} + +// ParamType indicates the type of an input parameter; +// Used to distinguish between a single string and an array of strings. +type ParamType string + +// Valid ParamTypes: +const ( + ParamTypeString ParamType = "string" + ParamTypeArray ParamType = "array" +) + +// AllParamTypes can be used for ParamType validation. +var AllParamTypes = []ParamType{ParamTypeString, ParamTypeArray} + +// ArrayOrString is modeled after IntOrString in kubernetes/apimachinery: + +// ArrayOrString is a type that can hold a single string or string array. +// Used in JSON unmarshalling so that a single JSON field can accept +// either an individual string or an array of strings. +type ArrayOrString struct { + Type ParamType // Represents the stored type of ArrayOrString. + StringVal string + ArrayVal []string +} + +// UnmarshalJSON implements the json.Unmarshaller interface. +func (arrayOrString *ArrayOrString) UnmarshalJSON(value []byte) error { + if value[0] == '"' { + arrayOrString.Type = ParamTypeString + return json.Unmarshal(value, &arrayOrString.StringVal) + } + arrayOrString.Type = ParamTypeArray + return json.Unmarshal(value, &arrayOrString.ArrayVal) +} + +// MarshalJSON implements the json.Marshaller interface. +func (arrayOrString ArrayOrString) MarshalJSON() ([]byte, error) { + switch arrayOrString.Type { + case ParamTypeString: + return json.Marshal(arrayOrString.StringVal) + case ParamTypeArray: + return json.Marshal(arrayOrString.ArrayVal) + default: + return []byte{}, fmt.Errorf("impossible ArrayOrString.Type: %q", arrayOrString.Type) + } +} + +func (arrayOrString *ArrayOrString) ApplyReplacements(stringReplacements map[string]string, arrayReplacements map[string][]string) { + if arrayOrString.Type == ParamTypeString { + arrayOrString.StringVal = ApplyReplacements(arrayOrString.StringVal, stringReplacements) + } else { + var newArrayVal []string + for _, v := range arrayOrString.ArrayVal { + newArrayVal = append(newArrayVal, ApplyArrayReplacements(v, stringReplacements, arrayReplacements)...) + } + arrayOrString.ArrayVal = newArrayVal + } +} diff --git a/pkg/apis/pipeline/v1alpha2/param_types_test.go b/pkg/apis/pipeline/v1alpha2/param_types_test.go new file mode 100644 index 00000000000..f41f2656747 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/param_types_test.go @@ -0,0 +1,189 @@ +/* +Copyright 2019 The Tekton Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "context" + "encoding/json" + "reflect" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/test/builder" +) + +func TestParamSpec_SetDefaults(t *testing.T) { + tests := []struct { + name string + before *v1alpha1.ParamSpec + defaultsApplied *v1alpha1.ParamSpec + }{{ + name: "inferred string type", + before: &v1alpha1.ParamSpec{ + Name: "parametername", + }, + defaultsApplied: &v1alpha1.ParamSpec{ + Name: "parametername", + Type: v1alpha1.ParamTypeString, + }, + }, { + name: "inferred type from default value", + before: &v1alpha1.ParamSpec{ + Name: "parametername", + Default: builder.ArrayOrString("an", "array"), + }, + defaultsApplied: &v1alpha1.ParamSpec{ + Name: "parametername", + Type: v1alpha1.ParamTypeArray, + Default: builder.ArrayOrString("an", "array"), + }, + }, { + name: "fully defined ParamSpec", + before: &v1alpha1.ParamSpec{ + Name: "parametername", + Type: v1alpha1.ParamTypeArray, + Description: "a description", + Default: builder.ArrayOrString("an", "array"), + }, + defaultsApplied: &v1alpha1.ParamSpec{ + Name: "parametername", + Type: v1alpha1.ParamTypeArray, + Description: "a description", + Default: builder.ArrayOrString("an", "array"), + }, + }} + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + ctx := context.Background() + tc.before.SetDefaults(ctx) + if d := cmp.Diff(tc.before, tc.defaultsApplied); d != "" { + t.Errorf("ParamSpec.SetDefaults/%s (-want, +got) = %v", tc.name, d) + } + }) + } +} + +func TestArrayOrString_ApplyReplacements(t *testing.T) { + type args struct { + input *v1alpha1.ArrayOrString + stringReplacements map[string]string + arrayReplacements map[string][]string + } + tests := []struct { + name string + args args + expectedOutput *v1alpha1.ArrayOrString + }{{ + name: "no replacements on array", + args: args{ + input: builder.ArrayOrString("an", "array"), + stringReplacements: map[string]string{"some": "value", "anotherkey": "value"}, + arrayReplacements: map[string][]string{"arraykey": {"array", "value"}, "sdfdf": {"sdf", "sdfsd"}}, + }, + expectedOutput: builder.ArrayOrString("an", "array"), + }, { + name: "string replacements on string", + args: args{ + input: builder.ArrayOrString("astring$(some) asdf $(anotherkey)"), + stringReplacements: map[string]string{"some": "value", "anotherkey": "value"}, + arrayReplacements: map[string][]string{"arraykey": {"array", "value"}, "sdfdf": {"asdf", "sdfsd"}}, + }, + expectedOutput: builder.ArrayOrString("astringvalue asdf value"), + }, { + name: "single array replacement", + args: args{ + input: builder.ArrayOrString("firstvalue", "$(arraykey)", "lastvalue"), + stringReplacements: map[string]string{"some": "value", "anotherkey": "value"}, + arrayReplacements: map[string][]string{"arraykey": {"array", "value"}, "sdfdf": {"asdf", "sdfsd"}}, + }, + expectedOutput: builder.ArrayOrString("firstvalue", "array", "value", "lastvalue"), + }, { + name: "multiple array replacement", + args: args{ + input: builder.ArrayOrString("firstvalue", "$(arraykey)", "lastvalue", "$(sdfdf)"), + stringReplacements: map[string]string{"some": "value", "anotherkey": "value"}, + arrayReplacements: map[string][]string{"arraykey": {"array", "value"}, "sdfdf": {"asdf", "sdfsd"}}, + }, + expectedOutput: builder.ArrayOrString("firstvalue", "array", "value", "lastvalue", "asdf", "sdfsd"), + }, { + name: "empty array replacement", + args: args{ + input: builder.ArrayOrString("firstvalue", "$(arraykey)", "lastvalue"), + stringReplacements: map[string]string{"some": "value", "anotherkey": "value"}, + arrayReplacements: map[string][]string{"arraykey": {}}, + }, + expectedOutput: builder.ArrayOrString("firstvalue", "lastvalue"), + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.args.input.ApplyReplacements(tt.args.stringReplacements, tt.args.arrayReplacements) + if d := cmp.Diff(tt.expectedOutput, tt.args.input); d != "" { + t.Errorf("ApplyReplacements() output did not match expected value %s", d) + } + }) + } +} + +type ArrayOrStringHolder struct { + AOrS v1alpha1.ArrayOrString `json:"val"` +} + +func TestArrayOrString_UnmarshalJSON(t *testing.T) { + cases := []struct { + input string + result v1alpha1.ArrayOrString + }{ + {"{\"val\": \"123\"}", *builder.ArrayOrString("123")}, + {"{\"val\": \"\"}", *builder.ArrayOrString("")}, + {"{\"val\":[]}", v1alpha1.ArrayOrString{Type: v1alpha1.ParamTypeArray, ArrayVal: []string{}}}, + {"{\"val\":[\"oneelement\"]}", v1alpha1.ArrayOrString{Type: v1alpha1.ParamTypeArray, ArrayVal: []string{"oneelement"}}}, + {"{\"val\":[\"multiple\", \"elements\"]}", v1alpha1.ArrayOrString{Type: v1alpha1.ParamTypeArray, ArrayVal: []string{"multiple", "elements"}}}, + } + + for _, c := range cases { + var result ArrayOrStringHolder + if err := json.Unmarshal([]byte(c.input), &result); err != nil { + t.Errorf("Failed to unmarshal input '%v': %v", c.input, err) + } + if !reflect.DeepEqual(result.AOrS, c.result) { + t.Errorf("Failed to unmarshal input '%v': expected %+v, got %+v", c.input, c.result, result) + } + } +} + +func TestArrayOrString_MarshalJSON(t *testing.T) { + cases := []struct { + input v1alpha1.ArrayOrString + result string + }{ + {*builder.ArrayOrString("123"), "{\"val\":\"123\"}"}, + {*builder.ArrayOrString("123", "1234"), "{\"val\":[\"123\",\"1234\"]}"}, + {*builder.ArrayOrString("a", "a", "a"), "{\"val\":[\"a\",\"a\",\"a\"]}"}, + } + + for _, c := range cases { + input := ArrayOrStringHolder{c.input} + result, err := json.Marshal(&input) + if err != nil { + t.Errorf("Failed to marshal input '%v': %v", input, err) + } + if string(result) != c.result { + t.Errorf("Failed to marshal input '%v': expected: %+v, got %q", input, c.result, string(result)) + } + } +} diff --git a/pkg/apis/pipeline/v1alpha2/pipeline_defaults.go b/pkg/apis/pipeline/v1alpha2/pipeline_defaults.go new file mode 100644 index 00000000000..200b31092b9 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pipeline_defaults.go @@ -0,0 +1,34 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import "context" + +func (p *Pipeline) SetDefaults(ctx context.Context) { + p.Spec.SetDefaults(ctx) +} + +func (ps *PipelineSpec) SetDefaults(ctx context.Context) { + for _, pt := range ps.Tasks { + if pt.TaskRef.Kind == "" { + pt.TaskRef.Kind = NamespacedTaskKind + } + } + for i := range ps.Params { + ps.Params[i].SetDefaults(ctx) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/pipeline_interface.go b/pkg/apis/pipeline/v1alpha2/pipeline_interface.go new file mode 100644 index 00000000000..ad7f55aae3c --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pipeline_interface.go @@ -0,0 +1,26 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// PipelineInterface is implemented by Pipeline and ClusterPipeline +type PipelineInterface interface { + PipelineMetadata() metav1.ObjectMeta + PipelineSpec() PipelineSpec + Copy() PipelineInterface +} diff --git a/pkg/apis/pipeline/v1alpha2/pipeline_types.go b/pkg/apis/pipeline/v1alpha2/pipeline_types.go new file mode 100644 index 00000000000..b2222bd1914 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pipeline_types.go @@ -0,0 +1,217 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/apis" +) + +// PipelineSpec defines the desired state of Pipeline. +type PipelineSpec struct { + // Resources declares the names and types of the resources given to the + // Pipeline's tasks as inputs and outputs. + Resources []PipelineDeclaredResource `json:"resources,omitempty"` + // Tasks declares the graph of Tasks that execute when this Pipeline is run. + Tasks []PipelineTask `json:"tasks,omitempty"` + // Params declares a list of input parameters that must be supplied when + // this Pipeline is run. + Params []ParamSpec `json:"params,omitempty"` +} + +// PipelineStatus does not contain anything because Pipelines on their own +// do not have a status, they just hold data which is later used by a +// PipelineRun. +type PipelineStatus struct { +} + +// Check that Pipeline may be validated and defaulted. +var _ apis.Validatable = (*Pipeline)(nil) +var _ apis.Defaultable = (*Pipeline)(nil) + +// TaskKind defines the type of Task used by the pipeline. +type TaskKind string + +const ( + // NamespacedTaskKind indicates that the task type has a namepace scope. + NamespacedTaskKind TaskKind = "Task" + // ClusterTaskKind indicates that task type has a cluster scope. + ClusterTaskKind TaskKind = "ClusterTask" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Pipeline describes a list of Tasks to execute. It expresses how outputs +// of tasks feed into inputs of subsequent tasks. +// +k8s:openapi-gen=true +type Pipeline struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec holds the desired state of the Pipeline from the client + // +optional + Spec PipelineSpec `json:"spec"` + // Status communicates the observed state of the Pipeline from the + // controller. + // +optional + Status PipelineStatus `json:"status"` +} + +func (p *Pipeline) PipelineMetadata() metav1.ObjectMeta { + return p.ObjectMeta +} + +func (p *Pipeline) PipelineSpec() PipelineSpec { + return p.Spec +} + +func (p *Pipeline) Copy() PipelineInterface { + return p.DeepCopy() +} + +// PipelineTask defines a task in a Pipeline, passing inputs from both +// Params and from the output of previous tasks. +type PipelineTask struct { + // Name is the name of this task within the context of a Pipeline. Name is + // used as a coordinate with the `from` and `runAfter` fields to establish + // the execution order of tasks relative to one another. + Name string `json:"name,omitempty"` + // TaskRef is a reference to a task definition. + TaskRef TaskRef `json:"taskRef"` + + // Conditions is a list of conditions that need to be true for the task to run + // +optional + Conditions []PipelineTaskCondition `json:"conditions,omitempty"` + + // Retries represents how many times this task should be retried in case of task failure: ConditionSucceeded set to False + // +optional + Retries int `json:"retries,omitempty"` + + // RunAfter is the list of PipelineTask names that should be executed before + // this Task executes. (Used to force a specific ordering in graph execution.) + // +optional + RunAfter []string `json:"runAfter,omitempty"` + + // Resources declares the resources given to this task as inputs and + // outputs. + // +optional + Resources *PipelineTaskResources `json:"resources,omitempty"` + // Parameters declares parameters passed to this task. + // +optional + Params []Param `json:"params,omitempty"` +} + +// PipelineTaskParam is used to provide arbitrary string parameters to a Task. +type PipelineTaskParam struct { + Name string `json:"name"` + Value string `json:"value"` +} + +// PipelineTaskCondition allows a PipelineTask to declare a Condition to be evaluated before +// the Task is run. +type PipelineTaskCondition struct { + // ConditionRef is the name of the Condition to use for the conditionCheck + ConditionRef string `json:"conditionRef"` + + // Params declare parameters passed to this Condition + // +optional + Params []Param `json:"params,omitempty"` + + // Resources declare the resources provided to this Condition as input + Resources []PipelineConditionResource `json:"resources,omitempty"` +} + +// PipelineDeclaredResource is used by a Pipeline to declare the types of the +// PipelineResources that it will required to run and names which can be used to +// refer to these PipelineResources in PipelineTaskResourceBindings. +type PipelineDeclaredResource struct { + // Name is the name that will be used by the Pipeline to refer to this resource. + // It does not directly correspond to the name of any PipelineResources Task + // inputs or outputs, and it does not correspond to the actual names of the + // PipelineResources that will be bound in the PipelineRun. + Name string `json:"name"` + // Type is the type of the PipelineResource. + Type PipelineResourceType `json:"type"` +} + +// PipelineConditionResource allows a Pipeline to declare how its DeclaredPipelineResources +// should be provided to a Condition as its inputs. +type PipelineConditionResource struct { + // Name is the name of the PipelineResource as declared by the Condition. + Name string `json:"name"` + // Resource is the name of the DeclaredPipelineResource to use. + Resource string `json:"resource"` +} + +// PipelineTaskResources allows a Pipeline to declare how its DeclaredPipelineResources +// should be provided to a Task as its inputs and outputs. +type PipelineTaskResources struct { + // Inputs holds the mapping from the PipelineResources declared in + // DeclaredPipelineResources to the input PipelineResources required by the Task. + Inputs []PipelineTaskInputResource `json:"inputs,omitempty"` + // Outputs holds the mapping from the PipelineResources declared in + // DeclaredPipelineResources to the input PipelineResources required by the Task. + Outputs []PipelineTaskOutputResource `json:"outputs,omitempty"` +} + +// PipelineTaskInputResource maps the name of a declared PipelineResource input +// dependency in a Task to the resource in the Pipeline's DeclaredPipelineResources +// that should be used. This input may come from a previous task. +type PipelineTaskInputResource struct { + // Name is the name of the PipelineResource as declared by the Task. + Name string `json:"name"` + // Resource is the name of the DeclaredPipelineResource to use. + Resource string `json:"resource"` + // From is the list of PipelineTask names that the resource has to come from. + // (Implies an ordering in the execution graph.) + // +optional + From []string `json:"from,omitempty"` +} + +// PipelineTaskOutputResource maps the name of a declared PipelineResource output +// dependency in a Task to the resource in the Pipeline's DeclaredPipelineResources +// that should be used. +type PipelineTaskOutputResource struct { + // Name is the name of the PipelineResource as declared by the Task. + Name string `json:"name"` + // Resource is the name of the DeclaredPipelineResource to use. + Resource string `json:"resource"` +} + +// 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,omitempty"` + // TaskKind inficates the kind of the task, namespaced or cluster scoped. + Kind TaskKind `json:"kind,omitempty"` + // API version of the referent + // +optional + 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"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []Pipeline `json:"items"` +} diff --git a/pkg/apis/pipeline/v1alpha2/pipeline_validation.go b/pkg/apis/pipeline/v1alpha2/pipeline_validation.go new file mode 100644 index 00000000000..9c341fe3e3a --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pipeline_validation.go @@ -0,0 +1,241 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "context" + "fmt" + "strings" + + "github.com/tektoncd/pipeline/pkg/list" + "golang.org/x/xerrors" + "k8s.io/apimachinery/pkg/api/equality" + "k8s.io/apimachinery/pkg/util/validation" + "knative.dev/pkg/apis" +) + +// Validate checks that the Pipeline structure is valid but does not validate +// that any references resources exist, that is done at run time. +func (p *Pipeline) Validate(ctx context.Context) *apis.FieldError { + if err := validateObjectMetadata(p.GetObjectMeta()); err != nil { + return err.ViaField("metadata") + } + return p.Spec.Validate(ctx) +} + +func validateDeclaredResources(ps *PipelineSpec) error { + required := []string{} + for _, t := range ps.Tasks { + if t.Resources != nil { + for _, input := range t.Resources.Inputs { + required = append(required, input.Resource) + } + for _, output := range t.Resources.Outputs { + required = append(required, output.Resource) + } + } + + for _, condition := range t.Conditions { + for _, cr := range condition.Resources { + required = append(required, cr.Resource) + } + } + } + + provided := make([]string, 0, len(ps.Resources)) + for _, resource := range ps.Resources { + provided = append(provided, resource.Name) + } + err := list.IsSame(required, provided) + if err != nil { + return xerrors.Errorf("Pipeline declared resources didn't match usage in Tasks: %w", err) + } + return nil +} + +func isOutput(outputs []PipelineTaskOutputResource, resource string) bool { + for _, output := range outputs { + if output.Resource == resource { + return true + } + } + return false +} + +// validateFrom ensures that the `from` values make sense: that they rely on values from Tasks +// that ran previously, and that the PipelineResource is actually an output of the Task it should come from. +func validateFrom(tasks []PipelineTask) error { + taskOutputs := map[string][]PipelineTaskOutputResource{} + for _, task := range tasks { + var to []PipelineTaskOutputResource + if task.Resources != nil { + to = make([]PipelineTaskOutputResource, len(task.Resources.Outputs)) + copy(to, task.Resources.Outputs) + } + taskOutputs[task.Name] = to + } + for _, t := range tasks { + if t.Resources != nil { + for _, rd := range t.Resources.Inputs { + for _, pb := range rd.From { + outputs, found := taskOutputs[pb] + if !found { + return xerrors.Errorf("expected resource %s to be from task %s, but task %s doesn't exist", rd.Resource, pb, pb) + } + if !isOutput(outputs, rd.Resource) { + return xerrors.Errorf("the resource %s from %s must be an output but is an input", rd.Resource, pb) + } + } + } + } + } + return nil +} + +// validateGraph ensures the Pipeline's dependency Graph (DAG) make sense: that there is no dependency +// cycle or that they rely on values from Tasks that ran previously, and that the PipelineResource +// is actually an output of the Task it should come from. +func validateGraph(tasks []PipelineTask) error { + if _, err := BuildDAG(tasks); err != nil { + return err + } + return nil +} + +// Validate checks that taskNames in the Pipeline are valid and that the graph +// of Tasks expressed in the Pipeline makes sense. +func (ps *PipelineSpec) Validate(ctx context.Context) *apis.FieldError { + if equality.Semantic.DeepEqual(ps, &PipelineSpec{}) { + return apis.ErrMissingField(apis.CurrentField) + } + + // Names cannot be duplicated + taskNames := map[string]struct{}{} + for i, t := range ps.Tasks { + // Task names are appended to the container name, which must exist and + // must be a valid k8s name + if errSlice := validation.IsQualifiedName(t.Name); len(errSlice) != 0 { + return apis.ErrInvalidValue(strings.Join(errSlice, ","), fmt.Sprintf("spec.tasks[%d].name", i)) + } + // TaskRef name must be a valid k8s name + if errSlice := validation.IsQualifiedName(t.TaskRef.Name); len(errSlice) != 0 { + return apis.ErrInvalidValue(strings.Join(errSlice, ","), fmt.Sprintf("spec.tasks[%d].taskRef.name", i)) + } + if _, ok := taskNames[t.Name]; ok { + return apis.ErrMultipleOneOf(fmt.Sprintf("spec.tasks[%d].name", i)) + } + taskNames[t.Name] = struct{}{} + } + + // All declared resources should be used, and the Pipeline shouldn't try to use any resources + // that aren't declared + if err := validateDeclaredResources(ps); err != nil { + return apis.ErrInvalidValue(err.Error(), "spec.resources") + } + + // The from values should make sense + if err := validateFrom(ps.Tasks); err != nil { + return apis.ErrInvalidValue(err.Error(), "spec.tasks.resources.inputs.from") + } + + // Validate the pipeline task graph + if err := validateGraph(ps.Tasks); err != nil { + return apis.ErrInvalidValue(err.Error(), "spec.tasks") + } + + // The parameter variables should be valid + if err := validatePipelineParameterVariables(ps.Tasks, ps.Params); err != nil { + return err + } + + return nil +} + +func validatePipelineParameterVariables(tasks []PipelineTask, params []ParamSpec) *apis.FieldError { + parameterNames := map[string]struct{}{} + arrayParameterNames := map[string]struct{}{} + + for _, p := range params { + // Verify that p is a valid type. + validType := false + for _, allowedType := range AllParamTypes { + if p.Type == allowedType { + validType = true + } + } + if !validType { + return apis.ErrInvalidValue(string(p.Type), fmt.Sprintf("spec.params.%s.type", p.Name)) + } + + // If a default value is provided, ensure its type matches param's declared type. + if (p.Default != nil) && (p.Default.Type != p.Type) { + return &apis.FieldError{ + Message: fmt.Sprintf( + "\"%v\" type does not match default value's type: \"%v\"", p.Type, p.Default.Type), + Paths: []string{ + fmt.Sprintf("spec.params.%s.type", p.Name), + fmt.Sprintf("spec.params.%s.default.type", p.Name), + }, + } + } + + // Add parameter name to parameterNames, and to arrayParameterNames if type is array. + parameterNames[p.Name] = struct{}{} + if p.Type == ParamTypeArray { + arrayParameterNames[p.Name] = struct{}{} + } + } + + return validatePipelineVariables(tasks, "params", parameterNames, arrayParameterNames) +} + +func validatePipelineVariables(tasks []PipelineTask, prefix string, paramNames map[string]struct{}, arrayParamNames map[string]struct{}) *apis.FieldError { + for _, task := range tasks { + for _, param := range task.Params { + if param.Value.Type == ParamTypeString { + if err := validatePipelineVariable(fmt.Sprintf("param[%s]", param.Name), param.Value.StringVal, prefix, paramNames); err != nil { + return err + } + if err := validatePipelineNoArrayReferenced(fmt.Sprintf("param[%s]", param.Name), param.Value.StringVal, prefix, arrayParamNames); err != nil { + return err + } + } else { + for _, arrayElement := range param.Value.ArrayVal { + if err := validatePipelineVariable(fmt.Sprintf("param[%s]", param.Name), arrayElement, prefix, paramNames); err != nil { + return err + } + if err := validatePipelineArraysIsolated(fmt.Sprintf("param[%s]", param.Name), arrayElement, prefix, arrayParamNames); err != nil { + return err + } + } + } + } + } + return nil +} + +func validatePipelineVariable(name, value, prefix string, vars map[string]struct{}) *apis.FieldError { + return ValidateVariable(name, value, prefix, "", "task parameter", "pipelinespec.params", vars) +} + +func validatePipelineNoArrayReferenced(name, value, prefix string, vars map[string]struct{}) *apis.FieldError { + return ValidateVariableProhibited(name, value, prefix, "", "task parameter", "pipelinespec.params", vars) +} + +func validatePipelineArraysIsolated(name, value, prefix string, vars map[string]struct{}) *apis.FieldError { + return ValidateVariableIsolated(name, value, prefix, "", "task parameter", "pipelinespec.params", vars) +} diff --git a/pkg/apis/pipeline/v1alpha2/pipeline_validation_test.go b/pkg/apis/pipeline/v1alpha2/pipeline_validation_test.go new file mode 100644 index 00000000000..0533c48c503 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pipeline_validation_test.go @@ -0,0 +1,317 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "context" + "testing" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + tb "github.com/tektoncd/pipeline/test/builder" +) + +func TestPipeline_Validate(t *testing.T) { + tests := []struct { + name string + p *v1alpha1.Pipeline + failureExpected bool + }{{ + name: "valid metadata", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineTask("foo", "foo-task"), + )), + failureExpected: false, + }, { + name: "valid resource declarations and usage", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineDeclaredResource("great-resource", v1alpha1.PipelineResourceTypeGit), + tb.PipelineDeclaredResource("wonderful-resource", v1alpha1.PipelineResourceTypeImage), + tb.PipelineTask("bar", "bar-task", + tb.PipelineTaskInputResource("some-workspace", "great-resource"), + tb.PipelineTaskOutputResource("some-image", "wonderful-resource")), + tb.PipelineTask("foo", "foo-task", + tb.PipelineTaskInputResource("wow-image", "wonderful-resource", tb.From("bar"))), + )), + failureExpected: false, + }, { + name: "period in name", + p: tb.Pipeline("pipe.line", "namespace", tb.PipelineSpec( + tb.PipelineTask("foo", "foo-task"), + )), + failureExpected: true, + }, { + name: "pipeline name too long", + p: tb.Pipeline("asdf123456789012345678901234567890123456789012345678901234567890", "namespace", tb.PipelineSpec( + tb.PipelineTask("foo", "foo-task"), + )), + failureExpected: true, + }, { + name: "pipeline spec invalid (duplicate tasks)", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineTask("foo", "foo-task"), + tb.PipelineTask("foo", "foo-task"), + )), + failureExpected: true, + }, { + name: "pipeline spec empty task name", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineTask("", "foo-task"), + )), + failureExpected: true, + }, { + name: "pipeline spec invalid task name", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineTask("_foo", "foo-task"), + )), + failureExpected: true, + }, { + name: "pipeline spec invalid taskref name", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineTask("foo", "_foo-task"), + )), + failureExpected: true, + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.p.Validate(context.Background()) + if (!tt.failureExpected) && (err != nil) { + t.Errorf("Pipeline.Validate() returned error: %v", err) + } + + if tt.failureExpected && (err == nil) { + t.Error("Pipeline.Validate() did not return error, wanted error") + } + }) + } +} + +func TestPipelineSpec_Validate(t *testing.T) { + tests := []struct { + name string + p *v1alpha1.Pipeline + failureExpected bool + }{{ + name: "no duplicate tasks", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineTask("foo", "foo-task"), + tb.PipelineTask("bar", "bar-task"), + )), + failureExpected: false, + }, { + // Adding this case because `task.Resources` is a pointer, explicitly making sure this is handled + name: "task without resources", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineDeclaredResource("wonderful-resource", v1alpha1.PipelineResourceTypeImage), + tb.PipelineTask("bar", "bar-task"), + tb.PipelineTask("foo", "foo-task", + tb.PipelineTaskInputResource("wow-image", "wonderful-resource")), + )), + failureExpected: false, + }, { + name: "valid resource declarations and usage", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineDeclaredResource("great-resource", v1alpha1.PipelineResourceTypeGit), + tb.PipelineDeclaredResource("wonderful-resource", v1alpha1.PipelineResourceTypeImage), + tb.PipelineTask("bar", "bar-task", + tb.PipelineTaskInputResource("some-workspace", "great-resource"), + tb.PipelineTaskOutputResource("some-image", "wonderful-resource"), + tb.PipelineTaskCondition("some-condition", + tb.PipelineTaskConditionResource("some-workspace", "great-resource"))), + tb.PipelineTask("foo", "foo-task", + tb.PipelineTaskInputResource("wow-image", "wonderful-resource", tb.From("bar"))), + )), + failureExpected: false, + }, { + name: "valid condition only resource", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineDeclaredResource("great-resource", v1alpha1.PipelineResourceTypeGit), + tb.PipelineTask("bar", "bar-task", + tb.PipelineTaskCondition("some-condition", + tb.PipelineTaskConditionResource("some-workspace", "great-resource"))), + )), + failureExpected: false, + }, { + name: "valid parameter variables", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineParamSpec("baz", v1alpha1.ParamTypeString), + tb.PipelineParamSpec("foo-is-baz", v1alpha1.ParamTypeString), + tb.PipelineTask("bar", "bar-task", + tb.PipelineTaskParam("a-param", "$(baz) and $(foo-is-baz)")), + )), + failureExpected: false, + }, { + name: "valid array parameter variables", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineParamSpec("baz", v1alpha1.ParamTypeArray, tb.ParamSpecDefault("some", "default")), + tb.PipelineParamSpec("foo-is-baz", v1alpha1.ParamTypeArray), + tb.PipelineTask("bar", "bar-task", + tb.PipelineTaskParam("a-param", "$(baz)", "and", "$(foo-is-baz)")), + )), + failureExpected: false, + }, { + name: "pipeline parameter nested in task parameter", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineParamSpec("baz", v1alpha1.ParamTypeString), + tb.PipelineTask("bar", "bar-task", + tb.PipelineTaskParam("a-param", "$(input.workspace.$(baz))")), + )), + failureExpected: false, + }, { + name: "duplicate tasks", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineTask("foo", "foo-task"), + tb.PipelineTask("foo", "foo-task"), + )), + failureExpected: true, + }, { + name: "from is on first task", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineDeclaredResource("great-resource", v1alpha1.PipelineResourceTypeGit), + tb.PipelineTask("foo", "foo-task", + tb.PipelineTaskInputResource("the-resource", "great-resource", tb.From("bar"))), + )), + failureExpected: true, + }, { + name: "from task doesnt exist", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineDeclaredResource("great-resource", v1alpha1.PipelineResourceTypeGit), + tb.PipelineTask("baz", "baz-task"), + tb.PipelineTask("foo", "foo-task", + tb.PipelineTaskInputResource("the-resource", "great-resource", tb.From("bar"))), + )), + failureExpected: true, + }, { + name: "unused resources declared", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineDeclaredResource("great-resource", v1alpha1.PipelineResourceTypeGit), + tb.PipelineDeclaredResource("extra-resource", v1alpha1.PipelineResourceTypeImage), + tb.PipelineTask("foo", "foo-task", + tb.PipelineTaskInputResource("the-resource", "great-resource")), + )), + failureExpected: true, + }, { + name: "output resources missing from declaration", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineDeclaredResource("great-resource", v1alpha1.PipelineResourceTypeGit), + tb.PipelineTask("foo", "foo-task", + tb.PipelineTaskInputResource("the-resource", "great-resource"), + tb.PipelineTaskOutputResource("the-magic-resource", "missing-resource")), + )), + failureExpected: true, + }, { + name: "input resources missing from declaration", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineDeclaredResource("great-resource", v1alpha1.PipelineResourceTypeGit), + tb.PipelineTask("foo", "foo-task", + tb.PipelineTaskInputResource("the-resource", "missing-resource"), + tb.PipelineTaskOutputResource("the-magic-resource", "great-resource")), + )), + failureExpected: true, + }, { + name: "invalid condition only resource", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineTask("bar", "bar-task", + tb.PipelineTaskCondition("some-condition", + tb.PipelineTaskConditionResource("some-workspace", "missing-resource"))), + )), + failureExpected: true, + }, { + name: "from resource isn't output by task", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineDeclaredResource("great-resource", v1alpha1.PipelineResourceTypeGit), + tb.PipelineDeclaredResource("wonderful-resource", v1alpha1.PipelineResourceTypeImage), + tb.PipelineTask("bar", "bar-task", + tb.PipelineTaskInputResource("some-workspace", "great-resource")), + tb.PipelineTask("foo", "foo-task", + tb.PipelineTaskInputResource("wow-image", "wonderful-resource", tb.From("bar"))), + )), + failureExpected: true, + }, { + name: "not defined parameter variable", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineTask("foo", "foo-task", + tb.PipelineTaskParam("a-param", "$(params.does-not-exist)")))), + failureExpected: true, + }, { + name: "not defined parameter variable with defined", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineParamSpec("foo", v1alpha1.ParamTypeString, tb.ParamSpecDefault("something")), + tb.PipelineTask("foo", "foo-task", + tb.PipelineTaskParam("a-param", "$(params.foo) and $(params.does-not-exist)")))), + failureExpected: true, + }, { + name: "invalid parameter type", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineParamSpec("baz", "invalidtype", tb.ParamSpecDefault("some", "default")), + tb.PipelineParamSpec("foo-is-baz", v1alpha1.ParamTypeArray), + tb.PipelineTask("bar", "bar-task", + tb.PipelineTaskParam("a-param", "$(baz)", "and", "$(foo-is-baz)")), + )), + failureExpected: true, + }, { + name: "array parameter mismatching default type", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineParamSpec("baz", v1alpha1.ParamTypeArray, tb.ParamSpecDefault("astring")), + tb.PipelineTask("bar", "bar-task", + tb.PipelineTaskParam("a-param", "arrayelement", "$(baz)")), + )), + failureExpected: true, + }, { + name: "string parameter mismatching default type", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineParamSpec("baz", v1alpha1.ParamTypeString, tb.ParamSpecDefault("anarray", "elements")), + tb.PipelineTask("bar", "bar-task", + tb.PipelineTaskParam("a-param", "arrayelement", "$(baz)")), + )), + failureExpected: true, + }, { + name: "array parameter used as string", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineParamSpec("baz", v1alpha1.ParamTypeArray, tb.ParamSpecDefault("anarray", "elements")), + tb.PipelineTask("bar", "bar-task", + tb.PipelineTaskParam("a-param", "$(params.baz)")), + )), + failureExpected: true, + }, { + name: "array parameter string template not isolated", + p: tb.Pipeline("pipeline", "namespace", tb.PipelineSpec( + tb.PipelineParamSpec("baz", v1alpha1.ParamTypeArray, tb.ParamSpecDefault("anarray", "elements")), + tb.PipelineTask("bar", "bar-task", + tb.PipelineTaskParam("a-param", "first", "value: $(params.baz)", "last")), + )), + failureExpected: true, + }, { + name: "invalid dependency graph between the tasks", + p: tb.Pipeline("foo", "namespace", tb.PipelineSpec( + tb.PipelineTask("foo", "foo", tb.RunAfter("bar")), + tb.PipelineTask("bar", "bar", tb.RunAfter("foo")), + )), + failureExpected: true, + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.p.Spec.Validate(context.Background()) + if (!tt.failureExpected) && (err != nil) { + t.Errorf("PipelineSpec.Validate() returned error: %v", err) + } + + if tt.failureExpected && (err == nil) { + t.Error("PipelineSpec.Validate() did not return error, wanted error") + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/pipelineresource_validation.go b/pkg/apis/pipeline/v1alpha2/pipelineresource_validation.go new file mode 100644 index 00000000000..df3b7e6a68a --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pipelineresource_validation.go @@ -0,0 +1,136 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "context" + "net/url" + "strconv" + "strings" + + "k8s.io/apimachinery/pkg/api/equality" + "knative.dev/pkg/apis" +) + +func (r *PipelineResource) Validate(ctx context.Context) *apis.FieldError { + if err := validateObjectMetadata(r.GetObjectMeta()); err != nil { + return err.ViaField("metadata") + } + + return r.Spec.Validate(ctx) +} + +func (rs *PipelineResourceSpec) Validate(ctx context.Context) *apis.FieldError { + if equality.Semantic.DeepEqual(rs, &PipelineResourceSpec{}) { + return apis.ErrMissingField(apis.CurrentField) + } + if rs.Type == PipelineResourceTypeCluster { + var authFound, cadataFound, nameFound, isInsecure bool + for _, param := range rs.Params { + switch { + case strings.EqualFold(param.Name, "URL"): + if err := validateURL(param.Value, "URL"); err != nil { + return err + } + case strings.EqualFold(param.Name, "Username"): + authFound = true + case strings.EqualFold(param.Name, "CAData"): + authFound = true + cadataFound = true + case strings.EqualFold(param.Name, "Token"): + authFound = true + case strings.EqualFold(param.Name, "name"): + nameFound = true + case strings.EqualFold(param.Name, "insecure"): + b, _ := strconv.ParseBool(param.Value) + isInsecure = b + } + } + + for _, secret := range rs.SecretParams { + switch { + case strings.EqualFold(secret.FieldName, "Username"): + authFound = true + case strings.EqualFold(secret.FieldName, "CAData"): + authFound = true + cadataFound = true + } + } + + if !nameFound { + return apis.ErrMissingField("name param") + } + // One auth method must be supplied + if !(authFound) { + return apis.ErrMissingField("username or CAData or token param") + } + if !cadataFound && !isInsecure { + return apis.ErrMissingField("CAData param") + } + } + if rs.Type == PipelineResourceTypeStorage { + foundTypeParam := false + var location string + for _, param := range rs.Params { + switch { + case strings.EqualFold(param.Name, "type"): + if !AllowedStorageType(param.Value) { + return apis.ErrInvalidValue(param.Value, "spec.params.type") + } + foundTypeParam = true + case strings.EqualFold(param.Name, "Location"): + location = param.Value + } + } + + if !foundTypeParam { + return apis.ErrMissingField("spec.params.type") + } + if location == "" { + return apis.ErrMissingField("spec.params.location") + } + } + + for _, allowedType := range AllResourceTypes { + if allowedType == rs.Type { + return nil + } + } + + return apis.ErrInvalidValue("spec.type", string(rs.Type)) +} + +func AllowedStorageType(gotType string) bool { + switch gotType { + case string(PipelineResourceTypeGCS): + return true + case string(PipelineResourceTypeBuildGCS): + return true + } + return false +} + +func validateURL(u, path string) *apis.FieldError { + if u == "" { + return nil + } + _, err := url.ParseRequestURI(u) + if err != nil { + return apis.ErrInvalidValue(u, path) + } + return nil +} diff --git a/pkg/apis/pipeline/v1alpha2/pipelineresource_validation_test.go b/pkg/apis/pipeline/v1alpha2/pipelineresource_validation_test.go new file mode 100644 index 00000000000..0564096d618 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pipelineresource_validation_test.go @@ -0,0 +1,197 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "context" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + tb "github.com/tektoncd/pipeline/test/builder" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/apis" +) + +func TestResourceValidation_Invalid(t *testing.T) { + tests := []struct { + name string + res *v1alpha1.PipelineResource + want *apis.FieldError + }{ + { + name: "cluster with invalid url", + res: tb.PipelineResource("test-cluster-resource", "foo", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeCluster, + tb.PipelineResourceSpecParam("name", "test_cluster_resource"), + tb.PipelineResourceSpecParam("url", "10.10.10"), + tb.PipelineResourceSpecParam("cadata", "bXktY2x1c3Rlci1jZXJ0Cg"), + tb.PipelineResourceSpecParam("username", "admin"), + tb.PipelineResourceSpecParam("token", "my-token"), + )), + want: apis.ErrInvalidValue("10.10.10", "URL"), + }, + { + name: "cluster with missing auth", + res: tb.PipelineResource("test-cluster-resource", "foo", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeCluster, + tb.PipelineResourceSpecParam("name", "test_cluster_resource"), + tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), + )), + want: apis.ErrMissingField("username or CAData or token param"), + }, + { + name: "cluster with missing name", + res: tb.PipelineResource("test-cluster-resource", "foo", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeCluster, + tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), + tb.PipelineResourceSpecParam("cadata", "bXktY2x1c3Rlci1jZXJ0Cg"), + tb.PipelineResourceSpecParam("token", "my-token"), + )), + want: apis.ErrMissingField("name param"), + }, + { + name: "cluster with missing cadata", + res: tb.PipelineResource("test-cluster-resource", "foo", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeCluster, + tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), + tb.PipelineResourceSpecParam("Name", "admin"), + tb.PipelineResourceSpecParam("token", "my-token"), + tb.PipelineResourceSpecParam("username", "admin"), + )), + want: apis.ErrMissingField("CAData param"), + }, { + name: "storage with no type", + res: tb.PipelineResource("storage-resource", "foo", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("no-type-param", "something"), + )), + want: apis.ErrMissingField("spec.params.type"), + }, { + name: "storage with unimplemented type", + res: tb.PipelineResource("storage-resource", "foo", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("type", "not-implemented-yet"), + )), + want: apis.ErrInvalidValue("not-implemented-yet", "spec.params.type"), + }, { + name: "storage with gcs type with no location param", + res: tb.PipelineResource("storage-resource", "foo", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("type", "gcs"), + )), + want: apis.ErrMissingField("spec.params.location"), + }, { + name: "storage with gcs type with empty location param", + res: tb.PipelineResource("storage-resource", "foo", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeStorage, + tb.PipelineResourceSpecParam("type", "gcs"), + tb.PipelineResourceSpecParam("location", ""), + )), + want: apis.ErrMissingField("spec.params.location"), + }, { + name: "invalid resource type", + res: &v1alpha1.PipelineResource{ + ObjectMeta: metav1.ObjectMeta{ + Name: "invalid-resource", + }, + Spec: v1alpha1.PipelineResourceSpec{ + Type: "not-supported", + }, + }, + want: apis.ErrInvalidValue("spec.type", "not-supported"), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.res.Validate(context.Background()) + if d := cmp.Diff(tt.want.Error(), err.Error()); d != "" { + t.Errorf("Didn't get expected error for %s (-want, +got) = %v", tt.name, d) + } + }) + } +} + +func TestClusterResourceValidation_Valid(t *testing.T) { + tests := []struct { + name string + res *v1alpha1.PipelineResource + }{ + { + name: "success validate", + res: tb.PipelineResource("test-cluster-resource", "foo", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeCluster, + tb.PipelineResourceSpecParam("name", "test_cluster_resource"), + tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), + tb.PipelineResourceSpecParam("cadata", "bXktY2x1c3Rlci1jZXJ0Cg"), + tb.PipelineResourceSpecParam("username", "admin"), + tb.PipelineResourceSpecParam("token", "my-token"), + )), + }, + { + name: "specify insecure without cadata", + res: tb.PipelineResource("test-cluster-resource", "foo", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypeCluster, + tb.PipelineResourceSpecParam("name", "test_cluster_resource"), + tb.PipelineResourceSpecParam("url", "http://10.10.10.10"), + tb.PipelineResourceSpecParam("username", "admin"), + tb.PipelineResourceSpecParam("token", "my-token"), + tb.PipelineResourceSpecParam("insecure", "true"), + )), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if err := tt.res.Validate(context.Background()); err != nil { + t.Errorf("Unexpected PipelineRun.Validate() error = %v", err) + } + }) + } +} + +func TestAllowedGCSStorageType(t *testing.T) { + tests := []struct { + name string + storageType string + want bool + }{ + {name: "storage with gcs type", + storageType: "gcs", + want: true, + }, + {name: "storage with build-gcs type", + storageType: "build-gcs", + want: true, + }, + {name: "storage with incorrent type", + storageType: "t", + want: false, + }, + {name: "storage with empty type", + storageType: "", + want: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if v1alpha1.AllowedStorageType(tt.storageType) != tt.want { + t.Errorf("PipleineResource.allowedStorageType should return %t, got %t for %s", tt.want, !tt.want, tt.storageType) + } + }) + } + +} diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_defaults.go b/pkg/apis/pipeline/v1alpha2/pipelinerun_defaults.go new file mode 100644 index 00000000000..43466d31fde --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pipelinerun_defaults.go @@ -0,0 +1,50 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "context" + "time" + + "github.com/tektoncd/pipeline/pkg/apis/config" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func (pr *PipelineRun) SetDefaults(ctx context.Context) { + pr.Spec.SetDefaults(ctx) +} + +func (prs *PipelineRunSpec) SetDefaults(ctx context.Context) { + cfg := config.FromContextOrDefaults(ctx) + if prs.Timeout == nil { + var timeout *metav1.Duration + if IsUpgradeViaDefaulting(ctx) { + // This case is for preexisting `TaskRun` before 0.5.0, so let's + // add the old default timeout. + // Most likely those TaskRun passing here are already done and/or already running + timeout = &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute} + } else { + timeout = &metav1.Duration{Duration: time.Duration(cfg.Defaults.DefaultTimeoutMinutes) * time.Minute} + } + prs.Timeout = timeout + } + + defaultSA := cfg.Defaults.DefaultServiceAccount + if prs.ServiceAccountName == "" && defaultSA != "" { + prs.ServiceAccountName = defaultSA + } +} diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_defaults_test.go b/pkg/apis/pipeline/v1alpha2/pipelinerun_defaults_test.go new file mode 100644 index 00000000000..541a80c4d04 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pipelinerun_defaults_test.go @@ -0,0 +1,168 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "context" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/tektoncd/pipeline/pkg/apis/config" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + logtesting "knative.dev/pkg/logging/testing" +) + +var ( + ignoreUnexportedResources = cmpopts.IgnoreUnexported() +) + +func TestPipelineRunSpec_SetDefaults(t *testing.T) { + cases := []struct { + desc string + prs *v1alpha1.PipelineRunSpec + want *v1alpha1.PipelineRunSpec + }{ + { + desc: "timeout is nil", + prs: &v1alpha1.PipelineRunSpec{}, + want: &v1alpha1.PipelineRunSpec{ + Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, + }, + }, + { + desc: "timeout is not nil", + prs: &v1alpha1.PipelineRunSpec{ + Timeout: &metav1.Duration{Duration: 500 * time.Millisecond}, + }, + want: &v1alpha1.PipelineRunSpec{ + Timeout: &metav1.Duration{Duration: 500 * time.Millisecond}, + }, + }, + } + for _, tc := range cases { + t.Run(tc.desc, func(t *testing.T) { + ctx := context.Background() + tc.prs.SetDefaults(ctx) + + if diff := cmp.Diff(tc.want, tc.prs); diff != "" { + t.Errorf("Mismatch of PipelineRunSpec: %s", diff) + } + }) + } + +} + +func TestPipelineRunDefaulting(t *testing.T) { + tests := []struct { + name string + in *v1alpha1.PipelineRun + want *v1alpha1.PipelineRun + wc func(context.Context) context.Context + }{{ + name: "empty no context", + in: &v1alpha1.PipelineRun{}, + want: &v1alpha1.PipelineRun{ + Spec: v1alpha1.PipelineRunSpec{ + Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, + }, + }, + }, { + name: "PipelineRef upgrade context", + in: &v1alpha1.PipelineRun{ + Spec: v1alpha1.PipelineRunSpec{ + PipelineRef: &v1alpha1.PipelineRef{Name: "foo"}, + }, + }, + want: &v1alpha1.PipelineRun{ + Spec: v1alpha1.PipelineRunSpec{ + PipelineRef: &v1alpha1.PipelineRef{Name: "foo"}, + Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, + }, + }, + wc: v1alpha1.WithUpgradeViaDefaulting, + }, { + name: "PipelineRef default config context", + in: &v1alpha1.PipelineRun{ + Spec: v1alpha1.PipelineRunSpec{ + PipelineRef: &v1alpha1.PipelineRef{Name: "foo"}, + }, + }, + want: &v1alpha1.PipelineRun{ + Spec: v1alpha1.PipelineRunSpec{ + PipelineRef: &v1alpha1.PipelineRef{Name: "foo"}, + Timeout: &metav1.Duration{Duration: 5 * time.Minute}, + }, + }, + wc: func(ctx context.Context) context.Context { + s := config.NewStore(logtesting.TestLogger(t)) + s.OnConfigChanged(&corev1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: config.DefaultsConfigName, + }, + Data: map[string]string{ + "default-timeout-minutes": "5", + }, + }) + return s.ToContext(ctx) + }, + }, { + name: "PipelineRef default config context with sa", + in: &v1alpha1.PipelineRun{ + Spec: v1alpha1.PipelineRunSpec{ + PipelineRef: &v1alpha1.PipelineRef{Name: "foo"}, + }, + }, + want: &v1alpha1.PipelineRun{ + Spec: v1alpha1.PipelineRunSpec{ + PipelineRef: &v1alpha1.PipelineRef{Name: "foo"}, + Timeout: &metav1.Duration{Duration: 5 * time.Minute}, + ServiceAccountName: "tekton", + }, + }, + wc: func(ctx context.Context) context.Context { + s := config.NewStore(logtesting.TestLogger(t)) + s.OnConfigChanged(&corev1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: config.DefaultsConfigName, + }, + Data: map[string]string{ + "default-timeout-minutes": "5", + "default-service-account": "tekton", + }, + }) + return s.ToContext(ctx) + }, + }} + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + got := tc.in + ctx := context.Background() + if tc.wc != nil { + ctx = tc.wc(ctx) + } + got.SetDefaults(ctx) + if !cmp.Equal(got, tc.want, ignoreUnexportedResources) { + t.Errorf("SetDefaults (-want, +got) = %v", + cmp.Diff(got, tc.want, ignoreUnexportedResources)) + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_types.go b/pkg/apis/pipeline/v1alpha2/pipelinerun_types.go new file mode 100644 index 00000000000..b00a8ab4750 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pipelinerun_types.go @@ -0,0 +1,300 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "fmt" + "time" + + "github.com/tektoncd/pipeline/pkg/apis/config" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "knative.dev/pkg/apis" + duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" +) + +var ( + pipelineRunControllerName = "PipelineRun" + groupVersionKind = schema.GroupVersionKind{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Kind: pipelineRunControllerName, + } +) + +// Check that TaskRun may be validated and defaulted. +var _ apis.Validatable = (*PipelineRun)(nil) +var _ apis.Defaultable = (*PipelineRun)(nil) + +// PipelineRunSpec defines the desired state of PipelineRun +type PipelineRunSpec struct { + // +optional + PipelineRef *PipelineRef `json:"pipelineRef,omitempty"` + // +optional + PipelineSpec *PipelineSpec `json:"pipelineSpec,omitempty"` + // Resources is a list of bindings specifying which actual instances of + // PipelineResources to use for the resources the Pipeline has declared + // it needs. + Resources []PipelineResourceBinding `json:"resources,omitempty"` + // Params is a list of parameter names and values. + Params []Param `json:"params,omitempty"` + // +optional + ServiceAccountName string `json:"serviceAccountName,omitempty"` + // DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. + // Deprecated: Use serviceAccountName instead. + // +optional + DeprecatedServiceAccount string `json:"serviceAccount,omitempty"` + // +optional + DeprecatedServiceAccounts []DeprecatedPipelineRunSpecServiceAccount `json:"serviceAccounts,omitempty"` + // +optional + ServiceAccountNames []PipelineRunSpecServiceAccountName `json:"serviceAccountNames,omitempty"` + // Used for cancelling a pipelinerun (and maybe more later on) + // +optional + Status PipelineRunSpecStatus `json:"status,omitempty"` + // Time after which the Pipeline times out. Defaults to never. + // Refer to Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration + // +optional + Timeout *metav1.Duration `json:"timeout,omitempty"` + + // PodTemplate holds pod specific configuration + PodTemplate PodTemplate `json:"podTemplate,omitempty"` +} + +// PipelineRunSpecStatus defines the pipelinerun spec status the user can provide +type PipelineRunSpecStatus string + +const ( + // PipelineRunSpecStatusCancelled indicates that the user wants to cancel the task, + // if not already cancelled or terminated + PipelineRunSpecStatusCancelled = "PipelineRunCancelled" +) + +// PipelineResourceRef can be used to refer to a specific instance of a Resource +type PipelineResourceRef struct { + // Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names + Name string `json:"name,omitempty"` + // API version of the referent + // +optional + APIVersion string `json:"apiVersion,omitempty"` +} + +// PipelineRef can be used to refer to a specific instance of a Pipeline. +// Copied from CrossVersionObjectReference: https://github.com/kubernetes/kubernetes/blob/169df7434155cbbc22f1532cba8e0a9588e29ad8/pkg/apis/autoscaling/types.go#L64 +type PipelineRef struct { + // Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names + Name string `json:"name,omitempty"` + // API version of the referent + // +optional + APIVersion string `json:"apiVersion,omitempty"` +} + +// PipelineRunStatus defines the observed state of PipelineRun +type PipelineRunStatus struct { + duckv1beta1.Status `json:",inline"` + + // StartTime is the time the PipelineRun is actually started. + // +optional + StartTime *metav1.Time `json:"startTime,omitempty"` + + // CompletionTime is the time the PipelineRun completed. + // +optional + CompletionTime *metav1.Time `json:"completionTime,omitempty"` + + // map of PipelineRunTaskRunStatus with the taskRun name as the key + // +optional + TaskRuns map[string]*PipelineRunTaskRunStatus `json:"taskRuns,omitempty"` +} + +// PipelineRunTaskRunStatus contains the name of the PipelineTask for this TaskRun and the TaskRun's Status +type PipelineRunTaskRunStatus struct { + // PipelineTaskName is the name of the PipelineTask. + PipelineTaskName string `json:"pipelineTaskName,omitempty"` + // Status is the TaskRunStatus for the corresponding TaskRun + // +optional + Status *TaskRunStatus `json:"status,omitempty"` + // ConditionChecks maps the name of a condition check to its Status + // +optional + ConditionChecks map[string]*PipelineRunConditionCheckStatus `json:"conditionChecks,omitempty"` +} + +type PipelineRunConditionCheckStatus struct { + // ConditionName is the name of the Condition + ConditionName string `json:"conditionName,omitempty"` + // Status is the ConditionCheckStatus for the corresponding ConditionCheck + // +optional + Status *ConditionCheckStatus `json:"status,omitempty"` +} + +var pipelineRunCondSet = apis.NewBatchConditionSet() + +// GetCondition returns the Condition matching the given type. +func (pr *PipelineRunStatus) GetCondition(t apis.ConditionType) *apis.Condition { + return pipelineRunCondSet.Manage(pr).GetCondition(t) +} + +// InitializeConditions will set all conditions in pipelineRunCondSet to unknown for the PipelineRun +// and set the started time to the current time +func (pr *PipelineRunStatus) InitializeConditions() { + if pr.TaskRuns == nil { + pr.TaskRuns = make(map[string]*PipelineRunTaskRunStatus) + } + if pr.StartTime.IsZero() { + pr.StartTime = &metav1.Time{Time: time.Now()} + } + pipelineRunCondSet.Manage(pr).InitializeConditions() +} + +// DeprecatedPipelineRunSpecServiceAccount can be used to configure specific +// ServiceAccount for a concrete Task +// Deprecated: Use pipelineRunSpecServiceAccountName instead. +type DeprecatedPipelineRunSpecServiceAccount struct { + TaskName string `json:"taskName,omitempty"` + // DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. + // Deprecated: Use serviceAccountName instead. + DeprecatedServiceAccount string `json:"serviceAccount,omitempty"` +} + +// PipelineRunSpecServiceAccountName can be used to configure specific +// ServiceAccountName for a concrete Task +type PipelineRunSpecServiceAccountName struct { + TaskName string `json:"taskName,omitempty"` + ServiceAccountName string `json:"serviceAccountName,omitempty"` +} + +// SetCondition sets the condition, unsetting previous conditions with the same +// type as necessary. +func (pr *PipelineRunStatus) SetCondition(newCond *apis.Condition) { + if newCond != nil { + pipelineRunCondSet.Manage(pr).SetCondition(*newCond) + } +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PipelineRun represents a single execution of a Pipeline. PipelineRuns are how +// the graph of Tasks declared in a Pipeline are executed; they specify inputs +// to Pipelines such as parameter values and capture operational aspects of the +// Tasks execution such as service account and tolerations. Creating a +// PipelineRun creates TaskRuns for Tasks in the referenced Pipeline. +// +// +k8s:openapi-gen=true +type PipelineRun struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // +optional + Spec PipelineRunSpec `json:"spec,omitempty"` + // +optional + 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"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []PipelineRun `json:"items,omitempty"` +} + +// 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,omitempty"` +} + +// GetTaskRunRef for pipelinerun +func (pr *PipelineRun) GetTaskRunRef() corev1.ObjectReference { + return corev1.ObjectReference{ + APIVersion: "tekton.dev/v1alpha1", + Kind: "TaskRun", + Namespace: pr.Namespace, + Name: pr.Name, + } +} + +// GetOwnerReference gets the pipeline run as owner reference for any related objects +func (pr *PipelineRun) GetOwnerReference() []metav1.OwnerReference { + return []metav1.OwnerReference{ + *metav1.NewControllerRef(pr, groupVersionKind), + } +} + +// IsDone returns true if the PipelineRun's status indicates that it is done. +func (pr *PipelineRun) IsDone() bool { + return !pr.Status.GetCondition(apis.ConditionSucceeded).IsUnknown() +} + +// HasStarted function check whether pipelinerun has valid start time set in its status +func (pr *PipelineRun) HasStarted() bool { + return pr.Status.StartTime != nil && !pr.Status.StartTime.IsZero() +} + +// IsCancelled returns true if the PipelineRun's spec status is set to Cancelled state +func (pr *PipelineRun) IsCancelled() bool { + return pr.Spec.Status == PipelineRunSpecStatusCancelled +} + +// GetRunKey return the pipelinerun key for timeout handler map +func (pr *PipelineRun) GetRunKey() string { + // The address of the pointer is a threadsafe unique identifier for the pipelinerun + return fmt.Sprintf("%s/%p", pipelineRunControllerName, pr) +} + +// IsTimedOut returns true if a pipelinerun has exceeded its spec.Timeout based on its status.Timeout +func (pr *PipelineRun) IsTimedOut() bool { + pipelineTimeout := pr.Spec.Timeout + startTime := pr.Status.StartTime + + if !startTime.IsZero() && pipelineTimeout != nil { + timeout := pipelineTimeout.Duration + if timeout == config.NoTimeoutDuration { + return false + } + runtime := time.Since(startTime.Time) + if runtime > timeout { + return true + } + } + return false +} + +// GetServiceAccountName returns the service account name for a given +// PipelineTask if configured, otherwise it returns the PipelineRun's serviceAccountName. +func (pr *PipelineRun) GetServiceAccountName(pipelineTaskName string) string { + serviceAccountName := pr.Spec.ServiceAccountName + if serviceAccountName == "" { + serviceAccountName = pr.Spec.DeprecatedServiceAccount + } + for _, sa := range pr.Spec.DeprecatedServiceAccounts { + if sa.TaskName == pipelineTaskName { + serviceAccountName = sa.DeprecatedServiceAccount + } + } + for _, sa := range pr.Spec.ServiceAccountNames { + if sa.TaskName == pipelineTaskName { + serviceAccountName = sa.ServiceAccountName + } + } + return serviceAccountName +} diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_types_test.go b/pkg/apis/pipeline/v1alpha2/pipelinerun_types_test.go new file mode 100644 index 00000000000..a4fc2a2d820 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pipelinerun_types_test.go @@ -0,0 +1,273 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "fmt" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + tb "github.com/tektoncd/pipeline/test/builder" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/apis" +) + +func TestPipelineRunStatusConditions(t *testing.T) { + p := &v1alpha1.PipelineRun{} + foo := &apis.Condition{ + Type: "Foo", + Status: "True", + } + bar := &apis.Condition{ + Type: "Bar", + Status: "True", + } + + var ignoreVolatileTime = cmp.Comparer(func(_, _ apis.VolatileTime) bool { + return true + }) + + // Add a new condition. + p.Status.SetCondition(foo) + + fooStatus := p.Status.GetCondition(foo.Type) + if d := cmp.Diff(fooStatus, foo, ignoreVolatileTime); d != "" { + t.Errorf("Unexpected pipeline run condition type; want %v got %v; diff %v", fooStatus, foo, d) + } + + // Add a second condition. + p.Status.SetCondition(bar) + + barStatus := p.Status.GetCondition(bar.Type) + + if d := cmp.Diff(barStatus, bar, ignoreVolatileTime); d != "" { + t.Fatalf("Unexpected pipeline run condition type; want %v got %v; diff %s", barStatus, bar, d) + } +} + +func TestPipelineRun_TaskRunref(t *testing.T) { + p := &v1alpha1.PipelineRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-name", + Namespace: "test-ns", + }, + } + + expectTaskRunRef := corev1.ObjectReference{ + APIVersion: "tekton.dev/v1alpha1", + Kind: "TaskRun", + Namespace: p.Namespace, + Name: p.Name, + } + + if d := cmp.Diff(p.GetTaskRunRef(), expectTaskRunRef); d != "" { + t.Fatalf("Taskrun reference mismatch; want %v got %v; diff %s", expectTaskRunRef, p.GetTaskRunRef(), d) + } +} + +func TestInitializeConditions(t *testing.T) { + p := &v1alpha1.PipelineRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-name", + Namespace: "test-ns", + }, + } + p.Status.InitializeConditions() + + if p.Status.TaskRuns == nil { + t.Fatalf("PipelineRun status not initialized correctly") + } + + if p.Status.StartTime.IsZero() { + t.Fatalf("PipelineRun StartTime not initialized correctly") + } + + p.Status.TaskRuns["fooTask"] = &v1alpha1.PipelineRunTaskRunStatus{} + + p.Status.InitializeConditions() + if len(p.Status.TaskRuns) != 1 { + t.Fatalf("PipelineRun status getting reset") + } +} + +func TestPipelineRunIsDone(t *testing.T) { + pr := &v1alpha1.PipelineRun{} + foo := &apis.Condition{ + Type: apis.ConditionSucceeded, + Status: corev1.ConditionFalse, + } + pr.Status.SetCondition(foo) + if !pr.IsDone() { + t.Fatal("Expected pipelinerun status to be done") + } +} + +func TestPipelineRunIsCancelled(t *testing.T) { + pr := &v1alpha1.PipelineRun{ + Spec: v1alpha1.PipelineRunSpec{ + Status: v1alpha1.PipelineRunSpecStatusCancelled, + }, + } + if !pr.IsCancelled() { + t.Fatal("Expected pipelinerun status to be cancelled") + } +} + +func TestPipelineRunKey(t *testing.T) { + pr := tb.PipelineRun("prunname", "testns") + expectedKey := fmt.Sprintf("PipelineRun/%p", pr) + if pr.GetRunKey() != expectedKey { + t.Fatalf("Expected taskrun key to be %s but got %s", expectedKey, pr.GetRunKey()) + } +} + +func TestPipelineRunHasStarted(t *testing.T) { + params := []struct { + name string + prStatus v1alpha1.PipelineRunStatus + expectedValue bool + }{{ + name: "prWithNoStartTime", + prStatus: v1alpha1.PipelineRunStatus{}, + expectedValue: false, + }, { + name: "prWithStartTime", + prStatus: v1alpha1.PipelineRunStatus{ + StartTime: &metav1.Time{Time: time.Now()}, + }, + expectedValue: true, + }, { + name: "prWithZeroStartTime", + prStatus: v1alpha1.PipelineRunStatus{ + StartTime: &metav1.Time{}, + }, + expectedValue: false, + }} + for _, tc := range params { + t.Run(tc.name, func(t *testing.T) { + pr := &v1alpha1.PipelineRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "prunname", + Namespace: "testns", + }, + Status: tc.prStatus, + } + if pr.HasStarted() != tc.expectedValue { + t.Fatalf("Expected pipelinerun HasStarted() to return %t but got %t", tc.expectedValue, pr.HasStarted()) + } + }) + } +} + +func TestPipelineRunHasTimedOut(t *testing.T) { + tcs := []struct { + name string + timeout time.Duration + starttime time.Time + expected bool + }{{ + name: "timedout", + timeout: 1 * time.Second, + starttime: time.Now().AddDate(0, 0, -1), + expected: true, + }, { + name: "nottimedout", + timeout: 25 * time.Hour, + starttime: time.Now().AddDate(0, 0, -1), + expected: false, + }, { + name: "notimeoutspecified", + timeout: 0 * time.Second, + starttime: time.Now().AddDate(0, 0, -1), + expected: false, + }, + } + + for _, tc := range tcs { + t.Run(t.Name(), func(t *testing.T) { + pr := tb.PipelineRun("pr", "foo", + tb.PipelineRunSpec("test-pipeline", + tb.PipelineRunTimeout(tc.timeout), + ), + tb.PipelineRunStatus( + tb.PipelineRunStartTime(tc.starttime), + ), + ) + + if pr.IsTimedOut() != tc.expected { + t.Fatalf("Expected isTimedOut to be %t", tc.expected) + } + }) + } +} + +func TestPipelineRunGetServiceAccountName(t *testing.T) { + for _, tt := range []struct { + name string + pr *v1alpha1.PipelineRun + saNames map[string]string + }{ + { + "default SA", + tb.PipelineRun("pr", "ns", + tb.PipelineRunSpec("prs", + tb.PipelineRunServiceAccountName("defaultSA"), + tb.PipelineRunServiceAccountNameTask("taskName", "taskSA"))), + map[string]string{ + "unknown": "defaultSA", + "taskName": "taskSA", + }, + }, + { + "deprecated default SA", + tb.PipelineRun("pr", "ns", + tb.PipelineRunSpec("prs", + tb.PipelineRunDeprecatedServiceAccountName("", "deprecatedSA"), + tb.PipelineRunDeprecatedServiceAccountTask("taskName", "deprecatedTaskSA"))), + map[string]string{ + "unknown": "deprecatedSA", + "taskName": "deprecatedTaskSA", + }, + }, + { + "mixed default SA", + tb.PipelineRun("defaultSA", "defaultSA", + tb.PipelineRunSpec("defaultSA", + tb.PipelineRunDeprecatedServiceAccountName("defaultSA", "deprecatedSA"), + tb.PipelineRunServiceAccountNameTask("task1", "task1SA"), + tb.PipelineRunServiceAccountNameTask("task2", "task2SA"), + tb.PipelineRunDeprecatedServiceAccountTask("deprecatedTask3", "deprecatedTask3SA"), + tb.PipelineRunDeprecatedServiceAccountTask("task2", "deprecated"))), + map[string]string{ + "unknown": "defaultSA", + "task1": "task1SA", + "task2": "task2SA", + "deprecatedTask3": "deprecatedTask3SA", + }, + }, + } { + for taskName, expected := range tt.saNames { + sa := tt.pr.GetServiceAccountName(taskName) + if expected != sa { + t.Errorf("%s: wrong service account: got: %v, want: %v", tt.name, sa, expected) + } + } + } +} diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_validation.go b/pkg/apis/pipeline/v1alpha2/pipelinerun_validation.go new file mode 100644 index 00000000000..a0fbf61865d --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pipelinerun_validation.go @@ -0,0 +1,66 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "context" + "fmt" + + "k8s.io/apimachinery/pkg/api/equality" + "knative.dev/pkg/apis" +) + +// Validate pipelinerun +func (pr *PipelineRun) Validate(ctx context.Context) *apis.FieldError { + if err := validateObjectMetadata(pr.GetObjectMeta()).ViaField("metadata"); err != nil { + return err + } + return pr.Spec.Validate(ctx) +} + +// Validate pipelinerun spec +func (ps *PipelineRunSpec) Validate(ctx context.Context) *apis.FieldError { + if equality.Semantic.DeepEqual(ps, &PipelineRunSpec{}) { + return apis.ErrMissingField("spec") + } + + // can't have both pipelineRef and pipelineSpec at the same time + if (ps.PipelineRef != nil && ps.PipelineRef.Name != "") && ps.PipelineSpec != nil { + return apis.ErrDisallowedFields("spec.pipelineref", "spec.pipelinespec") + } + + // Check that one of PipelineRef and PipelineSpec is present + if (ps.PipelineRef == nil || (ps.PipelineRef != nil && ps.PipelineRef.Name == "")) && ps.PipelineSpec == nil { + return apis.ErrMissingField("spec.pipelineref.name", "spec.pipelinespec") + } + + // Validate PipelineSpec if it's present + if ps.PipelineSpec != nil { + if err := ps.PipelineSpec.Validate(ctx); err != nil { + return err + } + } + + if ps.Timeout != nil { + // timeout should be a valid duration of at least 0. + if ps.Timeout.Duration < 0 { + return apis.ErrInvalidValue(fmt.Sprintf("%s should be >= 0", ps.Timeout.Duration.String()), "spec.timeout") + } + } + + return nil +} diff --git a/pkg/apis/pipeline/v1alpha2/pipelinerun_validation_test.go b/pkg/apis/pipeline/v1alpha2/pipelinerun_validation_test.go new file mode 100644 index 00000000000..2cde0a5169e --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pipelinerun_validation_test.go @@ -0,0 +1,201 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "context" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/apis" +) + +func TestPipelineRun_Invalidate(t *testing.T) { + tests := []struct { + name string + pr v1alpha1.PipelineRun + want *apis.FieldError + }{ + { + name: "invalid pipelinerun", + pr: v1alpha1.PipelineRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "prmetaname", + }, + }, + want: apis.ErrMissingField("spec"), + }, + { + name: "invalid pipelinerun metadata", + pr: v1alpha1.PipelineRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "pipelinerun.name", + }, + }, + want: &apis.FieldError{ + Message: "Invalid resource name: special character . must not be present", + Paths: []string{"metadata.name"}, + }, + }, { + name: "no pipeline reference", + pr: v1alpha1.PipelineRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "pipelinelineName", + }, + Spec: v1alpha1.PipelineRunSpec{ + ServiceAccountName: "foo", + }, + }, + want: apis.ErrMissingField("spec.pipelineref.name, spec.pipelinespec"), + }, { + name: "negative pipeline timeout", + pr: v1alpha1.PipelineRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "pipelinelineName", + }, + Spec: v1alpha1.PipelineRunSpec{ + PipelineRef: &v1alpha1.PipelineRef{ + Name: "prname", + }, + Timeout: &metav1.Duration{Duration: -48 * time.Hour}, + }, + }, + want: apis.ErrInvalidValue("-48h0m0s should be >= 0", "spec.timeout"), + }, + } + + for _, ps := range tests { + t.Run(ps.name, func(t *testing.T) { + err := ps.pr.Validate(context.Background()) + if d := cmp.Diff(err.Error(), ps.want.Error()); d != "" { + t.Errorf("PipelineRun.Validate/%s (-want, +got) = %v", ps.name, d) + } + }) + } +} + +func TestPipelineRun_Validate(t *testing.T) { + tests := []struct { + name string + pr v1alpha1.PipelineRun + }{ + { + name: "normal case", + pr: v1alpha1.PipelineRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "pipelinelineName", + }, + Spec: v1alpha1.PipelineRunSpec{ + PipelineRef: &v1alpha1.PipelineRef{ + Name: "prname", + }, + }, + }, + }, { + name: "no timeout", + pr: v1alpha1.PipelineRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "pipelinelineName", + }, + Spec: v1alpha1.PipelineRunSpec{ + PipelineRef: &v1alpha1.PipelineRef{ + Name: "prname", + }, + Timeout: &metav1.Duration{Duration: 0}, + }, + }, + }, + } + + for _, ts := range tests { + t.Run(ts.name, func(t *testing.T) { + if err := ts.pr.Validate(context.Background()); err != nil { + t.Errorf("Unexpected PipelineRun.Validate() error = %v", err) + } + }) + } +} + +func TestPipelineRunSpec_Invalidate(t *testing.T) { + tests := []struct { + name string + spec v1alpha1.PipelineRunSpec + wantErr *apis.FieldError + }{{ + name: "Empty pipelineSpec", + spec: v1alpha1.PipelineRunSpec{}, + wantErr: apis.ErrMissingField("spec"), + }, { + name: "pipelineRef without Pipeline Name", + spec: v1alpha1.PipelineRunSpec{ + PipelineRef: &v1alpha1.PipelineRef{}, + }, + wantErr: apis.ErrMissingField("spec.pipelineref.name", "spec.pipelinespec"), + }, { + name: "pipelineRef and pipelineSpec together", + spec: v1alpha1.PipelineRunSpec{ + PipelineRef: &v1alpha1.PipelineRef{ + Name: "pipelinerefname", + }, + PipelineSpec: &v1alpha1.PipelineSpec{ + Tasks: []v1alpha1.PipelineTask{{ + Name: "mytask", + TaskRef: v1alpha1.TaskRef{ + Name: "mytask", + }, + }}}, + }, + wantErr: apis.ErrDisallowedFields("spec.pipelinespec", "spec.pipelineref"), + }} + for _, ps := range tests { + t.Run(ps.name, func(t *testing.T) { + err := ps.spec.Validate(context.Background()) + if d := cmp.Diff(ps.wantErr.Error(), err.Error()); d != "" { + t.Errorf("PipelineRunSpec.Validate/%s (-want, +got) = %v", ps.name, d) + } + }) + } +} + +func TestPipelineRunSpec_Validate(t *testing.T) { + tests := []struct { + name string + spec v1alpha1.PipelineRunSpec + }{{ + name: "PipelineRun without pipelineRef", + spec: v1alpha1.PipelineRunSpec{ + PipelineSpec: &v1alpha1.PipelineSpec{ + Tasks: []v1alpha1.PipelineTask{{ + Name: "mytask", + TaskRef: v1alpha1.TaskRef{ + Name: "mytask", + }, + }}, + }, + }, + }} + for _, ps := range tests { + t.Run(ps.name, func(t *testing.T) { + if err := ps.spec.Validate(context.Background()); err != nil { + t.Errorf("PipelineRunSpec.Validate/%s (-want, +got) = %v", ps.name, err) + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/pod.go b/pkg/apis/pipeline/v1alpha2/pod.go new file mode 100644 index 00000000000..f38243c4721 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pod.go @@ -0,0 +1,58 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + corev1 "k8s.io/api/core/v1" +) + +// PodTemplate holds pod specific configuration +type PodTemplate struct { + // NodeSelector is a selector which must be true for the pod to fit on a node. + // Selector which must match a node's labels for the pod to be scheduled on that node. + // More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + // +optional + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + + // If specified, the pod's tolerations. + // +optional + Tolerations []corev1.Toleration `json:"tolerations,omitempty"` + + // If specified, the pod's scheduling constraints + // +optional + Affinity *corev1.Affinity `json:"affinity,omitempty"` + + // SecurityContext holds pod-level security attributes and common container settings. + // Optional: Defaults to empty. See type description for default values of each field. + // +optional + SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"` + + // List of volumes that can be mounted by containers belonging to the pod. + // More info: https://kubernetes.io/docs/concepts/storage/volumes + // +optional + Volumes []corev1.Volume `json:"volumes,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,1,rep,name=volumes"` + + // RuntimeClassName refers to a RuntimeClass object in the node.k8s.io + // group, which should be used to run this pod. If no RuntimeClass resource + // matches the named class, the pod will not be run. If unset or empty, the + // "legacy" RuntimeClass will be used, which is an implicit class with an + // empty definition that uses the default runtime handler. + // More info: https://git.k8s.io/enhancements/keps/sig-node/runtime-class.md + // This is a beta feature as of Kubernetes v1.14. + // +optional + RuntimeClassName *string `json:"runtimeClassName,omitempty" protobuf:"bytes,2,opt,name=runtimeClassName"` +} diff --git a/pkg/apis/pipeline/v1alpha2/pod_test.go b/pkg/apis/pipeline/v1alpha2/pod_test.go new file mode 100644 index 00000000000..ab6dd76d66d --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pod_test.go @@ -0,0 +1,17 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test diff --git a/pkg/apis/pipeline/v1alpha2/pull_request_resource.go b/pkg/apis/pipeline/v1alpha2/pull_request_resource.go new file mode 100644 index 00000000000..187d73925a2 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pull_request_resource.go @@ -0,0 +1,134 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "fmt" + "strings" + + "github.com/tektoncd/pipeline/pkg/names" + corev1 "k8s.io/api/core/v1" +) + +const ( + prSource = "pr-source" + githubTokenEnv = "githubToken" +) + +// PullRequestResource is an endpoint from which to get data which is required +// by a Build/Task for context. +type PullRequestResource struct { + Name string `json:"name"` + Type PipelineResourceType `json:"type"` + + // GitHub URL pointing to the pull request. + // Example: https://github.com/owner/repo/pulls/1 + URL string `json:"url"` + // Secrets holds a struct to indicate a field name and corresponding secret name to populate it. + Secrets []SecretParam `json:"secrets"` + + PRImage string `json:"-"` +} + +// NewPullRequestResource create a new git resource to pass to a Task +func NewPullRequestResource(prImage string, r *PipelineResource) (*PullRequestResource, error) { + if r.Spec.Type != PipelineResourceTypePullRequest { + return nil, fmt.Errorf("PipelineResource: Cannot create a PR resource from a %s Pipeline Resource", r.Spec.Type) + } + prResource := PullRequestResource{ + Name: r.Name, + Type: r.Spec.Type, + Secrets: r.Spec.SecretParams, + PRImage: prImage, + } + for _, param := range r.Spec.Params { + if strings.EqualFold(param.Name, "URL") { + prResource.URL = param.Value + } + } + + return &prResource, nil +} + +// GetName returns the name of the resource +func (s PullRequestResource) GetName() string { + return s.Name +} + +// GetType returns the type of the resource, in this case "Git" +func (s PullRequestResource) GetType() PipelineResourceType { + return PipelineResourceTypePullRequest +} + +// GetURL returns the url to be used with this resource +func (s *PullRequestResource) GetURL() string { + return s.URL +} + +// Replacements is used for template replacement on a PullRequestResource inside of a Taskrun. +func (s *PullRequestResource) Replacements() map[string]string { + return map[string]string{ + "name": s.Name, + "type": string(s.Type), + "url": s.URL, + } +} + +// GetInputTaskModifier returns the TaskModifier to be used when this resource is an input. +func (s *PullRequestResource) GetInputTaskModifier(ts *TaskSpec, sourcePath string) (TaskModifier, error) { + return &InternalTaskModifier{ + StepsToPrepend: s.getSteps("download", sourcePath), + }, nil +} + +// GetOutputTaskModifier returns a No-op TaskModifier. +func (s *PullRequestResource) GetOutputTaskModifier(ts *TaskSpec, sourcePath string) (TaskModifier, error) { + return &InternalTaskModifier{ + StepsToAppend: s.getSteps("upload", sourcePath), + }, nil +} + +func (s *PullRequestResource) getSteps(mode string, sourcePath string) []Step { + args := []string{"-url", s.URL, "-path", sourcePath, "-mode", mode} + + evs := []corev1.EnvVar{} + for _, sec := range s.Secrets { + if strings.EqualFold(sec.FieldName, githubTokenEnv) { + ev := corev1.EnvVar{ + Name: strings.ToUpper(sec.FieldName), + ValueFrom: &corev1.EnvVarSource{ + SecretKeyRef: &corev1.SecretKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: sec.SecretName, + }, + Key: sec.SecretKey, + }, + }, + } + evs = append(evs, ev) + } + } + + return []Step{{Container: corev1.Container{ + Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(prSource + "-" + s.Name), + Image: s.PRImage, + Command: []string{"/ko-app/pullrequest-init"}, + Args: args, + WorkingDir: WorkspaceDir, + Env: evs, + }}} +} diff --git a/pkg/apis/pipeline/v1alpha2/pull_request_resource_test.go b/pkg/apis/pipeline/v1alpha2/pull_request_resource_test.go new file mode 100644 index 00000000000..e08954deb49 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/pull_request_resource_test.go @@ -0,0 +1,147 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + tb "github.com/tektoncd/pipeline/test/builder" + "github.com/tektoncd/pipeline/test/names" + corev1 "k8s.io/api/core/v1" +) + +func TestPullRequest_NewResource(t *testing.T) { + url := "https://github.com/tektoncd/pipeline/pulls/1" + pr := tb.PipelineResource("foo", "default", tb.PipelineResourceSpec( + v1alpha1.PipelineResourceTypePullRequest, + tb.PipelineResourceSpecParam("type", "github"), + tb.PipelineResourceSpecParam("url", url), + tb.PipelineResourceSpecSecretParam("githubToken", "test-secret-key", "test-secret-name"), + )) + got, err := v1alpha1.NewPullRequestResource("override-with-pr:latest", pr) + if err != nil { + t.Fatalf("Error creating storage resource: %s", err.Error()) + } + + want := &v1alpha1.PullRequestResource{ + Name: pr.Name, + Type: v1alpha1.PipelineResourceTypePullRequest, + URL: url, + Secrets: pr.Spec.SecretParams, + PRImage: "override-with-pr:latest", + } + if diff := cmp.Diff(want, got); diff != "" { + t.Error(diff) + } +} + +func TestPullRequest_NewResource_error(t *testing.T) { + pr := tb.PipelineResource("foo", "default", tb.PipelineResourceSpec(v1alpha1.PipelineResourceTypeGit)) + if _, err := v1alpha1.NewPullRequestResource("override-with-pr:latest", pr); err == nil { + t.Error("NewPullRequestResource() want error, got nil") + } +} + +type testcase struct { + in *v1alpha1.PullRequestResource + out []v1alpha1.Step +} + +const workspace = "/workspace" + +func containerTestCases(mode string) []testcase { + return []testcase{{ + in: &v1alpha1.PullRequestResource{ + Name: "nocreds", + URL: "https://example.com", + PRImage: "override-with-pr:latest", + }, + out: []v1alpha1.Step{{Container: corev1.Container{ + Name: "pr-source-nocreds-9l9zj", + Image: "override-with-pr:latest", + WorkingDir: v1alpha1.WorkspaceDir, + Command: []string{"/ko-app/pullrequest-init"}, + Args: []string{"-url", "https://example.com", "-path", workspace, "-mode", mode}, + Env: []corev1.EnvVar{}, + }}}, + }, { + in: &v1alpha1.PullRequestResource{ + Name: "creds", + URL: "https://example.com", + Secrets: []v1alpha1.SecretParam{{ + FieldName: "githubToken", + SecretName: "github-creds", + SecretKey: "token", + }}, + PRImage: "override-with-pr:latest", + }, + out: []v1alpha1.Step{{Container: corev1.Container{ + Name: "pr-source-creds-mz4c7", + Image: "override-with-pr:latest", + WorkingDir: v1alpha1.WorkspaceDir, + Command: []string{"/ko-app/pullrequest-init"}, + Args: []string{"-url", "https://example.com", "-path", "/workspace", "-mode", mode}, + Env: []corev1.EnvVar{{ + Name: "GITHUBTOKEN", + ValueFrom: &corev1.EnvVarSource{ + SecretKeyRef: &corev1.SecretKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "github-creds", + }, + Key: "token", + }, + }, + }}, + }}}, + }} +} + +func TestPullRequest_GetDownloadSteps(t *testing.T) { + names.TestingSeed() + + for _, tc := range containerTestCases("download") { + t.Run(tc.in.GetName(), func(t *testing.T) { + ts := v1alpha1.TaskSpec{} + got, err := tc.in.GetInputTaskModifier(&ts, workspace) + if err != nil { + t.Fatal(err) + } + if diff := cmp.Diff(tc.out, got.GetStepsToPrepend()); diff != "" { + t.Error(diff) + } + }) + } +} + +func TestPullRequest_GetOutputSteps(t *testing.T) { + names.TestingSeed() + + for _, tc := range containerTestCases("upload") { + t.Run(tc.in.GetName(), func(t *testing.T) { + ts := v1alpha1.TaskSpec{} + got, err := tc.in.GetOutputTaskModifier(&ts, workspace) + if err != nil { + t.Fatal(err) + } + if diff := cmp.Diff(tc.out, got.GetStepsToAppend()); diff != "" { + t.Error(diff) + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/register.go b/pkg/apis/pipeline/v1alpha2/register.go new file mode 100644 index 00000000000..ca682b79311 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/register.go @@ -0,0 +1,66 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "github.com/tektoncd/pipeline/pkg/apis/pipeline" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: pipeline.GroupName, Version: "v1alpha2"} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + + // AddToScheme adds Build types to the scheme. + AddToScheme = schemeBuilder.AddToScheme +) + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Task{}, + &TaskList{}, + &Condition{}, + &ConditionList{}, + &ClusterTask{}, + &ClusterTaskList{}, + &TaskRun{}, + &TaskRunList{}, + &Pipeline{}, + &PipelineList{}, + &PipelineRun{}, + &PipelineRunList{}, + &PipelineResource{}, + &PipelineResourceList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/pipeline/v1alpha2/resource_defaults.go b/pkg/apis/pipeline/v1alpha2/resource_defaults.go new file mode 100644 index 00000000000..154bd060646 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/resource_defaults.go @@ -0,0 +1,26 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import "context" + +func (t *PipelineResource) SetDefaults(ctx context.Context) { + t.Spec.SetDefaults(ctx) +} + +func (ts *PipelineResourceSpec) SetDefaults(ctx context.Context) { +} diff --git a/pkg/apis/pipeline/v1alpha2/resource_paths.go b/pkg/apis/pipeline/v1alpha2/resource_paths.go new file mode 100644 index 00000000000..59cad127a83 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/resource_paths.go @@ -0,0 +1,37 @@ +/* + Copyright 2019 The Tekton Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package v1alpha2 + +import "path/filepath" + +// InputResourcePath returns the path where the given input resource +// will get mounted in a Pod +func InputResourcePath(r ResourceDeclaration) string { + return path("/workspace", r) +} + +// OutputResourcePath returns the path to the output resouce in a Pod +func OutputResourcePath(r ResourceDeclaration) string { + return path("/workspace/output", r) +} + +func path(root string, r ResourceDeclaration) string { + if r.TargetPath != "" { + return filepath.Join("/workspace", r.TargetPath) + } + return filepath.Join(root, r.Name) +} diff --git a/pkg/apis/pipeline/v1alpha2/resource_paths_test.go b/pkg/apis/pipeline/v1alpha2/resource_paths_test.go new file mode 100644 index 00000000000..0f47dea68c3 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/resource_paths_test.go @@ -0,0 +1,81 @@ +/* + Copyright 2019 The Tekton Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package v1alpha2_test + +import ( + "testing" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" +) + +func TestInputResourcePath(t *testing.T) { + tcs := []struct { + name string + resource v1alpha1.ResourceDeclaration + expected string + }{{ + name: "default_path", + resource: v1alpha1.ResourceDeclaration{ + Name: "foo", + }, + expected: "/workspace/foo", + }, { + name: "with target path", + resource: v1alpha1.ResourceDeclaration{ + Name: "foo", + TargetPath: "bar", + }, + expected: "/workspace/bar", + }} + + for _, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + if actual := v1alpha1.InputResourcePath(tc.resource); actual != tc.expected { + t.Errorf("Unexpected input resource path: %s", actual) + } + }) + } +} + +func TestOutputResourcePath(t *testing.T) { + tcs := []struct { + name string + resource v1alpha1.ResourceDeclaration + expected string + }{{ + name: "default_path", + resource: v1alpha1.ResourceDeclaration{ + Name: "foo", + }, + expected: "/workspace/output/foo", + }, { + name: "with target path", + resource: v1alpha1.ResourceDeclaration{ + Name: "foo", + TargetPath: "bar", + }, + expected: "/workspace/bar", + }} + + for _, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + if actual := v1alpha1.OutputResourcePath(tc.resource); actual != tc.expected { + t.Errorf("Unexpected output resource path: %s", actual) + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/resource_types.go b/pkg/apis/pipeline/v1alpha2/resource_types.go new file mode 100644 index 00000000000..2146ccd3a22 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/resource_types.go @@ -0,0 +1,271 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline" + "golang.org/x/xerrors" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/apis" +) + +// PipelineResourceType represents the type of endpoint the pipelineResource is, so that the +// controller will know this pipelineResource should be fetched and optionally what +// additional metatdata should be provided for it. +type PipelineResourceType string + +const ( + // PipelineResourceTypeGit indicates that this source is a GitHub repo. + PipelineResourceTypeGit PipelineResourceType = "git" + + // PipelineResourceTypeStorage indicates that this source is a storage blob resource. + PipelineResourceTypeStorage PipelineResourceType = "storage" + + // PipelineResourceTypeImage indicates that this source is a docker Image. + PipelineResourceTypeImage PipelineResourceType = "image" + + // PipelineResourceTypeCluster indicates that this source is a k8s cluster Image. + PipelineResourceTypeCluster PipelineResourceType = "cluster" + + // PipelineResourceTypePullRequest indicates that this source is a SCM Pull Request. + PipelineResourceTypePullRequest PipelineResourceType = "pullRequest" + + // PipelineResourceTypeCloudEvent indicates that this source is a cloud event URI + PipelineResourceTypeCloudEvent PipelineResourceType = "cloudEvent" +) + +// AllResourceTypes can be used for validation to check if a provided Resource type is one of the known types. +var AllResourceTypes = []PipelineResourceType{PipelineResourceTypeGit, PipelineResourceTypeStorage, PipelineResourceTypeImage, PipelineResourceTypeCluster, PipelineResourceTypePullRequest, PipelineResourceTypeCloudEvent} + +// PipelineResourceInterface interface to be implemented by different PipelineResource types +type PipelineResourceInterface interface { + // GetName returns the name of this PipelineResource instance. + GetName() string + // GetType returns the type of this PipelineResource (often a super type, e.g. in the case of storage). + GetType() PipelineResourceType + // Replacements returns all the attributes that this PipelineResource has that + // can be used for variable replacement. + Replacements() map[string]string + // GetOutputTaskModifier returns the TaskModifier instance that should be used on a Task + // in order to add this kind of resource when it is being used as an output. + GetOutputTaskModifier(ts *TaskSpec, path string) (TaskModifier, error) + // GetInputTaskModifier returns the TaskModifier instance that should be used on a Task + // in order to add this kind of resource when it is being used as an input. + GetInputTaskModifier(ts *TaskSpec, path string) (TaskModifier, error) +} + +// TaskModifier is an interface to be implemented by different PipelineResources +type TaskModifier interface { + GetStepsToPrepend() []Step + GetStepsToAppend() []Step + GetVolumes() []v1.Volume +} + +// InternalTaskModifier implements TaskModifier for resources that are built-in to Tekton Pipelines. +type InternalTaskModifier struct { + StepsToPrepend []Step + StepsToAppend []Step + Volumes []v1.Volume +} + +// GetStepsToPrepend returns a set of Steps to prepend to the Task. +func (tm *InternalTaskModifier) GetStepsToPrepend() []Step { + return tm.StepsToPrepend +} + +// GetStepsToAppend returns a set of Steps to append to the Task. +func (tm *InternalTaskModifier) GetStepsToAppend() []Step { + return tm.StepsToAppend +} + +// GetVolumes returns a set of Volumes to prepend to the Task pod. +func (tm *InternalTaskModifier) GetVolumes() []v1.Volume { + return tm.Volumes +} + +func checkStepNotAlreadyAdded(s Step, steps []Step) error { + for _, step := range steps { + if s.Name == step.Name { + return xerrors.Errorf("Step %s cannot be added again", step.Name) + } + } + return nil +} + +// ApplyTaskModifier applies a modifier to the task by appending and prepending steps and volumes. +// If steps with the same name exist in ts an error will be returned. If identical Volumes have +// been added, they will not be added again. If Volumes with the same name but different contents +// have been added, an error will be returned. +func ApplyTaskModifier(ts *TaskSpec, tm TaskModifier) error { + steps := tm.GetStepsToPrepend() + for _, step := range steps { + if err := checkStepNotAlreadyAdded(step, ts.Steps); err != nil { + return err + } + } + ts.Steps = append(steps, ts.Steps...) + + steps = tm.GetStepsToAppend() + for _, step := range steps { + if err := checkStepNotAlreadyAdded(step, ts.Steps); err != nil { + return err + } + } + ts.Steps = append(ts.Steps, steps...) + + volumes := tm.GetVolumes() + for _, volume := range volumes { + var alreadyAdded bool + for _, v := range ts.Volumes { + if volume.Name == v.Name { + // If a Volume with the same name but different contents has already been added, we can't add both + if d := cmp.Diff(volume, v); d != "" { + return xerrors.Errorf("Tried to add volume %s already added but with different contents", volume.Name) + } + // If an identical Volume has already been added, don't add it again + alreadyAdded = true + } + } + if !alreadyAdded { + ts.Volumes = append(ts.Volumes, volume) + } + } + + return nil +} + +// SecretParam indicates which secret can be used to populate a field of the resource +type SecretParam struct { + FieldName string `json:"fieldName"` + SecretKey string `json:"secretKey"` + SecretName string `json:"secretName"` +} + +// PipelineResourceSpec defines an individual resources used in the pipeline. +type PipelineResourceSpec struct { + Type PipelineResourceType `json:"type"` + Params []ResourceParam `json:"params"` + // Secrets to fetch to populate some of resource fields + // +optional + SecretParams []SecretParam `json:"secrets,omitempty"` +} + +// PipelineResourceStatus does not contain anything because Resources on their own +// do not have a status, they just hold data which is later used by PipelineRuns +// and TaskRuns. +type PipelineResourceStatus struct { +} + +// Check that PipelineResource may be validated and defaulted. +var _ apis.Validatable = (*PipelineResource)(nil) +var _ apis.Defaultable = (*PipelineResource)(nil) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PipelineResource describes a resource that is an input to or output from a +// Task. +// +// +k8s:openapi-gen=true +type PipelineResource struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec holds the desired state of the PipelineResource from the client + Spec PipelineResourceSpec `json:"spec,omitempty"` + // Status communicates the observed state of the PipelineResource from the controller + // +optional + Status PipelineResourceStatus `json:"status,omitempty"` +} + +// PipelineResourceBinding connects a reference to an instance of a PipelineResource +// with a PipelineResource dependency that the Pipeline has declared +type PipelineResourceBinding struct { + // Name is the name of the PipelineResource in the Pipeline's declaration + Name string `json:"name,omitempty"` + // ResourceRef is a reference to the instance of the actual PipelineResource + // that should be used + // +optional + ResourceRef *PipelineResourceRef `json:"resourceRef,omitempty"` + // ResourceSpec is specification of a resource that should be created and + // consumed by the task + // +optional + ResourceSpec *PipelineResourceSpec `json:"resourceSpec,omitempty"` +} + +// PipelineResourceResult used to export the image name and digest as json +type PipelineResourceResult struct { + // Name and Digest are deprecated. + Name string `json:"name"` + Digest string `json:"digest"` + // These will replace Name and Digest (https://github.com/tektoncd/pipeline/issues/1392) + Key string `json:"key"` + Value string `json:"value"` + ResourceRef PipelineResourceRef `json:"resourceRef,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PipelineResourceList contains a list of PipelineResources +type PipelineResourceList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []PipelineResource `json:"items"` +} + +// ResourceDeclaration defines an input or output PipelineResource declared as a requirement +// by another type such as a Task or Condition. The Name field will be used to refer to these +// PipelineResources within the type's definition, and when provided as an Input, the Name will be the +// path to the volume mounted containing this PipelineResource as an input (e.g. +// an input Resource named `workspace` will be mounted at `/workspace`). +type ResourceDeclaration struct { + // Name declares the name by which a resource is referenced in the + // definition. Resources may be referenced by name in the definition of a + // Task's steps. + Name string `json:"name"` + // Type is the type of this resource; + Type PipelineResourceType `json:"type"` + // TargetPath is the path in workspace directory where the resource + // will be copied. + // +optional + TargetPath string `json:"targetPath,omitempty"` +} + +// ResourceFromType returns an instance of the correct PipelineResource object type which can be +// used to add input and ouput containers as well as volumes to a TaskRun's pod in order to realize +// a PipelineResource in a pod. +func ResourceFromType(r *PipelineResource, images pipeline.Images) (PipelineResourceInterface, error) { + switch r.Spec.Type { + case PipelineResourceTypeGit: + return NewGitResource(images.GitImage, r) + case PipelineResourceTypeImage: + return NewImageResource(r) + case PipelineResourceTypeCluster: + return NewClusterResource(images.KubeconfigWriterImage, r) + case PipelineResourceTypeStorage: + return NewStorageResource(images, r) + case PipelineResourceTypePullRequest: + return NewPullRequestResource(images.PRImage, r) + case PipelineResourceTypeCloudEvent: + return NewCloudEventResource(r) + } + return nil, xerrors.Errorf("%s is an invalid or unimplemented PipelineResource", r.Spec.Type) +} diff --git a/pkg/apis/pipeline/v1alpha2/resource_types_test.go b/pkg/apis/pipeline/v1alpha2/resource_types_test.go new file mode 100644 index 00000000000..8a794394d9d --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/resource_types_test.go @@ -0,0 +1,144 @@ +/* +Copyright 2019 The Tekton Authors +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + corev1 "k8s.io/api/core/v1" +) + +var ( + prependStep = corev1.Container{ + Name: "prepend-step", + Image: "dummy", + Command: []string{"doit"}, + Args: []string{"stuff", "things"}, + } + appendStep = corev1.Container{ + Name: "append-step", + Image: "dummy", + Command: []string{"doit"}, + Args: []string{"other stuff", "other things"}, + } + volume = corev1.Volume{ + Name: "magic-volume", + VolumeSource: corev1.VolumeSource{ + PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{ClaimName: "some-claim"}, + }, + } +) + +type TestTaskModifier struct{} + +func (tm *TestTaskModifier) GetStepsToPrepend() []v1alpha1.Step { + return []v1alpha1.Step{{ + Container: prependStep, + }} +} + +func (tm *TestTaskModifier) GetStepsToAppend() []v1alpha1.Step { + return []v1alpha1.Step{{ + Container: appendStep, + }} +} + +func (tm *TestTaskModifier) GetVolumes() []corev1.Volume { + return []corev1.Volume{volume} +} + +func TestApplyTaskModifier(t *testing.T) { + testcases := []struct { + name string + ts v1alpha1.TaskSpec + }{{ + name: "success", + ts: v1alpha1.TaskSpec{}, + }, { + name: "identical volume already added", + ts: v1alpha1.TaskSpec{ + // Trying to add the same Volume that has already been added shouldn't be an error + // and it should not be added twice + Volumes: []corev1.Volume{volume}, + }, + }} + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + if err := v1alpha1.ApplyTaskModifier(&tc.ts, &TestTaskModifier{}); err != nil { + t.Fatalf("Did not expect error modifying TaskSpec but got %v", err) + } + + expectedTaskSpec := v1alpha1.TaskSpec{ + Steps: []v1alpha1.Step{{ + Container: prependStep, + }, { + Container: appendStep, + }}, + Volumes: []corev1.Volume{ + volume, + }, + } + + if d := cmp.Diff(expectedTaskSpec, tc.ts); d != "" { + t.Errorf("TaskSpec was not modified as expected (-want, +got): %s", d) + } + }) + } +} + +func TestApplyTaskModifier_AlreadyAdded(t *testing.T) { + testcases := []struct { + name string + ts v1alpha1.TaskSpec + }{{ + name: "prepend already added", + ts: v1alpha1.TaskSpec{ + Steps: []v1alpha1.Step{{Container: prependStep}}, + }, + }, { + name: "append already added", + ts: v1alpha1.TaskSpec{ + Steps: []v1alpha1.Step{{Container: appendStep}}, + }, + }, { + name: "both steps already added", + ts: v1alpha1.TaskSpec{ + Steps: []v1alpha1.Step{{Container: prependStep}, {Container: appendStep}}, + }, + }, { + name: "both steps already added reverse order", + ts: v1alpha1.TaskSpec{ + Steps: []v1alpha1.Step{{Container: appendStep}, {Container: prependStep}}, + }, + }, { + name: "volume with same name but diff content already added", + ts: v1alpha1.TaskSpec{ + Volumes: []corev1.Volume{{ + Name: "magic-volume", + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + }}, + }, + }} + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + if err := v1alpha1.ApplyTaskModifier(&tc.ts, &TestTaskModifier{}); err == nil { + t.Errorf("Expected error when applying values already added but got none") + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/secret_volume_mount.go b/pkg/apis/pipeline/v1alpha2/secret_volume_mount.go new file mode 100644 index 00000000000..9972044dd12 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/secret_volume_mount.go @@ -0,0 +1,59 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "fmt" + "path/filepath" + "strings" + + corev1 "k8s.io/api/core/v1" +) + +func getSecretEnvVarsAndVolumeMounts(name, mountPath string, secrets []SecretParam) ([]corev1.EnvVar, []corev1.VolumeMount) { + mountPaths := make(map[string]struct{}) + var ( + envVars []corev1.EnvVar + secretVolumeMount []corev1.VolumeMount + ) + + allowedFields := map[string]bool{ + "GOOGLE_APPLICATION_CREDENTIALS": false, + "BOTO_CONFIG": false, + } + + for _, secretParam := range secrets { + if authVar, ok := allowedFields[secretParam.FieldName]; ok && !authVar { + allowedFields[secretParam.FieldName] = true + mountPath := filepath.Join(mountPath, secretParam.SecretName) + + envVars = append(envVars, corev1.EnvVar{ + Name: strings.ToUpper(secretParam.FieldName), + Value: filepath.Join(mountPath, secretParam.SecretKey), + }) + + if _, ok := mountPaths[mountPath]; !ok { + secretVolumeMount = append(secretVolumeMount, corev1.VolumeMount{ + Name: fmt.Sprintf("volume-%s-%s", name, secretParam.SecretName), + MountPath: mountPath, + }) + mountPaths[mountPath] = struct{}{} + } + } + } + return envVars, secretVolumeMount +} diff --git a/pkg/apis/pipeline/v1alpha2/step_replacements.go b/pkg/apis/pipeline/v1alpha2/step_replacements.go new file mode 100644 index 00000000000..93e1ca8e577 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/step_replacements.go @@ -0,0 +1,67 @@ +/* + Copyright 2019 The Tekton Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package v1alpha2 + +func ApplyStepReplacements(step *Step, stringReplacements map[string]string, arrayReplacements map[string][]string) { + step.Name = ApplyReplacements(step.Name, stringReplacements) + step.Image = ApplyReplacements(step.Image, stringReplacements) + + //Use ApplyArrayReplacements here, as additional args may be added via an array parameter. + var newArgs []string + for _, a := range step.Args { + newArgs = append(newArgs, ApplyArrayReplacements(a, stringReplacements, arrayReplacements)...) + } + step.Args = newArgs + + for ie, e := range step.Env { + step.Env[ie].Value = ApplyReplacements(e.Value, stringReplacements) + if step.Env[ie].ValueFrom != nil { + if e.ValueFrom.SecretKeyRef != nil { + step.Env[ie].ValueFrom.SecretKeyRef.LocalObjectReference.Name = ApplyReplacements(e.ValueFrom.SecretKeyRef.LocalObjectReference.Name, stringReplacements) + step.Env[ie].ValueFrom.SecretKeyRef.Key = ApplyReplacements(e.ValueFrom.SecretKeyRef.Key, stringReplacements) + } + if e.ValueFrom.ConfigMapKeyRef != nil { + step.Env[ie].ValueFrom.ConfigMapKeyRef.LocalObjectReference.Name = ApplyReplacements(e.ValueFrom.ConfigMapKeyRef.LocalObjectReference.Name, stringReplacements) + step.Env[ie].ValueFrom.ConfigMapKeyRef.Key = ApplyReplacements(e.ValueFrom.ConfigMapKeyRef.Key, stringReplacements) + } + } + } + + for ie, e := range step.EnvFrom { + step.EnvFrom[ie].Prefix = ApplyReplacements(e.Prefix, stringReplacements) + if e.ConfigMapRef != nil { + step.EnvFrom[ie].ConfigMapRef.LocalObjectReference.Name = ApplyReplacements(e.ConfigMapRef.LocalObjectReference.Name, stringReplacements) + } + if e.SecretRef != nil { + step.EnvFrom[ie].SecretRef.LocalObjectReference.Name = ApplyReplacements(e.SecretRef.LocalObjectReference.Name, stringReplacements) + } + } + step.WorkingDir = ApplyReplacements(step.WorkingDir, stringReplacements) + + //Use ApplyArrayReplacements here, as additional commands may be added via an array parameter. + var newCommand []string + for _, c := range step.Command { + newCommand = append(newCommand, ApplyArrayReplacements(c, stringReplacements, arrayReplacements)...) + } + step.Command = newCommand + + for iv, v := range step.VolumeMounts { + step.VolumeMounts[iv].Name = ApplyReplacements(v.Name, stringReplacements) + step.VolumeMounts[iv].MountPath = ApplyReplacements(v.MountPath, stringReplacements) + step.VolumeMounts[iv].SubPath = ApplyReplacements(v.SubPath, stringReplacements) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/step_replacements_test.go b/pkg/apis/pipeline/v1alpha2/step_replacements_test.go new file mode 100644 index 00000000000..271f7fb8868 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/step_replacements_test.go @@ -0,0 +1,146 @@ +/* + Copyright 2019 The Tekton Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package v1alpha2_test + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + corev1 "k8s.io/api/core/v1" +) + +func TestApplyStepReplacements(t *testing.T) { + replacements := map[string]string{ + "replace.me": "replaced!", + } + + arrayReplacements := map[string][]string{ + "array.replace.me": {"val1", "val2"}, + } + + s := v1alpha1.Step{Container: corev1.Container{ + Name: "$(replace.me)", + Image: "$(replace.me)", + Command: []string{"$(array.replace.me)"}, + Args: []string{"$(array.replace.me)"}, + WorkingDir: "$(replace.me)", + EnvFrom: []corev1.EnvFromSource{{ + ConfigMapRef: &corev1.ConfigMapEnvSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "$(replace.me)", + }, + }, + SecretRef: &corev1.SecretEnvSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "$(replace.me)", + }, + }, + }}, + Env: []corev1.EnvVar{{ + Name: "not_me", + Value: "$(replace.me)", + ValueFrom: &corev1.EnvVarSource{ + ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "$(replace.me)", + }, + Key: "$(replace.me)", + }, + SecretKeyRef: &corev1.SecretKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "$(replace.me)", + }, + Key: "$(replace.me)", + }, + }, + }}, + VolumeMounts: []corev1.VolumeMount{{ + Name: "$(replace.me)", + MountPath: "$(replace.me)", + SubPath: "$(replace.me)", + }}, + }} + + expected := v1alpha1.Step{Container: corev1.Container{ + Name: "replaced!", + Image: "replaced!", + Command: []string{"val1", "val2"}, + Args: []string{"val1", "val2"}, + WorkingDir: "replaced!", + EnvFrom: []corev1.EnvFromSource{{ + ConfigMapRef: &corev1.ConfigMapEnvSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "replaced!", + }, + }, + SecretRef: &corev1.SecretEnvSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "replaced!", + }, + }, + }}, + Env: []corev1.EnvVar{{ + Name: "not_me", + Value: "replaced!", + ValueFrom: &corev1.EnvVarSource{ + ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "replaced!", + }, + Key: "replaced!", + }, + SecretKeyRef: &corev1.SecretKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "replaced!", + }, + Key: "replaced!", + }, + }, + }}, + VolumeMounts: []corev1.VolumeMount{{ + Name: "replaced!", + MountPath: "replaced!", + SubPath: "replaced!", + }}, + }} + v1alpha1.ApplyStepReplacements(&s, replacements, arrayReplacements) + if d := cmp.Diff(s, expected); d != "" { + t.Errorf("Container replacements failed: %s", d) + } +} + +func TestApplyStepReplacements_NotDefined(t *testing.T) { + s := v1alpha1.Step{Container: corev1.Container{ + Name: "$(params.not.defined)", + }} + replacements := map[string]string{ + "replace.me": "replaced!", + } + + arrayReplacements := map[string][]string{ + "array.replace.me": {"val1", "val2"}, + } + + expected := v1alpha1.Step{Container: corev1.Container{ + Name: "$(params.not.defined)", + }} + v1alpha1.ApplyStepReplacements(&s, replacements, arrayReplacements) + if d := cmp.Diff(s, expected); d != "" { + t.Errorf("Unexpected container replacement: %s", d) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/storage_resource.go b/pkg/apis/pipeline/v1alpha2/storage_resource.go new file mode 100644 index 00000000000..e8778560a08 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/storage_resource.go @@ -0,0 +1,96 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "fmt" + "strings" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline" + "golang.org/x/xerrors" + corev1 "k8s.io/api/core/v1" +) + +type PipelineResourceStorageType string + +const ( + // PipelineResourceTypeGCS is the subtype for the GCSResources, which is backed by a GCS blob/directory. + PipelineResourceTypeGCS PipelineResourceType = "gcs" + + // PipelineResourceTypeBuildGCS is the subtype for the BuildGCSResources, which is simialr to the GCSResource but + // with additional funcitonality that was added to be compatible with knative build. + PipelineResourceTypeBuildGCS PipelineResourceType = "build-gcs" +) + +// PipelineStorageResourceInterface is the interface for subtypes of the storage type. +// It adds a function to the PipelineResourceInterface for retrieving secrets that are usually +// needed for storage PipelineResources. +type PipelineStorageResourceInterface interface { + PipelineResourceInterface + GetSecretParams() []SecretParam +} + +// NewStorageResource returns an instance of the requested storage subtype, which can be used +// to add input and output steps and volumes to an executing pod. +func NewStorageResource(images pipeline.Images, r *PipelineResource) (PipelineStorageResourceInterface, error) { + if r.Spec.Type != PipelineResourceTypeStorage { + return nil, xerrors.Errorf("StoreResource: Cannot create a storage resource from a %s Pipeline Resource", r.Spec.Type) + } + + for _, param := range r.Spec.Params { + if strings.EqualFold(param.Name, "type") { + switch { + case strings.EqualFold(param.Value, string(PipelineResourceTypeGCS)): + return NewGCSResource(images, r) + case strings.EqualFold(param.Value, string(PipelineResourceTypeBuildGCS)): + return NewBuildGCSResource(images, r) + default: + return nil, xerrors.Errorf("%s is an invalid or unimplemented PipelineStorageResource", param.Value) + } + } + } + return nil, xerrors.Errorf("StoreResource: Cannot create a storage resource without type %s in spec", r.Name) +} + +func getStorageVolumeSpec(s PipelineStorageResourceInterface, spec TaskSpec) []corev1.Volume { + var storageVol []corev1.Volume + mountedSecrets := map[string]string{} + + for _, volume := range spec.Volumes { + mountedSecrets[volume.Name] = "" + } + + // Map holds list of secrets that are mounted as volumes + for _, secretParam := range s.GetSecretParams() { + volName := fmt.Sprintf("volume-%s-%s", s.GetName(), secretParam.SecretName) + + gcsSecretVolume := corev1.Volume{ + Name: volName, + VolumeSource: corev1.VolumeSource{ + Secret: &corev1.SecretVolumeSource{ + SecretName: secretParam.SecretName, + }, + }, + } + + if _, ok := mountedSecrets[volName]; !ok { + storageVol = append(storageVol, gcsSecretVolume) + mountedSecrets[volName] = "" + } + } + return storageVol +} diff --git a/pkg/apis/pipeline/v1alpha2/substitution.go b/pkg/apis/pipeline/v1alpha2/substitution.go new file mode 100644 index 00000000000..8d191b6ded2 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/substitution.go @@ -0,0 +1,139 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "fmt" + "regexp" + "strings" + + "knative.dev/pkg/apis" +) + +const parameterSubstitution = "[_a-zA-Z][_a-zA-Z0-9.-]*" + +const braceMatchingRegex = "(\\$(\\(%s.(?P%s)\\)))" + +func ValidateVariable(name, value, prefix, contextPrefix, locationName, path string, vars map[string]struct{}) *apis.FieldError { + if vs, present := extractVariablesFromString(value, contextPrefix+prefix); present { + for _, v := range vs { + if _, ok := vars[v]; !ok { + return &apis.FieldError{ + Message: fmt.Sprintf("non-existent variable in %q for %s %s", value, locationName, name), + Paths: []string{path + "." + name}, + } + } + } + } + return nil +} + +// Verifies that variables matching the relevant string expressions do not reference any of the names present in vars. +func ValidateVariableProhibited(name, value, prefix, contextPrefix, locationName, path string, vars map[string]struct{}) *apis.FieldError { + if vs, present := extractVariablesFromString(value, contextPrefix+prefix); present { + for _, v := range vs { + if _, ok := vars[v]; ok { + return &apis.FieldError{ + Message: fmt.Sprintf("variable type invalid in %q for %s %s", value, locationName, name), + Paths: []string{path + "." + name}, + } + } + } + } + return nil +} + +// Verifies that variables matching the relevant string expressions are completely isolated if present. +func ValidateVariableIsolated(name, value, prefix, contextPrefix, locationName, path string, vars map[string]struct{}) *apis.FieldError { + if vs, present := extractVariablesFromString(value, contextPrefix+prefix); present { + firstMatch, _ := extractExpressionFromString(value, contextPrefix+prefix) + for _, v := range vs { + if _, ok := vars[v]; ok { + if len(value) != len(firstMatch) { + return &apis.FieldError{ + Message: fmt.Sprintf("variable is not properly isolated in %q for %s %s", value, locationName, name), + Paths: []string{path + "." + name}, + } + } + } + } + } + return nil +} + +// Extract a the first full string expressions found (e.g "$(input.params.foo)"). Return +// "" and false if nothing is found. +func extractExpressionFromString(s, prefix string) (string, bool) { + pattern := fmt.Sprintf(braceMatchingRegex, prefix, parameterSubstitution) + re := regexp.MustCompile(pattern) + match := re.FindStringSubmatch(s) + if match == nil { + return "", false + } + return match[0], true +} + +func extractVariablesFromString(s, prefix string) ([]string, bool) { + pattern := fmt.Sprintf(braceMatchingRegex, prefix, parameterSubstitution) + re := regexp.MustCompile(pattern) + matches := re.FindAllStringSubmatch(s, -1) + if len(matches) == 0 { + return []string{}, false + } + vars := make([]string, len(matches)) + for i, match := range matches { + groups := matchGroups(match, re) + // foo -> foo + // foo.bar -> foo + // foo.bar.baz -> foo + vars[i] = strings.SplitN(groups["var"], ".", 2)[0] + } + return vars, true +} + +func matchGroups(matches []string, pattern *regexp.Regexp) map[string]string { + groups := make(map[string]string) + for i, name := range pattern.SubexpNames()[1:] { + groups[name] = matches[i+1] + } + return groups +} + +func ApplyReplacements(in string, replacements map[string]string) string { + for k, v := range replacements { + in = strings.Replace(in, fmt.Sprintf("$(%s)", k), v, -1) + } + return in +} + +// Take an input string, and output an array of strings related to possible arrayReplacements. If there aren't any +// areas where the input can be split up via arrayReplacements, then just return an array with a single element, +// which is ApplyReplacements(in, replacements). +func ApplyArrayReplacements(in string, stringReplacements map[string]string, arrayReplacements map[string][]string) []string { + for k, v := range arrayReplacements { + stringToReplace := fmt.Sprintf("$(%s)", k) + + // If the input string matches a replacement's key (without padding characters), return the corresponding array. + // Note that the webhook should prevent all instances where this could evaluate to false. + if (strings.Count(in, stringToReplace) == 1) && len(in) == len(stringToReplace) { + return v + } + } + + // Otherwise return a size-1 array containing the input string with standard stringReplacements applied. + return []string{ApplyReplacements(in, stringReplacements)} +} diff --git a/pkg/apis/pipeline/v1alpha2/substitution_test.go b/pkg/apis/pipeline/v1alpha2/substitution_test.go new file mode 100644 index 00000000000..97aaf49797f --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/substitution_test.go @@ -0,0 +1,234 @@ +/* +Copyright 2019 The Tekton Authors + "github.com/tektoncd/pipeline/pkg/substitution" + +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 v1alpha2_test + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "knative.dev/pkg/apis" +) + +func TestValidateVariables(t *testing.T) { + type args struct { + input string + prefix string + contextPrefix string + locationName string + path string + vars map[string]struct{} + } + for _, tc := range []struct { + name string + args args + expectedError *apis.FieldError + }{{ + name: "valid variable", + args: args{ + input: "--flag=$(inputs.params.baz)", + prefix: "params", + contextPrefix: "inputs.", + locationName: "step", + path: "taskspec.steps", + vars: map[string]struct{}{ + "baz": {}, + }, + }, + expectedError: nil, + }, { + name: "multiple variables", + args: args{ + input: "--flag=$(inputs.params.baz) $(input.params.foo)", + prefix: "params", + contextPrefix: "inputs.", + locationName: "step", + path: "taskspec.steps", + vars: map[string]struct{}{ + "baz": {}, + "foo": {}, + }, + }, + expectedError: nil, + }, { + name: "different context and prefix", + args: args{ + input: "--flag=$(something.baz)", + prefix: "something", + locationName: "step", + path: "taskspec.steps", + vars: map[string]struct{}{ + "baz": {}, + }, + }, + expectedError: nil, + }, { + name: "undefined variable", + args: args{ + input: "--flag=$(inputs.params.baz)", + prefix: "params", + contextPrefix: "inputs.", + locationName: "step", + path: "taskspec.steps", + vars: map[string]struct{}{ + "foo": {}, + }, + }, + expectedError: &apis.FieldError{ + Message: `non-existent variable in "--flag=$(inputs.params.baz)" for step somefield`, + Paths: []string{"taskspec.steps.somefield"}, + }, + }, { + name: "undefined variable and defined variable", + args: args{ + input: "--flag=$(inputs.params.baz) $(input.params.foo)", + prefix: "params", + contextPrefix: "inputs.", + locationName: "step", + path: "taskspec.steps", + vars: map[string]struct{}{ + "foo": {}, + }, + }, + expectedError: &apis.FieldError{ + Message: `non-existent variable in "--flag=$(inputs.params.baz) $(input.params.foo)" for step somefield`, + Paths: []string{"taskspec.steps.somefield"}, + }, + }} { + t.Run(tc.name, func(t *testing.T) { + got := v1alpha1.ValidateVariable("somefield", tc.args.input, tc.args.prefix, tc.args.contextPrefix, tc.args.locationName, tc.args.path, tc.args.vars) + + if d := cmp.Diff(got, tc.expectedError, cmp.AllowUnexported(apis.FieldError{})); d != "" { + t.Errorf("ValidateVariable() error did not match expected error %s", d) + } + }) + } +} + +func TestApplyReplacements(t *testing.T) { + type args struct { + input string + replacements map[string]string + } + tests := []struct { + name string + args args + expectedOutput string + }{ + { + name: "no replacements requested", + args: args{ + input: "this is a string", + replacements: map[string]string{}, + }, + expectedOutput: "this is a string", + }, + { + name: "single replacement requested", + args: args{ + input: "this is $(a) string", + replacements: map[string]string{"a": "not a"}, + }, + expectedOutput: "this is not a string", + }, + { + name: "single replacement requested multiple matches", + args: args{ + input: "this $(is) a string $(is) a string", + replacements: map[string]string{"is": "a"}, + }, + expectedOutput: "this a a string a a string", + }, + { + name: "multiple replacements requested", + args: args{ + input: "this $(is) a $(string) $(is) a $(string)", + replacements: map[string]string{"is": "a", "string": "sstring"}, + }, + expectedOutput: "this a a sstring a a sstring", + }, + { + name: "multiple replacements requested nothing replaced", + args: args{ + input: "this is a string", + replacements: map[string]string{"this": "a", "evxasdd": "string"}, + }, + expectedOutput: "this is a string", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + actualOutput := v1alpha1.ApplyReplacements(tt.args.input, tt.args.replacements) + if d := cmp.Diff(actualOutput, tt.expectedOutput); d != "" { + t.Errorf("ApplyReplacements() output did not match expected value %s", d) + } + }) + } +} + +func TestApplyArrayReplacements(t *testing.T) { + type args struct { + input string + stringReplacements map[string]string + arrayReplacements map[string][]string + } + for _, tc := range []struct { + name string + args args + expectedOutput []string + }{{ + name: "no replacements requested", + args: args{ + input: "this is a string", + stringReplacements: map[string]string{}, + arrayReplacements: map[string][]string{}, + }, + expectedOutput: []string{"this is a string"}, + }, { + name: "multiple replacements requested nothing replaced", + args: args{ + input: "this is a string", + stringReplacements: map[string]string{"key": "replacement", "anotherkey": "foo"}, + arrayReplacements: map[string][]string{"key2": {"replacement", "a"}, "key3": {"1", "2"}}, + }, + expectedOutput: []string{"this is a string"}, + }, { + name: "multiple replacements only string replacement possible", + args: args{ + input: "$(string)rep$(lacement)$(string)", + stringReplacements: map[string]string{"string": "word", "lacement": "lacements"}, + arrayReplacements: map[string][]string{"ace": {"replacement", "a"}, "string": {"1", "2"}}, + }, + expectedOutput: []string{"wordreplacementsword"}, + }, { + name: "array replacement", + args: args{ + input: "$(match)", + stringReplacements: map[string]string{"string": "word", "lacement": "lacements"}, + arrayReplacements: map[string][]string{"ace": {"replacement", "a"}, "match": {"1", "2"}}, + }, + expectedOutput: []string{"1", "2"}, + }} { + t.Run(tc.name, func(t *testing.T) { + actualOutput := v1alpha1.ApplyArrayReplacements(tc.args.input, tc.args.stringReplacements, tc.args.arrayReplacements) + if d := cmp.Diff(actualOutput, tc.expectedOutput); d != "" { + t.Errorf("ApplyArrayReplacements() output did not match expected value %s", d) + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/task_conversion.go b/pkg/apis/pipeline/v1alpha2/task_conversion.go new file mode 100644 index 00000000000..f93a2e5fcf3 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/task_conversion.go @@ -0,0 +1,34 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "context" + "fmt" + + "knative.dev/pkg/apis" +) + +// ConvertUp implements apis.Convertible +func (t *Task) ConvertUp(ctx context.Context, sink apis.Convertible) error { + return fmt.Errorf("v1alpha2 is the highest known version, got: %T", sink) +} + +// ConvertDown implements apis.Convertible +func (t *Task) ConvertDown(ctx context.Context, source apis.Convertible) error { + return fmt.Errorf("v1alpha2 is the highest known version, got: %T", source) +} diff --git a/pkg/apis/pipeline/v1alpha2/task_defaults.go b/pkg/apis/pipeline/v1alpha2/task_defaults.go new file mode 100644 index 00000000000..db274769d2c --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/task_defaults.go @@ -0,0 +1,38 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "context" +) + +func (t *Task) SetDefaults(ctx context.Context) { + t.Spec.SetDefaults(ctx) +} + +// SetDefaults set any defaults for the task spec +func (ts *TaskSpec) SetDefaults(ctx context.Context) { + if ts.Inputs != nil { + ts.Inputs.SetDefaults(ctx) + } + for i := range ts.Params { + ts.Params[i].SetDefaults(ctx) + } +} + +func (inputs *Inputs) SetDefaults(ctx context.Context) { +} diff --git a/pkg/apis/pipeline/v1alpha2/task_interface.go b/pkg/apis/pipeline/v1alpha2/task_interface.go new file mode 100644 index 00000000000..ecb8adeade4 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/task_interface.go @@ -0,0 +1,26 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// TaskInterface is implemented by Task and ClusterTask +type TaskInterface interface { + TaskMetadata() metav1.ObjectMeta + TaskSpec() TaskSpec + Copy() TaskInterface +} diff --git a/pkg/apis/pipeline/v1alpha2/task_types.go b/pkg/apis/pipeline/v1alpha2/task_types.go new file mode 100644 index 00000000000..5d35af18c46 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/task_types.go @@ -0,0 +1,160 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/apis" +) + +func (t *Task) TaskSpec() TaskSpec { + return t.Spec +} + +func (t *Task) TaskMetadata() metav1.ObjectMeta { + return t.ObjectMeta +} + +func (t *Task) Copy() TaskInterface { + return t.DeepCopy() +} + +// TaskSpec defines the desired state of Task. +type TaskSpec struct { + // Params is a list of input parameters required to run the task. Params + // must be supplied as inputs in TaskRuns unless they declare a default + // value. + // +optional + Params []ParamSpec `json:"params,omitempty"` + // Inputs is an optional set of parameters and resources which must be + // supplied by the user when a Task is executed by a TaskRun. + // +optional + Inputs *Inputs `json:"inputs,omitempty"` + // Outputs is an optional set of resources and results produced when this + // Task is run. + // +optional + Outputs *Outputs `json:"outputs,omitempty"` + + // Steps are the steps of the build; each step is run sequentially with the + // source mounted into /workspace. + Steps []Step `json:"steps,omitempty"` + + // Volumes is a collection of volumes that are available to mount into the + // steps of the build. + Volumes []corev1.Volume `json:"volumes,omitempty"` + + // StepTemplate can be used as the basis for all step containers within the + // Task, so that the steps inherit settings on the base container. + StepTemplate *corev1.Container `json:"stepTemplate,omitempty"` + + // Sidecars are run alongside the Task's step containers. They begin before + // the steps start and end after the steps complete. + Sidecars []corev1.Container `json:"sidecars,omitempty"` +} + +// Step embeds the Container type, which allows it to include fields not +// provided by Container. +type Step struct { + corev1.Container + + // Script is the contents of an executable file to execute. + // + // If Script is not empty, the Step cannot have an Command or Args. + Script string `json:"script,omitempty"` +} + +// Check that Task may be validated and defaulted. +var _ apis.Validatable = (*Task)(nil) +var _ apis.Defaultable = (*Task)(nil) +var _ apis.Convertible = (*Task)(nil) + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Task represents a collection of sequential steps that are run as part of a +// Pipeline using a set of inputs and producing a set of outputs. Tasks execute +// when TaskRuns are created that provide the input parameters and resources and +// output resources the Task requires. +// +// +k8s:openapi-gen=true +type Task struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata"` + + // Spec holds the desired state of the Task from the client + // +optional + Spec TaskSpec `json:"spec"` +} + +// Inputs are the requirements that a task needs to run a Build. +type Inputs struct { + // Resources is a list of the input resources required to run the task. + // Resources are represented in TaskRuns as bindings to instances of + // PipelineResources. + // +optional + Resources []TaskResource `json:"resources,omitempty"` + + // Deprecated + // Params is a list of input parameters required to run the task. Params + // must be supplied as inputs in TaskRuns unless they declare a default + // value. + // +optional + // Params []ParamSpec `json:"params,omitempty"` +} + +// 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 { + ResourceDeclaration `json:",inline"` +} + +// 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 { + // +optional + Results []TestResult `json:"results,omitempty"` + // +optional + Resources []TaskResource `json:"resources,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 declares the name by which a result is referenced in the Task's + // definition. Results may be referenced by name in the definition of a + // Task's steps. + 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"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TaskList contains a list of Task +type TaskList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []Task `json:"items"` +} diff --git a/pkg/apis/pipeline/v1alpha2/task_validation.go b/pkg/apis/pipeline/v1alpha2/task_validation.go new file mode 100644 index 00000000000..3c001a64408 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/task_validation.go @@ -0,0 +1,330 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "context" + "fmt" + "strings" + + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/equality" + "k8s.io/apimachinery/pkg/util/validation" + "knative.dev/pkg/apis" +) + +func (t *Task) Validate(ctx context.Context) *apis.FieldError { + if err := validateObjectMetadata(t.GetObjectMeta()); err != nil { + return err.ViaField("metadata") + } + return t.Spec.Validate(ctx) +} + +func (ts *TaskSpec) Validate(ctx context.Context) *apis.FieldError { + if equality.Semantic.DeepEqual(ts, &TaskSpec{}) { + return apis.ErrMissingField(apis.CurrentField) + } + + if len(ts.Steps) == 0 { + return apis.ErrMissingField("steps") + } + if err := ValidateVolumes(ts.Volumes).ViaField("volumes"); err != nil { + return err + } + mergedSteps, err := MergeStepsWithStepTemplate(ts.StepTemplate, ts.Steps) + if err != nil { + return &apis.FieldError{ + Message: fmt.Sprintf("error merging step template and steps: %s", err), + Paths: []string{"stepTemplate"}, + } + } + + if err := validateSteps(mergedSteps).ViaField("steps"); err != nil { + return err + } + + // A task doesn't have to have inputs or outputs, but if it does they must be valid. + // A task can't duplicate input or output names. + + if err := validateParameterTypes(ts.Params); err != nil { + return err + } + if ts.Inputs != nil { + for _, resource := range ts.Inputs.Resources { + if err := validateResourceType(resource, fmt.Sprintf("taskspec.Inputs.Resources.%s.Type", resource.Name)); err != nil { + return err + } + } + if err := checkForDuplicates(ts.Inputs.Resources, "taskspec.Inputs.Resources.Name"); err != nil { + return err + } + } + if ts.Outputs != nil { + for _, resource := range ts.Outputs.Resources { + if err := validateResourceType(resource, fmt.Sprintf("taskspec.Outputs.Resources.%s.Type", resource.Name)); err != nil { + return err + } + } + if err := checkForDuplicates(ts.Outputs.Resources, "taskspec.Outputs.Resources.Name"); err != nil { + return err + } + } + + // Validate task step names + for _, step := range ts.Steps { + if errs := validation.IsDNS1123Label(step.Name); step.Name != "" && len(errs) > 0 { + return &apis.FieldError{ + Message: fmt.Sprintf("invalid value %q", step.Name), + Paths: []string{"taskspec.steps.name"}, + Details: "Task step name must be a valid DNS Label, For more info refer to https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + } + } + } + + /* + if err := validateParameterVariables(ts.Steps, ts.Params); err != nil { + return err + } + */ + if err := validateResourceVariables(ts.Steps, ts.Inputs, ts.Outputs); err != nil { + return err + } + return nil +} + +func ValidateVolumes(volumes []corev1.Volume) *apis.FieldError { + // Task must not have duplicate volume names. + vols := map[string]struct{}{} + for _, v := range volumes { + if _, ok := vols[v.Name]; ok { + return &apis.FieldError{ + Message: fmt.Sprintf("multiple volumes with same name %q", v.Name), + Paths: []string{"name"}, + } + } + vols[v.Name] = struct{}{} + } + return nil +} + +func validateSteps(steps []Step) *apis.FieldError { + // Task must not have duplicate step names. + names := map[string]struct{}{} + for _, s := range steps { + if s.Image == "" { + return apis.ErrMissingField("Image") + } + + if s.Script != "" { + if len(s.Args) > 0 || len(s.Command) > 0 { + return &apis.FieldError{ + Message: "script cannot be used with args or command", + Paths: []string{"script"}, + } + } + if !strings.HasPrefix(strings.TrimSpace(s.Script), "#!") { + return &apis.FieldError{ + Message: "script must start with a shebang (#!)", + Paths: []string{"script"}, + } + } + } + + if s.Name == "" { + continue + } + if _, ok := names[s.Name]; ok { + return apis.ErrInvalidValue(s.Name, "name") + } + names[s.Name] = struct{}{} + } + return nil +} + +func validateParameterTypes(params []ParamSpec) *apis.FieldError { + for _, p := range params { + // Ensure param has a valid type. + validType := false + for _, allowedType := range AllParamTypes { + if p.Type == allowedType { + validType = true + } + } + if !validType { + return apis.ErrInvalidValue(p.Type, fmt.Sprintf("taskspec.params.%s.type", p.Name)) + } + + // If a default value is provided, ensure its type matches param's declared type. + if (p.Default != nil) && (p.Default.Type != p.Type) { + return &apis.FieldError{ + Message: fmt.Sprintf( + "\"%v\" type does not match default value's type: \"%v\"", p.Type, p.Default.Type), + Paths: []string{ + fmt.Sprintf("taskspec.params.%s.type", p.Name), + fmt.Sprintf("taskspec.params.%s.default.type", p.Name), + }, + } + } + } + return nil +} + +func validateParameterVariables(steps []Step, params []ParamSpec) *apis.FieldError { + parameterNames := map[string]struct{}{} + arrayParameterNames := map[string]struct{}{} + + for _, p := range params { + parameterNames[p.Name] = struct{}{} + if p.Type == ParamTypeArray { + arrayParameterNames[p.Name] = struct{}{} + } + } + + if err := validateVariables(steps, "", parameterNames); err != nil { + return err + } + return validateArrayUsage(steps, "", arrayParameterNames) +} + +func validateResourceVariables(steps []Step, inputs *Inputs, outputs *Outputs) *apis.FieldError { + resourceNames := map[string]struct{}{} + if inputs != nil { + for _, r := range inputs.Resources { + resourceNames[r.Name] = struct{}{} + } + } + if outputs != nil { + for _, r := range outputs.Resources { + resourceNames[r.Name] = struct{}{} + } + } + return validateVariables(steps, "resources", resourceNames) +} + +func validateArrayUsage(steps []Step, prefix string, vars map[string]struct{}) *apis.FieldError { + for _, step := range steps { + if err := validateTaskNoArrayReferenced("name", step.Name, prefix, vars); err != nil { + return err + } + if err := validateTaskNoArrayReferenced("image", step.Image, prefix, vars); err != nil { + return err + } + if err := validateTaskNoArrayReferenced("workingDir", step.WorkingDir, prefix, vars); err != nil { + return err + } + for i, cmd := range step.Command { + if err := validateTaskArraysIsolated(fmt.Sprintf("command[%d]", i), cmd, prefix, vars); err != nil { + return err + } + } + for i, arg := range step.Args { + if err := validateTaskArraysIsolated(fmt.Sprintf("arg[%d]", i), arg, prefix, vars); err != nil { + return err + } + } + for _, env := range step.Env { + if err := validateTaskNoArrayReferenced(fmt.Sprintf("env[%s]", env.Name), env.Value, prefix, vars); err != nil { + return err + } + } + for i, v := range step.VolumeMounts { + if err := validateTaskNoArrayReferenced(fmt.Sprintf("volumeMount[%d].Name", i), v.Name, prefix, vars); err != nil { + return err + } + if err := validateTaskNoArrayReferenced(fmt.Sprintf("volumeMount[%d].MountPath", i), v.MountPath, prefix, vars); err != nil { + return err + } + if err := validateTaskNoArrayReferenced(fmt.Sprintf("volumeMount[%d].SubPath", i), v.SubPath, prefix, vars); err != nil { + return err + } + } + } + return nil +} + +func validateVariables(steps []Step, prefix string, vars map[string]struct{}) *apis.FieldError { + for _, step := range steps { + if err := validateTaskVariable("name", step.Name, prefix, vars); err != nil { + return err + } + if err := validateTaskVariable("image", step.Image, prefix, vars); err != nil { + return err + } + if err := validateTaskVariable("workingDir", step.WorkingDir, prefix, vars); err != nil { + return err + } + for i, cmd := range step.Command { + if err := validateTaskVariable(fmt.Sprintf("command[%d]", i), cmd, prefix, vars); err != nil { + return err + } + } + for i, arg := range step.Args { + if err := validateTaskVariable(fmt.Sprintf("arg[%d]", i), arg, prefix, vars); err != nil { + return err + } + } + for _, env := range step.Env { + if err := validateTaskVariable(fmt.Sprintf("env[%s]", env.Name), env.Value, prefix, vars); err != nil { + return err + } + } + for i, v := range step.VolumeMounts { + if err := validateTaskVariable(fmt.Sprintf("volumeMount[%d].Name", i), v.Name, prefix, vars); err != nil { + return err + } + if err := validateTaskVariable(fmt.Sprintf("volumeMount[%d].MountPath", i), v.MountPath, prefix, vars); err != nil { + return err + } + if err := validateTaskVariable(fmt.Sprintf("volumeMount[%d].SubPath", i), v.SubPath, prefix, vars); err != nil { + return err + } + } + } + return nil +} + +func validateTaskVariable(name, value, prefix string, vars map[string]struct{}) *apis.FieldError { + return ValidateVariable(name, value, prefix, "(?:inputs|outputs).", "step", "taskspec.steps", vars) +} + +func validateTaskNoArrayReferenced(name, value, prefix string, arrayNames map[string]struct{}) *apis.FieldError { + return ValidateVariableProhibited(name, value, prefix, "(?:inputs|outputs).", "step", "taskspec.steps", arrayNames) +} + +func validateTaskArraysIsolated(name, value, prefix string, arrayNames map[string]struct{}) *apis.FieldError { + return ValidateVariableIsolated(name, value, prefix, "(?:inputs|outputs).", "step", "taskspec.steps", arrayNames) +} + +func checkForDuplicates(resources []TaskResource, path string) *apis.FieldError { + encountered := map[string]struct{}{} + for _, r := range resources { + if _, ok := encountered[strings.ToLower(r.Name)]; ok { + return apis.ErrMultipleOneOf(path) + } + encountered[strings.ToLower(r.Name)] = struct{}{} + } + return nil +} + +func validateResourceType(r TaskResource, path string) *apis.FieldError { + for _, allowed := range AllResourceTypes { + if r.Type == allowed { + return nil + } + } + return apis.ErrInvalidValue(string(r.Type), path) +} diff --git a/pkg/apis/pipeline/v1alpha2/task_validation_test.go b/pkg/apis/pipeline/v1alpha2/task_validation_test.go new file mode 100644 index 00000000000..03454c01092 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/task_validation_test.go @@ -0,0 +1,685 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "context" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/test/builder" + corev1 "k8s.io/api/core/v1" + "knative.dev/pkg/apis" +) + +var validResource = v1alpha1.TaskResource{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source", + Type: "git", + }, +} + +var validImageResource = v1alpha1.TaskResource{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source", + Type: "image", + }, +} + +var invalidResource = v1alpha1.TaskResource{ + ResourceDeclaration: v1alpha1.ResourceDeclaration{ + Name: "source", + Type: "what", + }, +} + +var validSteps = []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "myimage", +}}} + +var invalidSteps = []v1alpha1.Step{{Container: corev1.Container{ + Name: "replaceImage", + Image: "myimage", +}}} + +func TestTaskSpecValidate(t *testing.T) { + type fields struct { + Inputs *v1alpha1.Inputs + Outputs *v1alpha1.Outputs + Steps []v1alpha1.Step + StepTemplate *corev1.Container + } + tests := []struct { + name string + fields fields + }{{ + name: "unnamed steps", + fields: fields{ + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Image: "myimage", + }}, {Container: corev1.Container{ + Image: "myotherimage", + }}}, + }, + }, { + name: "valid inputs (type implied)", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validResource}, + Params: []v1alpha1.ParamSpec{{ + Name: "task", + Description: "param", + Default: builder.ArrayOrString("default"), + }}, + }, + Steps: validSteps, + }, + }, { + name: "valid inputs type explicit", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validResource}, + Params: []v1alpha1.ParamSpec{{ + Name: "task", + Type: v1alpha1.ParamTypeString, + Description: "param", + Default: builder.ArrayOrString("default"), + }}, + }, + Steps: validSteps, + }, + }, { + name: "valid outputs", + fields: fields{ + Outputs: &v1alpha1.Outputs{ + Resources: []v1alpha1.TaskResource{validResource}, + }, + Steps: validSteps, + }, + }, { + name: "both valid", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validResource}, + }, + Outputs: &v1alpha1.Outputs{ + Resources: []v1alpha1.TaskResource{validResource}, + }, + Steps: validSteps, + }, + }, { + name: "output image resoure", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validImageResource}, + }, + Outputs: &v1alpha1.Outputs{ + Resources: []v1alpha1.TaskResource{validImageResource}, + }, + Steps: validSteps, + }, + }, { + name: "valid template variable", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validImageResource}, + Params: []v1alpha1.ParamSpec{{ + Name: "baz", + }, { + Name: "foo-is-baz", + }}, + }, + Outputs: &v1alpha1.Outputs{ + Resources: []v1alpha1.TaskResource{validResource}, + }, + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "$(inputs.resources.source.url)", + Args: []string{"--flag=$(inputs.params.baz) && $(input.params.foo-is-baz)"}, + WorkingDir: "/foo/bar/$(outputs.resources.source)", + }}}, + }, + }, { + name: "valid array template variable", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validImageResource}, + Params: []v1alpha1.ParamSpec{{ + Name: "baz", + Type: v1alpha1.ParamTypeArray, + }, { + Name: "foo-is-baz", + Type: v1alpha1.ParamTypeArray, + }}, + }, + Outputs: &v1alpha1.Outputs{ + Resources: []v1alpha1.TaskResource{validResource}, + }, + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "$(inputs.resources.source.url)", + Command: []string{"$(inputs.param.foo-is-baz)"}, + Args: []string{"$(inputs.params.baz)", "middle string", "$(input.params.foo-is-baz)"}, + WorkingDir: "/foo/bar/$(outputs.resources.source)", + }}}, + }, + }, { + name: "step template included in validation", + fields: fields{ + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "astep", + Command: []string{"echo"}, + Args: []string{"hello"}, + }}}, + StepTemplate: &corev1.Container{ + Image: "some-image", + }, + }, + }, { + name: "valid step with script", + fields: fields{ + Steps: []v1alpha1.Step{{ + Container: corev1.Container{ + Image: "my-image", + }, + Script: ` + #!/usr/bin/env bash + hello world`, + }}, + }, + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ts := &v1alpha1.TaskSpec{ + Inputs: tt.fields.Inputs, + Outputs: tt.fields.Outputs, + Steps: tt.fields.Steps, + StepTemplate: tt.fields.StepTemplate, + } + ctx := context.Background() + ts.SetDefaults(ctx) + if err := ts.Validate(ctx); err != nil { + t.Errorf("TaskSpec.Validate() = %v", err) + } + }) + } +} + +func TestTaskSpecValidateError(t *testing.T) { + type fields struct { + Inputs *v1alpha1.Inputs + Outputs *v1alpha1.Outputs + Steps []v1alpha1.Step + Volumes []corev1.Volume + } + tests := []struct { + name string + fields fields + expectedError apis.FieldError + }{{ + name: "nil", + expectedError: apis.FieldError{ + Message: `missing field(s)`, + Paths: []string{""}, + }, + }, { + name: "no build", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validResource}, + }, + }, + expectedError: apis.FieldError{ + Message: `missing field(s)`, + Paths: []string{"steps"}, + }, + }, { + name: "one invalid input", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{ + invalidResource, + validResource, + }, + }, + Outputs: &v1alpha1.Outputs{ + Resources: []v1alpha1.TaskResource{ + validResource, + }, + }, + Steps: validSteps, + }, + expectedError: apis.FieldError{ + Message: `invalid value: what`, + Paths: []string{"taskspec.Inputs.Resources.source.Type"}, + }, + }, { + name: "invalid input type", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validResource}, + Params: []v1alpha1.ParamSpec{{ + Name: "validparam", + Type: v1alpha1.ParamTypeString, + Description: "parameter", + Default: builder.ArrayOrString("default"), + }, { + Name: "param-with-invalid-type", + Type: "invalidtype", + Description: "invalidtypedesc", + Default: builder.ArrayOrString("default"), + }}, + }, + Steps: validSteps, + }, + expectedError: apis.FieldError{ + Message: `invalid value: invalidtype`, + Paths: []string{"taskspec.inputs.params.param-with-invalid-type.type"}, + }, + }, { + name: "input mismatching default/type 1", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validResource}, + Params: []v1alpha1.ParamSpec{{ + Name: "task", + Type: v1alpha1.ParamTypeArray, + Description: "param", + Default: builder.ArrayOrString("default"), + }}, + }, + Steps: validSteps, + }, + expectedError: apis.FieldError{ + Message: `"array" type does not match default value's type: "string"`, + Paths: []string{"taskspec.inputs.params.task.type", "taskspec.inputs.params.task.default.type"}, + }, + }, { + name: "input mismatching default/type 2", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validResource}, + Params: []v1alpha1.ParamSpec{{ + Name: "task", + Type: v1alpha1.ParamTypeString, + Description: "param", + Default: builder.ArrayOrString("default", "array"), + }}, + }, + Steps: validSteps, + }, + expectedError: apis.FieldError{ + Message: `"string" type does not match default value's type: "array"`, + Paths: []string{"taskspec.inputs.params.task.type", "taskspec.inputs.params.task.default.type"}, + }, + }, { + name: "one invalid output", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{ + validResource, + }, + }, + Outputs: &v1alpha1.Outputs{ + Resources: []v1alpha1.TaskResource{ + invalidResource, + validResource, + }, + }, + Steps: validSteps, + }, + expectedError: apis.FieldError{ + Message: `invalid value: what`, + Paths: []string{"taskspec.Outputs.Resources.source.Type"}, + }, + }, { + name: "duplicated inputs", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{ + validResource, + validResource, + }, + }, + Outputs: &v1alpha1.Outputs{ + Resources: []v1alpha1.TaskResource{ + validResource, + }, + }, + Steps: validSteps, + }, + expectedError: apis.FieldError{ + Message: "expected exactly one, got both", + Paths: []string{"taskspec.Inputs.Resources.Name"}, + }, + }, { + name: "duplicated outputs", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{ + validResource, + }, + }, + Outputs: &v1alpha1.Outputs{ + Resources: []v1alpha1.TaskResource{ + validResource, + validResource, + }, + }, + Steps: validSteps, + }, + expectedError: apis.FieldError{ + Message: "expected exactly one, got both", + Paths: []string{"taskspec.Outputs.Resources.Name"}, + }, + }, { + name: "invalid build", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validResource}, + }, + Steps: []v1alpha1.Step{}, + }, + expectedError: apis.FieldError{ + Message: "missing field(s)", + Paths: []string{"steps"}, + }, + }, { + name: "invalid build step name", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validResource}, + }, + Steps: invalidSteps, + }, + expectedError: apis.FieldError{ + Message: `invalid value "replaceImage"`, + Paths: []string{"taskspec.steps.name"}, + Details: "Task step name must be a valid DNS Label, For more info refer to https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + }, + }, { + name: "inexistent input param variable", + fields: fields{ + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "myimage", + Args: []string{"--flag=$(inputs.params.inexistent)"}, + }}}, + }, + expectedError: apis.FieldError{ + Message: `non-existent variable in "--flag=$(inputs.params.inexistent)" for step arg[0]`, + Paths: []string{"taskspec.steps.arg[0]"}, + }, + }, { + name: "array used in unaccepted field", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validImageResource}, + Params: []v1alpha1.ParamSpec{{ + Name: "baz", + Type: v1alpha1.ParamTypeArray, + }, { + Name: "foo-is-baz", + Type: v1alpha1.ParamTypeArray, + }}, + }, + Outputs: &v1alpha1.Outputs{ + Resources: []v1alpha1.TaskResource{validResource}, + }, + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "$(inputs.params.baz)", + Command: []string{"$(inputs.param.foo-is-baz)"}, + Args: []string{"$(inputs.params.baz)", "middle string", "$(input.resources.foo.url)"}, + WorkingDir: "/foo/bar/$(outputs.resources.source)", + }}}, + }, + expectedError: apis.FieldError{ + Message: `variable type invalid in "$(inputs.params.baz)" for step image`, + Paths: []string{"taskspec.steps.image"}, + }, + }, { + name: "array not properly isolated", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validImageResource}, + Params: []v1alpha1.ParamSpec{{ + Name: "baz", + Type: v1alpha1.ParamTypeArray, + }, { + Name: "foo-is-baz", + Type: v1alpha1.ParamTypeArray, + }}, + }, + Outputs: &v1alpha1.Outputs{ + Resources: []v1alpha1.TaskResource{validResource}, + }, + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "someimage", + Command: []string{"$(inputs.param.foo-is-baz)"}, + Args: []string{"not isolated: $(inputs.params.baz)", "middle string", "$(input.resources.foo.url)"}, + WorkingDir: "/foo/bar/$(outputs.resources.source)", + }}}, + }, + expectedError: apis.FieldError{ + Message: `variable is not properly isolated in "not isolated: $(inputs.params.baz)" for step arg[0]`, + Paths: []string{"taskspec.steps.arg[0]"}, + }, + }, { + name: "array not properly isolated", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validImageResource}, + Params: []v1alpha1.ParamSpec{{ + Name: "baz", + Type: v1alpha1.ParamTypeArray, + }, { + Name: "foo-is-baz", + Type: v1alpha1.ParamTypeArray, + }}, + }, + Outputs: &v1alpha1.Outputs{ + Resources: []v1alpha1.TaskResource{validResource}, + }, + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "someimage", + Command: []string{"$(inputs.param.foo-is-baz)"}, + Args: []string{"not isolated: $(inputs.params.baz)", "middle string", "$(input.resources.foo.url)"}, + WorkingDir: "/foo/bar/$(outputs.resources.source)", + }}}, + }, + expectedError: apis.FieldError{ + Message: `variable is not properly isolated in "not isolated: $(inputs.params.baz)" for step arg[0]`, + Paths: []string{"taskspec.steps.arg[0]"}, + }, + }, { + name: "inexistent input resource variable", + fields: fields{ + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "myimage:$(inputs.resources.inputs)", + }}}, + }, + expectedError: apis.FieldError{ + Message: `non-existent variable in "myimage:$(inputs.resources.inputs)" for step image`, + Paths: []string{"taskspec.steps.image"}, + }, + }, { + name: "inferred array not properly isolated", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Resources: []v1alpha1.TaskResource{validImageResource}, + Params: []v1alpha1.ParamSpec{{ + Name: "baz", + Default: &v1alpha1.ArrayOrString{ + Type: v1alpha1.ParamTypeArray, + ArrayVal: []string{"implied", "array", "type"}, + }, + }, { + Name: "foo-is-baz", + Default: &v1alpha1.ArrayOrString{ + Type: v1alpha1.ParamTypeArray, + ArrayVal: []string{"implied", "array", "type"}, + }, + }}, + }, + Outputs: &v1alpha1.Outputs{ + Resources: []v1alpha1.TaskResource{validResource}, + }, + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "someimage", + Command: []string{"$(inputs.param.foo-is-baz)"}, + Args: []string{"not isolated: $(inputs.params.baz)", "middle string", "$(input.resources.foo.url)"}, + WorkingDir: "/foo/bar/$(outputs.resources.source)", + }}}, + }, + expectedError: apis.FieldError{ + Message: `variable is not properly isolated in "not isolated: $(inputs.params.baz)" for step arg[0]`, + Paths: []string{"taskspec.steps.arg[0]"}, + }, + }, { + name: "inexistent input resource variable", + fields: fields{ + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "myimage:$(inputs.resources.inputs)", + }}}, + }, + expectedError: apis.FieldError{ + Message: `non-existent variable in "myimage:$(inputs.resources.inputs)" for step image`, + Paths: []string{"taskspec.steps.image"}, + }, + }, { + name: "inexistent output param variable", + fields: fields{ + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "myimage", + WorkingDir: "/foo/bar/$(outputs.resources.inexistent)", + }}}, + }, + expectedError: apis.FieldError{ + Message: `non-existent variable in "/foo/bar/$(outputs.resources.inexistent)" for step workingDir`, + Paths: []string{"taskspec.steps.workingDir"}, + }, + }, { + name: "Inexistent param variable with existing", + fields: fields{ + Inputs: &v1alpha1.Inputs{ + Params: []v1alpha1.ParamSpec{ + { + Name: "foo", + Description: "param", + Default: builder.ArrayOrString("default"), + }, + }, + }, + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "myimage", + Args: []string{"$(inputs.params.foo) && $(inputs.params.inexistent)"}, + }}}, + }, + expectedError: apis.FieldError{ + Message: `non-existent variable in "$(inputs.params.foo) && $(inputs.params.inexistent)" for step arg[0]`, + Paths: []string{"taskspec.steps.arg[0]"}, + }, + }, { + name: "Multiple volumes with same name", + fields: fields{ + Steps: validSteps, + Volumes: []corev1.Volume{{ + Name: "workspace", + }, { + Name: "workspace", + }}, + }, + expectedError: apis.FieldError{ + Message: `multiple volumes with same name "workspace"`, + Paths: []string{"volumes.name"}, + }, + }, { + name: "step with script and args", + fields: fields{ + Steps: []v1alpha1.Step{{ + Container: corev1.Container{ + Image: "myimage", + Args: []string{"arg"}, + }, + Script: "script", + }}, + }, + expectedError: apis.FieldError{ + Message: "script cannot be used with args or command", + Paths: []string{"steps.script"}, + }, + }, { + name: "step with script without shebang", + fields: fields{ + Steps: []v1alpha1.Step{{ + Container: corev1.Container{ + Image: "my-image", + }, + Script: "does not begin with shebang", + }}, + }, + expectedError: apis.FieldError{ + Message: "script must start with a shebang (#!)", + Paths: []string{"steps.script"}, + }, + }, { + name: "step with script and command", + fields: fields{ + Steps: []v1alpha1.Step{{ + Container: corev1.Container{ + Image: "myimage", + Command: []string{"command"}, + }, + Script: "script", + }}, + }, + expectedError: apis.FieldError{ + Message: "script cannot be used with args or command", + Paths: []string{"steps.script"}, + }, + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ts := &v1alpha1.TaskSpec{ + Inputs: tt.fields.Inputs, + Outputs: tt.fields.Outputs, + Steps: tt.fields.Steps, + Volumes: tt.fields.Volumes, + } + ctx := context.Background() + ts.SetDefaults(ctx) + err := ts.Validate(context.Background()) + if err == nil { + t.Fatalf("Expected an error, got nothing for %v", ts) + } + if d := cmp.Diff(tt.expectedError, *err, cmpopts.IgnoreUnexported(apis.FieldError{})); d != "" { + t.Errorf("TaskSpec.Validate() errors diff -want, +got: %v", d) + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_conversion.go b/pkg/apis/pipeline/v1alpha2/taskrun_conversion.go new file mode 100644 index 00000000000..a3d5886a9d9 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/taskrun_conversion.go @@ -0,0 +1,34 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "context" + "fmt" + + "knative.dev/pkg/apis" +) + +// ConvertUp implements apis.Convertible +func (source *TaskRun) ConvertUp(ctx context.Context, sink apis.Convertible) error { + return fmt.Errorf("v1alpha2 is the highest known version, got: %T", sink) +} + +// ConvertDown implements apis.Convertible +func (sink *TaskRun) ConvertDown(ctx context.Context, source apis.Convertible) error { + return fmt.Errorf("v1alpha2 is the highest known version, got: %T", source) +} diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_defaults.go b/pkg/apis/pipeline/v1alpha2/taskrun_defaults.go new file mode 100644 index 00000000000..943879d59aa --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/taskrun_defaults.go @@ -0,0 +1,59 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "context" + "time" + + "github.com/tektoncd/pipeline/pkg/apis/config" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func (tr *TaskRun) SetDefaults(ctx context.Context) { + tr.Spec.SetDefaults(ctx) +} + +func (trs *TaskRunSpec) SetDefaults(ctx context.Context) { + cfg := config.FromContextOrDefaults(ctx) + if trs.TaskRef != nil && trs.TaskRef.Kind == "" { + trs.TaskRef.Kind = NamespacedTaskKind + } + + if trs.Timeout == nil { + var timeout *metav1.Duration + if IsUpgradeViaDefaulting(ctx) { + // This case is for preexisting `TaskRun` before 0.5.0, so let's + // add the old default timeout. + // Most likely those TaskRun passing here are already done and/or already running + timeout = &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute} + } else { + timeout = &metav1.Duration{Duration: time.Duration(cfg.Defaults.DefaultTimeoutMinutes) * time.Minute} + } + trs.Timeout = timeout + } + + defaultSA := cfg.Defaults.DefaultServiceAccount + if trs.ServiceAccountName == "" && defaultSA != "" { + trs.ServiceAccountName = defaultSA + } + + // If this taskrun has an embedded task, apply the usual task defaults + if trs.TaskSpec != nil { + trs.TaskSpec.SetDefaults(ctx) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_defaults_test.go b/pkg/apis/pipeline/v1alpha2/taskrun_defaults_test.go new file mode 100644 index 00000000000..c69f96c7cb8 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/taskrun_defaults_test.go @@ -0,0 +1,209 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "context" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/config" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + logtesting "knative.dev/pkg/logging/testing" +) + +func TestTaskRunSpec_SetDefaults(t *testing.T) { + cases := []struct { + desc string + trs *v1alpha1.TaskRunSpec + want *v1alpha1.TaskRunSpec + }{{ + desc: "taskref is nil", + trs: &v1alpha1.TaskRunSpec{ + TaskRef: nil, + Timeout: &metav1.Duration{Duration: 500 * time.Millisecond}, + }, + want: &v1alpha1.TaskRunSpec{ + TaskRef: nil, + Timeout: &metav1.Duration{Duration: 500 * time.Millisecond}, + }, + }, { + desc: "taskref kind is empty", + trs: &v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{}, + Timeout: &metav1.Duration{Duration: 500 * time.Millisecond}, + }, + want: &v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{Kind: v1alpha1.NamespacedTaskKind}, + Timeout: &metav1.Duration{Duration: 500 * time.Millisecond}, + }, + }, { + desc: "timeout is nil", + trs: &v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{Kind: v1alpha1.ClusterTaskKind}, + }, + want: &v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{Kind: v1alpha1.ClusterTaskKind}, + Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, + }, + }, { + desc: "embedded taskSpec", + trs: &v1alpha1.TaskRunSpec{ + TaskSpec: &v1alpha1.TaskSpec{ + Inputs: &v1alpha1.Inputs{ + Params: []v1alpha1.ParamSpec{{ + Name: "param-name", + }}, + }, + }, + }, + want: &v1alpha1.TaskRunSpec{ + TaskSpec: &v1alpha1.TaskSpec{ + Inputs: &v1alpha1.Inputs{ + Params: []v1alpha1.ParamSpec{{ + Name: "param-name", + Type: v1alpha1.ParamTypeString, + }}, + }, + }, + Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, + }, + }} + for _, tc := range cases { + t.Run(tc.desc, func(t *testing.T) { + ctx := context.Background() + tc.trs.SetDefaults(ctx) + + if diff := cmp.Diff(tc.want, tc.trs); diff != "" { + t.Errorf("Mismatch of TaskRunSpec: %s", diff) + } + }) + } +} + +func TestTaskRunDefaulting(t *testing.T) { + tests := []struct { + name string + in *v1alpha1.TaskRun + want *v1alpha1.TaskRun + wc func(context.Context) context.Context + }{{ + name: "empty no context", + in: &v1alpha1.TaskRun{}, + want: &v1alpha1.TaskRun{ + Spec: v1alpha1.TaskRunSpec{ + Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, + }, + }, + }, { + name: "TaskRef default to namespace kind", + in: &v1alpha1.TaskRun{ + Spec: v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{Name: "foo"}, + }, + }, + want: &v1alpha1.TaskRun{ + Spec: v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{Name: "foo", Kind: v1alpha1.NamespacedTaskKind}, + Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, + }, + }, + }, { + name: "TaskRef upgrade context", + in: &v1alpha1.TaskRun{ + Spec: v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{Name: "foo"}, + }, + }, + want: &v1alpha1.TaskRun{ + Spec: v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{Name: "foo", Kind: v1alpha1.NamespacedTaskKind}, + Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, + }, + }, + wc: v1alpha1.WithUpgradeViaDefaulting, + }, { + name: "TaskRef default config context", + in: &v1alpha1.TaskRun{ + Spec: v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{Name: "foo"}, + }, + }, + want: &v1alpha1.TaskRun{ + Spec: v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{Name: "foo", Kind: v1alpha1.NamespacedTaskKind}, + Timeout: &metav1.Duration{Duration: 5 * time.Minute}, + }, + }, + wc: func(ctx context.Context) context.Context { + s := config.NewStore(logtesting.TestLogger(t)) + s.OnConfigChanged(&corev1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: config.DefaultsConfigName, + }, + Data: map[string]string{ + "default-timeout-minutes": "5", + }, + }) + return s.ToContext(ctx) + }, + }, { + name: "TaskRef default config context with SA", + in: &v1alpha1.TaskRun{ + Spec: v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{Name: "foo"}, + }, + }, + want: &v1alpha1.TaskRun{ + Spec: v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{Name: "foo", Kind: v1alpha1.NamespacedTaskKind}, + Timeout: &metav1.Duration{Duration: 5 * time.Minute}, + ServiceAccountName: "tekton", + }, + }, + wc: func(ctx context.Context) context.Context { + s := config.NewStore(logtesting.TestLogger(t)) + s.OnConfigChanged(&corev1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: config.DefaultsConfigName, + }, + Data: map[string]string{ + "default-timeout-minutes": "5", + "default-service-account": "tekton", + }, + }) + return s.ToContext(ctx) + }, + }} + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + got := tc.in + ctx := context.Background() + if tc.wc != nil { + ctx = tc.wc(ctx) + } + got.SetDefaults(ctx) + if !cmp.Equal(got, tc.want, ignoreUnexportedResources) { + t.Errorf("SetDefaults (-want, +got) = %v", + cmp.Diff(got, tc.want, ignoreUnexportedResources)) + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_types.go b/pkg/apis/pipeline/v1alpha2/taskrun_types.go new file mode 100644 index 00000000000..f014ed2ec22 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/taskrun_types.go @@ -0,0 +1,312 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "fmt" + "time" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/apis" + duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" +) + +// Check that TaskRun may be validated and defaulted. +var _ apis.Validatable = (*TaskRun)(nil) +var _ apis.Defaultable = (*TaskRun)(nil) +var _ apis.Convertible = (*TaskRun)(nil) + +// TaskRunSpec defines the desired state of TaskRun +type TaskRunSpec struct { + // +optional + Params []Param `json:"params,omitempty"` + // +optional + Inputs TaskRunInputs `json:"inputs,omitempty"` + // +optional + Outputs TaskRunOutputs `json:"outputs,omitempty"` + // +optional + ServiceAccountName string `json:"serviceAccountName"` + // DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. + // Deprecated: Use serviceAccountName instead. + // +optional + DeprecatedServiceAccount string `json:"serviceAccount,omitempty"` + // no more than one of the TaskRef and TaskSpec may be specified. + // +optional + TaskRef *TaskRef `json:"taskRef,omitempty"` + // +optional + TaskSpec *TaskSpec `json:"taskSpec,omitempty"` + // Used for cancelling a taskrun (and maybe more later on) + // +optional + Status TaskRunSpecStatus `json:"status,omitempty"` + // Time after which the build times out. Defaults to 10 minutes. + // Specified build timeout should be less than 24h. + // Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration + // +optional + Timeout *metav1.Duration `json:"timeout,omitempty"` + + // PodTemplate holds pod specific configuration + PodTemplate PodTemplate `json:"podTemplate,omitempty"` +} + +// TaskRunSpecStatus defines the taskrun spec status the user can provide +type TaskRunSpecStatus string + +const ( + // TaskRunSpecStatusCancelled indicates that the user wants to cancel the task, + // if not already cancelled or terminated + TaskRunSpecStatusCancelled = "TaskRunCancelled" +) + +// TaskRunInputs holds the input values that this task was invoked with. +type TaskRunInputs struct { + // +optional + Resources []TaskResourceBinding `json:"resources,omitempty"` + // +optional + // Params []Param `json:"params,omitempty"` +} + +// TaskResourceBinding points to the PipelineResource that +// will be used for the Task input or output called Name. +type TaskResourceBinding struct { + PipelineResourceBinding + // Paths will probably be removed in #1284, and then PipelineResourceBinding can be used instead. + // The optional Path field corresponds to a path on disk at which the Resource can be found + // (used when providing the resource via mounted volume, overriding the default logic to fetch the Resource). + // +optional + Paths []string `json:"paths,omitempty"` +} + +// TaskRunOutputs holds the output values that this task was invoked with. +type TaskRunOutputs struct { + // +optional + Resources []TaskResourceBinding `json:"resources,omitempty"` +} + +var taskRunCondSet = apis.NewBatchConditionSet() + +// TaskRunStatus defines the observed state of TaskRun +type TaskRunStatus struct { + duckv1beta1.Status `json:",inline"` + + // PodName is the name of the pod responsible for executing this task's steps. + PodName string `json:"podName"` + + // StartTime is the time the build is actually started. + // +optional + StartTime *metav1.Time `json:"startTime,omitempty"` + + // CompletionTime is the time the build completed. + // +optional + CompletionTime *metav1.Time `json:"completionTime,omitempty"` + + // Steps describes the state of each build step container. + // +optional + Steps []StepState `json:"steps,omitempty"` + + // CloudEvents describe the state of each cloud event requested via a + // CloudEventResource. + // +optional + CloudEvents []CloudEventDelivery `json:"cloudEvents,omitempty"` + + // RetriesStatus contains the history of TaskRunStatus in case of a retry in order to keep record of failures. + // All TaskRunStatus stored in RetriesStatus will have no date within the RetriesStatus as is redundant. + // +optional + RetriesStatus []TaskRunStatus `json:"retriesStatus,omitempty"` + // Results from Resources built during the taskRun. currently includes + // the digest of build container images + // optional + ResourcesResult []PipelineResourceResult `json:"resourcesResult,omitempty"` +} + +// GetCondition returns the Condition matching the given type. +func (tr *TaskRunStatus) GetCondition(t apis.ConditionType) *apis.Condition { + return taskRunCondSet.Manage(tr).GetCondition(t) +} + +// InitializeConditions will set all conditions in taskRunCondSet to unknown for the TaskRun +// and set the started time to the current time +func (tr *TaskRunStatus) InitializeConditions() { + if tr.StartTime.IsZero() { + tr.StartTime = &metav1.Time{Time: time.Now()} + } + taskRunCondSet.Manage(tr).InitializeConditions() +} + +// SetCondition sets the condition, unsetting previous conditions with the same +// type as necessary. +func (tr *TaskRunStatus) SetCondition(newCond *apis.Condition) { + if newCond != nil { + taskRunCondSet.Manage(tr).SetCondition(*newCond) + } +} + +// StepState reports the results of running a step in the Task. +type StepState struct { + corev1.ContainerState + Name string `json:"name,omitempty"` + ContainerName string `json:"container,omitempty"` + ImageID string `json:"imageID,omitempty"` +} + +// CloudEventDelivery is the target of a cloud event along with the state of +// delivery. +type CloudEventDelivery struct { + // Target points to an addressable + Target string `json:"target,omitempty"` + Status CloudEventDeliveryState `json:"status,omitempty"` +} + +// CloudEventCondition is a string that represents the condition of the event. +type CloudEventCondition string + +const ( + // CloudEventConditionUnknown means that the condition for the event to be + // triggered was not met yet, or we don't know the state yet. + CloudEventConditionUnknown CloudEventCondition = "Unknown" + // CloudEventConditionSent means that the event was sent successfully + CloudEventConditionSent CloudEventCondition = "Sent" + // CloudEventConditionFailed means that there was one or more attempts to + // send the event, and none was successful so far. + CloudEventConditionFailed CloudEventCondition = "Failed" +) + +// CloudEventDeliveryState reports the state of a cloud event to be sent. +type CloudEventDeliveryState struct { + // Current status + Condition CloudEventCondition `json:"condition,omitempty"` + // SentAt is the time at which the last attempt to send the event was made + // +optional + SentAt *metav1.Time `json:"sentAt,omitempty"` + // Error is the text of error (if any) + Error string `json:"message"` + // RetryCount is the number of attempts of sending the cloud event + RetryCount int32 `json:"retryCount"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// TaskRun represents a single execution of a Task. TaskRuns are how the steps +// specified in a Task are executed; they specify the parameters and resources +// used to run the steps in a Task. +// +// +k8s:openapi-gen=true +type TaskRun struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // +optional + Spec TaskRunSpec `json:"spec,omitempty"` + // +optional + 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"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []TaskRun `json:"items"` +} + +// GetBuildPodRef for task +func (tr *TaskRun) GetBuildPodRef() corev1.ObjectReference { + return corev1.ObjectReference{ + APIVersion: "v1", + Kind: "Pod", + Namespace: tr.Namespace, + Name: tr.Name, + } +} + +// GetPipelineRunPVCName for taskrun gets pipelinerun +func (tr *TaskRun) GetPipelineRunPVCName() string { + if tr == nil { + return "" + } + for _, ref := range tr.GetOwnerReferences() { + if ref.Kind == pipelineRunControllerName { + return fmt.Sprintf("%s-pvc", ref.Name) + } + } + return "" +} + +// HasPipelineRunOwnerReference returns true of TaskRun has +// owner reference of type PipelineRun +func (tr *TaskRun) HasPipelineRunOwnerReference() bool { + for _, ref := range tr.GetOwnerReferences() { + if ref.Kind == pipelineRunControllerName { + return true + } + } + return false +} + +// IsDone returns true if the TaskRun's status indicates that it is done. +func (tr *TaskRun) IsDone() bool { + return !tr.Status.GetCondition(apis.ConditionSucceeded).IsUnknown() +} + +// HasStarted function check whether taskrun has valid start time set in its status +func (tr *TaskRun) HasStarted() bool { + return tr.Status.StartTime != nil && !tr.Status.StartTime.IsZero() +} + +// IsSuccessful returns true if the TaskRun's status indicates that it is done. +func (tr *TaskRun) IsSuccessful() bool { + return tr.Status.GetCondition(apis.ConditionSucceeded).IsTrue() +} + +// IsCancelled returns true if the TaskRun's spec status is set to Cancelled state +func (tr *TaskRun) IsCancelled() bool { + return tr.Spec.Status == TaskRunSpecStatusCancelled +} + +// GetRunKey return the taskrun key for timeout handler map +func (tr *TaskRun) GetRunKey() string { + // The address of the pointer is a threadsafe unique identifier for the taskrun + return fmt.Sprintf("%s/%p", "TaskRun", tr) +} + +func (tr *TaskRun) GetServiceAccountName() string { + name := tr.Spec.ServiceAccountName + if name == "" { + name = tr.Spec.DeprecatedServiceAccount + } + return name + +} + +// IsPartOfPipeline return true if TaskRun is a part of a Pipeline. +// It also return the name of Pipeline and PipelineRun +func (tr *TaskRun) IsPartOfPipeline() (bool, string, string) { + if tr == nil || len(tr.Labels) == 0 { + return false, "", "" + } + + if pl, ok := tr.Labels[pipeline.GroupName+pipeline.PipelineLabelKey]; ok { + return true, pl, tr.Labels[pipeline.GroupName+pipeline.PipelineRunLabelKey] + } + + return false, "", "" +} diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_types_test.go b/pkg/apis/pipeline/v1alpha2/taskrun_types_test.go new file mode 100644 index 00000000000..5a2b2e96e91 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/taskrun_types_test.go @@ -0,0 +1,221 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "fmt" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + tb "github.com/tektoncd/pipeline/test/builder" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/apis" +) + +func TestTaskRun_GetBuildPodRef(t *testing.T) { + tr := tb.TaskRun("taskrunname", "testns") + if d := cmp.Diff(tr.GetBuildPodRef(), corev1.ObjectReference{ + APIVersion: "v1", + Kind: "Pod", + Namespace: "testns", + Name: "taskrunname", + }); d != "" { + t.Fatalf("taskrun build pod ref mismatch: %s", d) + } +} + +func TestTaskRun_GetPipelineRunPVCName(t *testing.T) { + tests := []struct { + name string + tr *v1alpha1.TaskRun + expectedPVCName string + }{{ + name: "invalid owner reference", + tr: tb.TaskRun("taskrunname", "testns", tb.TaskRunOwnerReference("SomeOtherOwner", "testpr")), + expectedPVCName: "", + }, { + name: "valid pipelinerun owner", + tr: tb.TaskRun("taskrunname", "testns", tb.TaskRunOwnerReference("PipelineRun", "testpr")), + expectedPVCName: "testpr-pvc", + }, { + name: "nil taskrun", + expectedPVCName: "", + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if tt.tr.GetPipelineRunPVCName() != tt.expectedPVCName { + t.Fatalf("taskrun pipeline run pvc name mismatch: got %s ; expected %s", tt.tr.GetPipelineRunPVCName(), tt.expectedPVCName) + } + }) + } +} + +func TestTaskRun_HasPipelineRun(t *testing.T) { + tests := []struct { + name string + tr *v1alpha1.TaskRun + want bool + }{{ + name: "invalid owner reference", + tr: tb.TaskRun("taskrunname", "testns", tb.TaskRunOwnerReference("SomeOtherOwner", "testpr")), + want: false, + }, { + name: "valid pipelinerun owner", + tr: tb.TaskRun("taskrunname", "testns", tb.TaskRunOwnerReference("PipelineRun", "testpr")), + want: true, + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if tt.tr.HasPipelineRunOwnerReference() != tt.want { + t.Fatalf("taskrun pipeline run pvc name mismatch: got %s ; expected %t", tt.tr.GetPipelineRunPVCName(), tt.want) + } + }) + } +} + +func TestTaskRunIsDone(t *testing.T) { + tr := tb.TaskRun("", "", tb.TaskRunStatus(tb.StatusCondition( + apis.Condition{ + Type: apis.ConditionSucceeded, + Status: corev1.ConditionFalse, + }, + ))) + if !tr.IsDone() { + t.Fatal("Expected pipelinerun status to be done") + } +} + +func TestTaskRunIsCancelled(t *testing.T) { + tr := tb.TaskRun("", "", tb.TaskRunSpec( + tb.TaskRunSpecStatus(v1alpha1.TaskRunSpecStatusCancelled)), + ) + if !tr.IsCancelled() { + t.Fatal("Expected pipelinerun status to be cancelled") + } +} + +func TestTaskRunKey(t *testing.T) { + tr := tb.TaskRun("taskrunname", "") + expectedKey := fmt.Sprintf("TaskRun/%p", tr) + if tr.GetRunKey() != expectedKey { + t.Fatalf("Expected taskrun key to be %s but got %s", expectedKey, tr.GetRunKey()) + } +} + +func TestTaskRunHasStarted(t *testing.T) { + params := []struct { + name string + trStatus v1alpha1.TaskRunStatus + expectedValue bool + }{{ + name: "trWithNoStartTime", + trStatus: v1alpha1.TaskRunStatus{}, + expectedValue: false, + }, { + name: "trWithStartTime", + trStatus: v1alpha1.TaskRunStatus{ + StartTime: &metav1.Time{Time: time.Now()}, + }, + expectedValue: true, + }, { + name: "trWithZeroStartTime", + trStatus: v1alpha1.TaskRunStatus{ + StartTime: &metav1.Time{}, + }, + expectedValue: false, + }} + for _, tc := range params { + t.Run(tc.name, func(t *testing.T) { + tr := tb.TaskRun("taskrunname", "testns") + tr.Status = tc.trStatus + if tr.HasStarted() != tc.expectedValue { + t.Fatalf("Expected taskrun HasStarted() to return %t but got %t", tc.expectedValue, tr.HasStarted()) + } + }) + } +} + +func TestTaskRunGetServiceAccountName(t *testing.T) { + for _, tt := range []struct { + name string + tr *v1alpha1.TaskRun + expectedSA string + }{{ + "service account", + tb.TaskRun("name", "ns", tb.TaskRunSpec(tb.TaskRunServiceAccountName("defaultSA"))), + "defaultSA", + }, + { + "deprecated SA", + tb.TaskRun("name", "ns", tb.TaskRunSpec(tb.TaskRunDeprecatedServiceAccount("", "deprecatedSA"))), + "deprecatedSA", + }, + { + "both SA", + tb.TaskRun("name", "ns", tb.TaskRunSpec(tb.TaskRunDeprecatedServiceAccount("defaultSA", "deprecatedSA"))), + "defaultSA", + }, + } { + if e, a := tt.expectedSA, tt.tr.GetServiceAccountName(); e != a { + t.Errorf("%s: wrong service account name: got: %q want: %q", tt.name, a, e) + } + } +} + +func TestTaskRunIsOfPipelinerun(t *testing.T) { + tests := []struct { + name string + tr *v1alpha1.TaskRun + expectedValue bool + expetectedPipeline string + expetectedPipelineRun string + }{{ + name: "yes", + tr: tb.TaskRun("taskrunname", "testns", + tb.TaskRunLabel(pipeline.GroupName+pipeline.PipelineLabelKey, "pipeline"), + tb.TaskRunLabel(pipeline.GroupName+pipeline.PipelineRunLabelKey, "pipelinerun"), + ), + expectedValue: true, + expetectedPipeline: "pipeline", + expetectedPipelineRun: "pipelinerun", + }, { + name: "no", + tr: tb.TaskRun("taskrunname", "testns"), + expectedValue: false, + }} + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + value, pipeline, pipelineRun := test.tr.IsPartOfPipeline() + if value != test.expectedValue { + t.Fatalf("Expecting %v got %v", test.expectedValue, value) + } + + if pipeline != test.expetectedPipeline { + t.Fatalf("Mismatch in pipeline: got %s expected %s", pipeline, test.expetectedPipeline) + } + + if pipelineRun != test.expetectedPipelineRun { + t.Fatalf("Mismatch in pipelinerun: got %s expected %s", pipelineRun, test.expetectedPipelineRun) + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_validation.go b/pkg/apis/pipeline/v1alpha2/taskrun_validation.go new file mode 100644 index 00000000000..220f8ec3e40 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/taskrun_validation.go @@ -0,0 +1,134 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + "context" + "fmt" + "strings" + + "k8s.io/apimachinery/pkg/api/equality" + "knative.dev/pkg/apis" +) + +// Validate taskrun +func (tr *TaskRun) Validate(ctx context.Context) *apis.FieldError { + if err := validateObjectMetadata(tr.GetObjectMeta()).ViaField("metadata"); err != nil { + return err + } + return tr.Spec.Validate(ctx) +} + +// Validate taskrun spec +func (ts *TaskRunSpec) Validate(ctx context.Context) *apis.FieldError { + if equality.Semantic.DeepEqual(ts, &TaskRunSpec{}) { + return apis.ErrMissingField("spec") + } + + // can't have both taskRef and taskSpec at the same time + if (ts.TaskRef != nil && ts.TaskRef.Name != "") && ts.TaskSpec != nil { + return apis.ErrDisallowedFields("spec.taskref", "spec.taskspec") + } + + // Check that one of TaskRef and TaskSpec is present + if (ts.TaskRef == nil || (ts.TaskRef != nil && ts.TaskRef.Name == "")) && ts.TaskSpec == nil { + return apis.ErrMissingField("spec.taskref.name", "spec.taskspec") + } + + // Validate TaskSpec if it's present + if ts.TaskSpec != nil { + if err := ts.TaskSpec.Validate(ctx); err != nil { + return err + } + } + + // check for parameters + /* + if err := validateParameters(ts.Params); err != nil { + return err + } + */ + + // check for input resources + if err := ts.Inputs.Validate(ctx, "spec.Inputs"); err != nil { + return err + } + + // check for output resources + if err := ts.Outputs.Validate(ctx, "spec.Outputs"); err != nil { + return err + } + + if ts.Timeout != nil { + // timeout should be a valid duration of at least 0. + if ts.Timeout.Duration < 0 { + return apis.ErrInvalidValue(fmt.Sprintf("%s should be >= 0", ts.Timeout.Duration.String()), "spec.timeout") + } + } + + return nil +} + +func (i TaskRunInputs) Validate(ctx context.Context, path string) *apis.FieldError { + return validatePipelineResources(ctx, i.Resources, fmt.Sprintf("%s.Resources.Name", path)) + +} + +func (o TaskRunOutputs) Validate(ctx context.Context, path string) *apis.FieldError { + return validatePipelineResources(ctx, o.Resources, fmt.Sprintf("%s.Resources.Name", path)) +} + +// validatePipelineResources validates that +// 1. resource is not declared more than once +// 2. if both resource reference and resource spec is defined at the same time +// 3. at least resource ref or resource spec is defined +func validatePipelineResources(ctx context.Context, resources []TaskResourceBinding, path string) *apis.FieldError { + encountered := map[string]struct{}{} + for _, r := range resources { + // We should provide only one binding for each resource required by the Task. + name := strings.ToLower(r.Name) + if _, ok := encountered[strings.ToLower(name)]; ok { + return apis.ErrMultipleOneOf(path) + } + encountered[name] = struct{}{} + // Check that both resource ref and resource Spec are not present + if r.ResourceRef != nil && r.ResourceSpec != nil { + return apis.ErrDisallowedFields(fmt.Sprintf("%s.ResourceRef", path), fmt.Sprintf("%s.ResourceSpec", path)) + } + // Check that one of resource ref and resource Spec is present + if (r.ResourceRef == nil || r.ResourceRef.Name == "") && r.ResourceSpec == nil { + return apis.ErrMissingField(fmt.Sprintf("%s.ResourceRef", path), fmt.Sprintf("%s.ResourceSpec", path)) + } + if r.ResourceSpec != nil && r.ResourceSpec.Validate(ctx) != nil { + return r.ResourceSpec.Validate(ctx) + } + } + + return nil +} + +func validateParameters(params []Param) *apis.FieldError { + // Template must not duplicate parameter names. + seen := map[string]struct{}{} + for _, p := range params { + if _, ok := seen[strings.ToLower(p.Name)]; ok { + return apis.ErrMultipleOneOf("spec.inputs.params") + } + seen[p.Name] = struct{}{} + } + return nil +} diff --git a/pkg/apis/pipeline/v1alpha2/taskrun_validation_test.go b/pkg/apis/pipeline/v1alpha2/taskrun_validation_test.go new file mode 100644 index 00000000000..8eecf826b82 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/taskrun_validation_test.go @@ -0,0 +1,342 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "context" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/test/builder" + tb "github.com/tektoncd/pipeline/test/builder" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/apis" +) + +func TestTaskRun_Invalidate(t *testing.T) { + tests := []struct { + name string + task *v1alpha1.TaskRun + want *apis.FieldError + }{{ + name: "invalid taskspec", + task: tb.TaskRun("taskmetaname", "default"), + want: apis.ErrMissingField("spec"), + }, { + name: "invalid taskrun metadata", + task: tb.TaskRun("task.name", "default"), + want: &apis.FieldError{ + Message: "Invalid resource name: special character . must not be present", + Paths: []string{"metadata.name"}, + }, + }} + for _, ts := range tests { + t.Run(ts.name, func(t *testing.T) { + err := ts.task.Validate(context.Background()) + if d := cmp.Diff(err.Error(), ts.want.Error()); d != "" { + t.Errorf("TaskRun.Validate/%s (-want, +got) = %v", ts.name, d) + } + }) + } +} + +func TestTaskRun_Validate(t *testing.T) { + tr := tb.TaskRun("taskname", "default", tb.TaskRunSpec( + tb.TaskRunTaskRef("taskrefname"), + )) + if err := tr.Validate(context.Background()); err != nil { + t.Errorf("TaskRun.Validate() error = %v", err) + } +} + +func TestTaskRunSpec_Invalidate(t *testing.T) { + tests := []struct { + name string + spec v1alpha1.TaskRunSpec + wantErr *apis.FieldError + }{{ + name: "invalid taskspec", + spec: v1alpha1.TaskRunSpec{}, + wantErr: apis.ErrMissingField("spec"), + }, { + name: "invalid taskref name", + spec: v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{}, + }, + wantErr: apis.ErrMissingField("spec.taskref.name, spec.taskspec"), + }, { + name: "invalid taskref and taskspec together", + spec: v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{ + Name: "taskrefname", + }, + TaskSpec: &v1alpha1.TaskSpec{ + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "myimage", + }}}, + }, + }, + wantErr: apis.ErrDisallowedFields("spec.taskspec", "spec.taskref"), + }, { + name: "negative pipeline timeout", + spec: v1alpha1.TaskRunSpec{ + TaskRef: &v1alpha1.TaskRef{ + Name: "taskrefname", + }, + Timeout: &metav1.Duration{Duration: -48 * time.Hour}, + }, + wantErr: apis.ErrInvalidValue("-48h0m0s should be >= 0", "spec.timeout"), + }, { + name: "invalid taskspec", + spec: v1alpha1.TaskRunSpec{ + TaskSpec: &v1alpha1.TaskSpec{ + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "invalid-name-with-$weird-char*/%", + Image: "myimage", + }}}, + }, + }, + wantErr: &apis.FieldError{ + Message: `invalid value "invalid-name-with-$weird-char*/%"`, + Paths: []string{"taskspec.steps.name"}, + Details: "Task step name must be a valid DNS Label, For more info refer to https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + }, + }} + for _, ts := range tests { + t.Run(ts.name, func(t *testing.T) { + err := ts.spec.Validate(context.Background()) + if d := cmp.Diff(ts.wantErr.Error(), err.Error()); d != "" { + t.Errorf("TaskRunSpec.Validate/%s (-want, +got) = %v", ts.name, d) + } + }) + } +} + +func TestTaskRunSpec_Validate(t *testing.T) { + tests := []struct { + name string + spec v1alpha1.TaskRunSpec + }{{ + name: "taskspec without a taskRef", + spec: v1alpha1.TaskRunSpec{ + TaskSpec: &v1alpha1.TaskSpec{ + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "myimage", + }}}, + }, + }, + }, { + name: "no timeout", + spec: v1alpha1.TaskRunSpec{ + Timeout: &metav1.Duration{Duration: 0}, + TaskSpec: &v1alpha1.TaskSpec{ + Steps: []v1alpha1.Step{{Container: corev1.Container{ + Name: "mystep", + Image: "myimage", + }}}, + }, + }, + }} + for _, ts := range tests { + t.Run(ts.name, func(t *testing.T) { + if err := ts.spec.Validate(context.Background()); err != nil { + t.Errorf("TaskRunSpec.Validate()/%s error = %v", ts.name, err) + } + }) + } +} + +func TestInput_Validate(t *testing.T) { + i := v1alpha1.TaskRunInputs{ + Params: []v1alpha1.Param{{ + Name: "name", + Value: *builder.ArrayOrString("value"), + }}, + Resources: []v1alpha1.TaskResourceBinding{{ + PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ + ResourceRef: &v1alpha1.PipelineResourceRef{ + Name: "testresource", + }, + Name: "workspace", + }, + }}, + } + if err := i.Validate(context.Background(), "spec.inputs"); err != nil { + t.Errorf("TaskRunInputs.Validate() error = %v", err) + } +} + +func TestInput_Invalidate(t *testing.T) { + tests := []struct { + name string + inputs v1alpha1.TaskRunInputs + wantErr *apis.FieldError + }{{ + name: "duplicate task inputs", + inputs: v1alpha1.TaskRunInputs{ + Resources: []v1alpha1.TaskResourceBinding{{ + PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ + ResourceRef: &v1alpha1.PipelineResourceRef{ + Name: "testresource1", + }, + Name: "workspace", + }, + }, { + PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ + ResourceRef: &v1alpha1.PipelineResourceRef{ + Name: "testresource2", + }, + Name: "workspace", + }, + }}, + }, + wantErr: apis.ErrMultipleOneOf("spec.Inputs.Resources.Name"), + }, { + name: "invalid task input params", + inputs: v1alpha1.TaskRunInputs{ + Resources: []v1alpha1.TaskResourceBinding{{ + PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ + ResourceRef: &v1alpha1.PipelineResourceRef{ + Name: "testresource", + }, + Name: "resource", + }, + }}, + Params: []v1alpha1.Param{{ + Name: "name", + Value: *builder.ArrayOrString("value"), + }, { + Name: "name", + Value: *builder.ArrayOrString("value"), + }}, + }, + wantErr: apis.ErrMultipleOneOf("spec.inputs.params"), + }, { + name: "duplicate resource ref and resource spec", + inputs: v1alpha1.TaskRunInputs{ + Resources: []v1alpha1.TaskResourceBinding{{ + PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ + ResourceRef: &v1alpha1.PipelineResourceRef{ + Name: "testresource", + }, + ResourceSpec: &v1alpha1.PipelineResourceSpec{ + Type: v1alpha1.PipelineResourceTypeGit, + }, + Name: "resource-dup", + }, + }}, + }, + wantErr: apis.ErrDisallowedFields("spec.Inputs.Resources.Name.ResourceRef", "spec.Inputs.Resources.Name.ResourceSpec"), + }, { + name: "invalid resource spec", + inputs: v1alpha1.TaskRunInputs{ + Resources: []v1alpha1.TaskResourceBinding{{ + PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ + ResourceSpec: &v1alpha1.PipelineResourceSpec{ + Type: "non-existent", + }, + Name: "resource-inv", + }, + }}, + }, + wantErr: apis.ErrInvalidValue("spec.type", "non-existent"), + }, { + name: "no resource ref and resource spec", + inputs: v1alpha1.TaskRunInputs{ + Resources: []v1alpha1.TaskResourceBinding{{ + PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ + Name: "resource", + }, + }}, + }, + wantErr: apis.ErrMissingField("spec.Inputs.Resources.Name.ResourceRef", "spec.Inputs.Resources.Name.ResourceSpec"), + }} + for _, ts := range tests { + t.Run(ts.name, func(t *testing.T) { + err := ts.inputs.Validate(context.Background(), "spec.Inputs") + if d := cmp.Diff(err.Error(), ts.wantErr.Error()); d != "" { + t.Errorf("TaskRunInputs.Validate/%s (-want, +got) = %v", ts.name, d) + } + }) + } +} + +func TestOutput_Validate(t *testing.T) { + i := v1alpha1.TaskRunOutputs{ + Resources: []v1alpha1.TaskResourceBinding{{ + PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ + ResourceRef: &v1alpha1.PipelineResourceRef{ + Name: "testresource", + }, + Name: "someimage", + }, + }}, + } + if err := i.Validate(context.Background(), "spec.outputs"); err != nil { + t.Errorf("TaskRunOutputs.Validate() error = %v", err) + } +} +func TestOutput_Invalidate(t *testing.T) { + tests := []struct { + name string + outputs v1alpha1.TaskRunOutputs + wantErr *apis.FieldError + }{{ + name: "duplicated task outputs", + outputs: v1alpha1.TaskRunOutputs{ + Resources: []v1alpha1.TaskResourceBinding{{ + PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ + ResourceRef: &v1alpha1.PipelineResourceRef{ + Name: "testresource1", + }, + Name: "workspace", + }, + }, { + PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ + ResourceRef: &v1alpha1.PipelineResourceRef{ + Name: "testresource2", + }, + Name: "workspace", + }, + }}, + }, + wantErr: apis.ErrMultipleOneOf("spec.Outputs.Resources.Name"), + }, { + name: "no output resource with resource spec nor resource ref", + outputs: v1alpha1.TaskRunOutputs{ + Resources: []v1alpha1.TaskResourceBinding{{ + PipelineResourceBinding: v1alpha1.PipelineResourceBinding{ + Name: "workspace", + }, + }}, + }, + wantErr: apis.ErrMissingField("spec.Outputs.Resources.Name.ResourceSpec", "spec.Outputs.Resources.Name.ResourceRef"), + }} + for _, ts := range tests { + t.Run(ts.name, func(t *testing.T) { + err := ts.outputs.Validate(context.Background(), "spec.Outputs") + if d := cmp.Diff(err.Error(), ts.wantErr.Error()); d != "" { + t.Errorf("TaskRunOutputs.Validate/%s (-want, +got) = %v", ts.name, d) + } + }) + } +} diff --git a/pkg/apis/pipeline/v1alpha2/types_test.go b/pkg/apis/pipeline/v1alpha2/types_test.go new file mode 100644 index 00000000000..797ea5c6ab7 --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/types_test.go @@ -0,0 +1,33 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2_test + +import ( + "testing" + + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "knative.dev/pkg/webhook" +) + +func TestTypes(t *testing.T) { + // Assert that types satisfy webhook interface. + var _ webhook.GenericCRD = (*v1alpha1.ClusterTask)(nil) + var _ webhook.GenericCRD = (*v1alpha1.TaskRun)(nil) + var _ webhook.GenericCRD = (*v1alpha1.PipelineResource)(nil) + var _ webhook.GenericCRD = (*v1alpha1.Task)(nil) + var _ webhook.GenericCRD = (*v1alpha1.TaskRun)(nil) +} diff --git a/pkg/apis/pipeline/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1alpha2/zz_generated.deepcopy.go new file mode 100644 index 00000000000..2ce3e48a5fe --- /dev/null +++ b/pkg/apis/pipeline/v1alpha2/zz_generated.deepcopy.go @@ -0,0 +1,1903 @@ +// +build !ignore_autogenerated + +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/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 *ArrayOrString) DeepCopyInto(out *ArrayOrString) { + *out = *in + if in.ArrayVal != nil { + in, out := &in.ArrayVal, &out.ArrayVal + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArrayOrString. +func (in *ArrayOrString) DeepCopy() *ArrayOrString { + if in == nil { + return nil + } + out := new(ArrayOrString) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ArtifactBucket) DeepCopyInto(out *ArtifactBucket) { + *out = *in + if in.Secrets != nil { + in, out := &in.Secrets, &out.Secrets + *out = make([]SecretParam, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArtifactBucket. +func (in *ArtifactBucket) DeepCopy() *ArtifactBucket { + if in == nil { + return nil + } + out := new(ArtifactBucket) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ArtifactPVC) DeepCopyInto(out *ArtifactPVC) { + *out = *in + if in.PersistentVolumeClaim != nil { + in, out := &in.PersistentVolumeClaim, &out.PersistentVolumeClaim + *out = new(v1.PersistentVolumeClaim) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArtifactPVC. +func (in *ArtifactPVC) DeepCopy() *ArtifactPVC { + if in == nil { + return nil + } + out := new(ArtifactPVC) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BuildGCSResource) DeepCopyInto(out *BuildGCSResource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BuildGCSResource. +func (in *BuildGCSResource) DeepCopy() *BuildGCSResource { + if in == nil { + return nil + } + out := new(BuildGCSResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CloudEventDelivery) DeepCopyInto(out *CloudEventDelivery) { + *out = *in + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudEventDelivery. +func (in *CloudEventDelivery) DeepCopy() *CloudEventDelivery { + if in == nil { + return nil + } + out := new(CloudEventDelivery) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CloudEventDeliveryState) DeepCopyInto(out *CloudEventDeliveryState) { + *out = *in + if in.SentAt != nil { + in, out := &in.SentAt, &out.SentAt + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudEventDeliveryState. +func (in *CloudEventDeliveryState) DeepCopy() *CloudEventDeliveryState { + if in == nil { + return nil + } + out := new(CloudEventDeliveryState) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CloudEventResource) DeepCopyInto(out *CloudEventResource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudEventResource. +func (in *CloudEventResource) DeepCopy() *CloudEventResource { + if in == nil { + return nil + } + out := new(CloudEventResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterResource) DeepCopyInto(out *ClusterResource) { + *out = *in + if in.CAData != nil { + in, out := &in.CAData, &out.CAData + *out = make([]byte, len(*in)) + copy(*out, *in) + } + if in.Secrets != nil { + in, out := &in.Secrets, &out.Secrets + *out = make([]SecretParam, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResource. +func (in *ClusterResource) DeepCopy() *ClusterResource { + if in == nil { + return nil + } + out := new(ClusterResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterTask) DeepCopyInto(out *ClusterTask) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterTask. +func (in *ClusterTask) DeepCopy() *ClusterTask { + if in == nil { + return nil + } + out := new(ClusterTask) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterTask) 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 *ClusterTaskList) DeepCopyInto(out *ClusterTaskList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterTask, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterTaskList. +func (in *ClusterTaskList) DeepCopy() *ClusterTaskList { + if in == nil { + return nil + } + out := new(ClusterTaskList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterTaskList) 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 *Condition) DeepCopyInto(out *Condition) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. +func (in *Condition) DeepCopy() *Condition { + if in == nil { + return nil + } + out := new(Condition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Condition) 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 *ConditionCheck) DeepCopyInto(out *ConditionCheck) { + *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 ConditionCheck. +func (in *ConditionCheck) DeepCopy() *ConditionCheck { + if in == nil { + return nil + } + out := new(ConditionCheck) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConditionCheckStatus) DeepCopyInto(out *ConditionCheckStatus) { + *out = *in + in.Status.DeepCopyInto(&out.Status) + if in.StartTime != nil { + in, out := &in.StartTime, &out.StartTime + *out = (*in).DeepCopy() + } + if in.CompletionTime != nil { + in, out := &in.CompletionTime, &out.CompletionTime + *out = (*in).DeepCopy() + } + in.Check.DeepCopyInto(&out.Check) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConditionCheckStatus. +func (in *ConditionCheckStatus) DeepCopy() *ConditionCheckStatus { + if in == nil { + return nil + } + out := new(ConditionCheckStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConditionList) DeepCopyInto(out *ConditionList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConditionList. +func (in *ConditionList) DeepCopy() *ConditionList { + if in == nil { + return nil + } + out := new(ConditionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConditionList) 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 *ConditionSpec) DeepCopyInto(out *ConditionSpec) { + *out = *in + in.Check.DeepCopyInto(&out.Check) + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make([]ParamSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]ResourceDeclaration, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConditionSpec. +func (in *ConditionSpec) DeepCopy() *ConditionSpec { + if in == nil { + return nil + } + out := new(ConditionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DAG) DeepCopyInto(out *DAG) { + *out = *in + if in.Nodes != nil { + in, out := &in.Nodes, &out.Nodes + *out = make(map[string]*Node, len(*in)) + for key, val := range *in { + var outVal *Node + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(Node) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DAG. +func (in *DAG) DeepCopy() *DAG { + if in == nil { + return nil + } + out := new(DAG) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeprecatedPipelineRunSpecServiceAccount) DeepCopyInto(out *DeprecatedPipelineRunSpecServiceAccount) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeprecatedPipelineRunSpecServiceAccount. +func (in *DeprecatedPipelineRunSpecServiceAccount) DeepCopy() *DeprecatedPipelineRunSpecServiceAccount { + if in == nil { + return nil + } + out := new(DeprecatedPipelineRunSpecServiceAccount) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCSResource) DeepCopyInto(out *GCSResource) { + *out = *in + if in.Secrets != nil { + in, out := &in.Secrets, &out.Secrets + *out = make([]SecretParam, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCSResource. +func (in *GCSResource) DeepCopy() *GCSResource { + if in == nil { + return nil + } + out := new(GCSResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GitResource) DeepCopyInto(out *GitResource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitResource. +func (in *GitResource) DeepCopy() *GitResource { + if in == nil { + return nil + } + out := new(GitResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageResource) DeepCopyInto(out *ImageResource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageResource. +func (in *ImageResource) DeepCopy() *ImageResource { + if in == nil { + return nil + } + out := new(ImageResource) + 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.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]TaskResource, 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 *InternalTaskModifier) DeepCopyInto(out *InternalTaskModifier) { + *out = *in + if in.StepsToPrepend != nil { + in, out := &in.StepsToPrepend, &out.StepsToPrepend + *out = make([]Step, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.StepsToAppend != nil { + in, out := &in.StepsToAppend, &out.StepsToAppend + *out = make([]Step, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Volumes != nil { + in, out := &in.Volumes, &out.Volumes + *out = make([]v1.Volume, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InternalTaskModifier. +func (in *InternalTaskModifier) DeepCopy() *InternalTaskModifier { + if in == nil { + return nil + } + out := new(InternalTaskModifier) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Node) DeepCopyInto(out *Node) { + *out = *in + in.Task.DeepCopyInto(&out.Task) + if in.Prev != nil { + in, out := &in.Prev, &out.Prev + *out = make([]*Node, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Node) + (*in).DeepCopyInto(*out) + } + } + } + if in.Next != nil { + in, out := &in.Next, &out.Next + *out = make([]*Node, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Node) + (*in).DeepCopyInto(*out) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Node. +func (in *Node) DeepCopy() *Node { + if in == nil { + return nil + } + out := new(Node) + 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.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]TaskResource, 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 + in.Value.DeepCopyInto(&out.Value) + 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 *ParamSpec) DeepCopyInto(out *ParamSpec) { + *out = *in + if in.Default != nil { + in, out := &in.Default, &out.Default + *out = new(ArrayOrString) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParamSpec. +func (in *ParamSpec) DeepCopy() *ParamSpec { + if in == nil { + return nil + } + out := new(ParamSpec) + 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 *PipelineConditionResource) DeepCopyInto(out *PipelineConditionResource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineConditionResource. +func (in *PipelineConditionResource) DeepCopy() *PipelineConditionResource { + if in == nil { + return nil + } + out := new(PipelineConditionResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineDeclaredResource) DeepCopyInto(out *PipelineDeclaredResource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineDeclaredResource. +func (in *PipelineDeclaredResource) DeepCopy() *PipelineDeclaredResource { + if in == nil { + return nil + } + out := new(PipelineDeclaredResource) + in.DeepCopyInto(out) + return out +} + +// 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 *PipelineRef) DeepCopyInto(out *PipelineRef) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineRef. +func (in *PipelineRef) DeepCopy() *PipelineRef { + if in == nil { + return nil + } + out := new(PipelineRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineResource) DeepCopyInto(out *PipelineResource) { + *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 PipelineResource. +func (in *PipelineResource) DeepCopy() *PipelineResource { + if in == nil { + return nil + } + out := new(PipelineResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PipelineResource) 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 *PipelineResourceBinding) DeepCopyInto(out *PipelineResourceBinding) { + *out = *in + if in.ResourceRef != nil { + in, out := &in.ResourceRef, &out.ResourceRef + *out = new(PipelineResourceRef) + **out = **in + } + if in.ResourceSpec != nil { + in, out := &in.ResourceSpec, &out.ResourceSpec + *out = new(PipelineResourceSpec) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineResourceBinding. +func (in *PipelineResourceBinding) DeepCopy() *PipelineResourceBinding { + if in == nil { + return nil + } + out := new(PipelineResourceBinding) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineResourceList) DeepCopyInto(out *PipelineResourceList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PipelineResource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineResourceList. +func (in *PipelineResourceList) DeepCopy() *PipelineResourceList { + if in == nil { + return nil + } + out := new(PipelineResourceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PipelineResourceList) 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 *PipelineResourceRef) DeepCopyInto(out *PipelineResourceRef) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineResourceRef. +func (in *PipelineResourceRef) DeepCopy() *PipelineResourceRef { + if in == nil { + return nil + } + out := new(PipelineResourceRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineResourceResult) DeepCopyInto(out *PipelineResourceResult) { + *out = *in + out.ResourceRef = in.ResourceRef + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineResourceResult. +func (in *PipelineResourceResult) DeepCopy() *PipelineResourceResult { + if in == nil { + return nil + } + out := new(PipelineResourceResult) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineResourceSpec) DeepCopyInto(out *PipelineResourceSpec) { + *out = *in + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make([]ResourceParam, len(*in)) + copy(*out, *in) + } + if in.SecretParams != nil { + in, out := &in.SecretParams, &out.SecretParams + *out = make([]SecretParam, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineResourceSpec. +func (in *PipelineResourceSpec) DeepCopy() *PipelineResourceSpec { + if in == nil { + return nil + } + out := new(PipelineResourceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineResourceStatus) DeepCopyInto(out *PipelineResourceStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineResourceStatus. +func (in *PipelineResourceStatus) DeepCopy() *PipelineResourceStatus { + if in == nil { + return nil + } + out := new(PipelineResourceStatus) + 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) + in.Spec.DeepCopyInto(&out.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 *PipelineRunConditionCheckStatus) DeepCopyInto(out *PipelineRunConditionCheckStatus) { + *out = *in + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(ConditionCheckStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineRunConditionCheckStatus. +func (in *PipelineRunConditionCheckStatus) DeepCopy() *PipelineRunConditionCheckStatus { + if in == nil { + return nil + } + out := new(PipelineRunConditionCheckStatus) + 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 + if in.PipelineRef != nil { + in, out := &in.PipelineRef, &out.PipelineRef + *out = new(PipelineRef) + **out = **in + } + if in.PipelineSpec != nil { + in, out := &in.PipelineSpec, &out.PipelineSpec + *out = new(PipelineSpec) + (*in).DeepCopyInto(*out) + } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]PipelineResourceBinding, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make([]Param, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DeprecatedServiceAccounts != nil { + in, out := &in.DeprecatedServiceAccounts, &out.DeprecatedServiceAccounts + *out = make([]DeprecatedPipelineRunSpecServiceAccount, len(*in)) + copy(*out, *in) + } + if in.ServiceAccountNames != nil { + in, out := &in.ServiceAccountNames, &out.ServiceAccountNames + *out = make([]PipelineRunSpecServiceAccountName, len(*in)) + copy(*out, *in) + } + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(metav1.Duration) + **out = **in + } + in.PodTemplate.DeepCopyInto(&out.PodTemplate) + 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 *PipelineRunSpecServiceAccountName) DeepCopyInto(out *PipelineRunSpecServiceAccountName) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineRunSpecServiceAccountName. +func (in *PipelineRunSpecServiceAccountName) DeepCopy() *PipelineRunSpecServiceAccountName { + if in == nil { + return nil + } + out := new(PipelineRunSpecServiceAccountName) + 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 + in.Status.DeepCopyInto(&out.Status) + if in.StartTime != nil { + in, out := &in.StartTime, &out.StartTime + *out = (*in).DeepCopy() + } + if in.CompletionTime != nil { + in, out := &in.CompletionTime, &out.CompletionTime + *out = (*in).DeepCopy() + } + if in.TaskRuns != nil { + in, out := &in.TaskRuns, &out.TaskRuns + *out = make(map[string]*PipelineRunTaskRunStatus, len(*in)) + for key, val := range *in { + var outVal *PipelineRunTaskRunStatus + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(PipelineRunTaskRunStatus) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + } + 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 *PipelineRunTaskRunStatus) DeepCopyInto(out *PipelineRunTaskRunStatus) { + *out = *in + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(TaskRunStatus) + (*in).DeepCopyInto(*out) + } + if in.ConditionChecks != nil { + in, out := &in.ConditionChecks, &out.ConditionChecks + *out = make(map[string]*PipelineRunConditionCheckStatus, len(*in)) + for key, val := range *in { + var outVal *PipelineRunConditionCheckStatus + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(PipelineRunConditionCheckStatus) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineRunTaskRunStatus. +func (in *PipelineRunTaskRunStatus) DeepCopy() *PipelineRunTaskRunStatus { + if in == nil { + return nil + } + out := new(PipelineRunTaskRunStatus) + 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.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]PipelineDeclaredResource, len(*in)) + copy(*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]) + } + } + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make([]ParamSpec, 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.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]PipelineTaskCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RunAfter != nil { + in, out := &in.RunAfter, &out.RunAfter + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = new(PipelineTaskResources) + (*in).DeepCopyInto(*out) + } + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make([]Param, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + 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 *PipelineTaskCondition) DeepCopyInto(out *PipelineTaskCondition) { + *out = *in + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make([]Param, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]PipelineConditionResource, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineTaskCondition. +func (in *PipelineTaskCondition) DeepCopy() *PipelineTaskCondition { + if in == nil { + return nil + } + out := new(PipelineTaskCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineTaskInputResource) DeepCopyInto(out *PipelineTaskInputResource) { + *out = *in + if in.From != nil { + in, out := &in.From, &out.From + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineTaskInputResource. +func (in *PipelineTaskInputResource) DeepCopy() *PipelineTaskInputResource { + if in == nil { + return nil + } + out := new(PipelineTaskInputResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PipelineTaskOutputResource) DeepCopyInto(out *PipelineTaskOutputResource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineTaskOutputResource. +func (in *PipelineTaskOutputResource) DeepCopy() *PipelineTaskOutputResource { + if in == nil { + return nil + } + out := new(PipelineTaskOutputResource) + 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 *PipelineTaskResources) DeepCopyInto(out *PipelineTaskResources) { + *out = *in + if in.Inputs != nil { + in, out := &in.Inputs, &out.Inputs + *out = make([]PipelineTaskInputResource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Outputs != nil { + in, out := &in.Outputs, &out.Outputs + *out = make([]PipelineTaskOutputResource, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineTaskResources. +func (in *PipelineTaskResources) DeepCopy() *PipelineTaskResources { + if in == nil { + return nil + } + out := new(PipelineTaskResources) + 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 *PodTemplate) DeepCopyInto(out *PodTemplate) { + *out = *in + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + *out = new(v1.Affinity) + (*in).DeepCopyInto(*out) + } + if in.SecurityContext != nil { + in, out := &in.SecurityContext, &out.SecurityContext + *out = new(v1.PodSecurityContext) + (*in).DeepCopyInto(*out) + } + if in.Volumes != nil { + in, out := &in.Volumes, &out.Volumes + *out = make([]v1.Volume, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RuntimeClassName != nil { + in, out := &in.RuntimeClassName, &out.RuntimeClassName + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodTemplate. +func (in *PodTemplate) DeepCopy() *PodTemplate { + if in == nil { + return nil + } + out := new(PodTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PullRequestResource) DeepCopyInto(out *PullRequestResource) { + *out = *in + if in.Secrets != nil { + in, out := &in.Secrets, &out.Secrets + *out = make([]SecretParam, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PullRequestResource. +func (in *PullRequestResource) DeepCopy() *PullRequestResource { + if in == nil { + return nil + } + out := new(PullRequestResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceDeclaration) DeepCopyInto(out *ResourceDeclaration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceDeclaration. +func (in *ResourceDeclaration) DeepCopy() *ResourceDeclaration { + if in == nil { + return nil + } + out := new(ResourceDeclaration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceParam) DeepCopyInto(out *ResourceParam) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceParam. +func (in *ResourceParam) DeepCopy() *ResourceParam { + if in == nil { + return nil + } + out := new(ResourceParam) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecretParam) DeepCopyInto(out *SecretParam) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretParam. +func (in *SecretParam) DeepCopy() *SecretParam { + if in == nil { + return nil + } + out := new(SecretParam) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Step) DeepCopyInto(out *Step) { + *out = *in + in.Container.DeepCopyInto(&out.Container) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Step. +func (in *Step) DeepCopy() *Step { + if in == nil { + return nil + } + out := new(Step) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StepState) DeepCopyInto(out *StepState) { + *out = *in + in.ContainerState.DeepCopyInto(&out.ContainerState) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StepState. +func (in *StepState) DeepCopy() *StepState { + if in == nil { + return nil + } + out := new(StepState) + 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) + 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 *TaskResource) DeepCopyInto(out *TaskResource) { + *out = *in + out.ResourceDeclaration = in.ResourceDeclaration + 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 *TaskResourceBinding) DeepCopyInto(out *TaskResourceBinding) { + *out = *in + in.PipelineResourceBinding.DeepCopyInto(&out.PipelineResourceBinding) + if in.Paths != nil { + in, out := &in.Paths, &out.Paths + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskResourceBinding. +func (in *TaskResourceBinding) DeepCopy() *TaskResourceBinding { + if in == nil { + return nil + } + out := new(TaskResourceBinding) + 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 *TaskRunInputs) DeepCopyInto(out *TaskRunInputs) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]TaskResourceBinding, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + 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 *TaskRunOutputs) DeepCopyInto(out *TaskRunOutputs) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]TaskResourceBinding, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRunOutputs. +func (in *TaskRunOutputs) DeepCopy() *TaskRunOutputs { + if in == nil { + return nil + } + out := new(TaskRunOutputs) + 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 + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make([]Param, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.Inputs.DeepCopyInto(&out.Inputs) + in.Outputs.DeepCopyInto(&out.Outputs) + if in.TaskRef != nil { + in, out := &in.TaskRef, &out.TaskRef + *out = new(TaskRef) + **out = **in + } + if in.TaskSpec != nil { + in, out := &in.TaskSpec, &out.TaskSpec + *out = new(TaskSpec) + (*in).DeepCopyInto(*out) + } + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(metav1.Duration) + **out = **in + } + in.PodTemplate.DeepCopyInto(&out.PodTemplate) + 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 + in.Status.DeepCopyInto(&out.Status) + if in.StartTime != nil { + in, out := &in.StartTime, &out.StartTime + *out = (*in).DeepCopy() + } + if in.CompletionTime != nil { + in, out := &in.CompletionTime, &out.CompletionTime + *out = (*in).DeepCopy() + } + if in.Steps != nil { + in, out := &in.Steps, &out.Steps + *out = make([]StepState, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CloudEvents != nil { + in, out := &in.CloudEvents, &out.CloudEvents + *out = make([]CloudEventDelivery, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RetriesStatus != nil { + in, out := &in.RetriesStatus, &out.RetriesStatus + *out = make([]TaskRunStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ResourcesResult != nil { + in, out := &in.ResourcesResult, &out.ResourcesResult + *out = make([]PipelineResourceResult, 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 + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make([]ParamSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Inputs != nil { + in, out := &in.Inputs, &out.Inputs + *out = new(Inputs) + (*in).DeepCopyInto(*out) + } + if in.Outputs != nil { + in, out := &in.Outputs, &out.Outputs + *out = new(Outputs) + (*in).DeepCopyInto(*out) + } + if in.Steps != nil { + in, out := &in.Steps, &out.Steps + *out = make([]Step, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Volumes != nil { + in, out := &in.Volumes, &out.Volumes + *out = make([]v1.Volume, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.StepTemplate != nil { + in, out := &in.StepTemplate, &out.StepTemplate + *out = new(v1.Container) + (*in).DeepCopyInto(*out) + } + if in.Sidecars != nil { + in, out := &in.Sidecars, &out.Sidecars + *out = make([]v1.Container, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + 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 *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 +} diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 4f2e5dbfd8f..765826b4f4b 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -20,6 +20,7 @@ package versioned import ( tektonv1alpha1 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1" + tektonv1alpha2 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha2" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -30,6 +31,7 @@ type Interface interface { TektonV1alpha1() tektonv1alpha1.TektonV1alpha1Interface // Deprecated: please explicitly pick a version if possible. Tekton() tektonv1alpha1.TektonV1alpha1Interface + TektonV1alpha2() tektonv1alpha2.TektonV1alpha2Interface } // Clientset contains the clients for groups. Each group has exactly one @@ -37,6 +39,7 @@ type Interface interface { type Clientset struct { *discovery.DiscoveryClient tektonV1alpha1 *tektonv1alpha1.TektonV1alpha1Client + tektonV1alpha2 *tektonv1alpha2.TektonV1alpha2Client } // TektonV1alpha1 retrieves the TektonV1alpha1Client @@ -50,6 +53,11 @@ func (c *Clientset) Tekton() tektonv1alpha1.TektonV1alpha1Interface { return c.tektonV1alpha1 } +// TektonV1alpha2 retrieves the TektonV1alpha2Client +func (c *Clientset) TektonV1alpha2() tektonv1alpha2.TektonV1alpha2Interface { + return c.tektonV1alpha2 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -70,6 +78,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.tektonV1alpha2, err = tektonv1alpha2.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) if err != nil { @@ -83,6 +95,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset cs.tektonV1alpha1 = tektonv1alpha1.NewForConfigOrDie(c) + cs.tektonV1alpha2 = tektonv1alpha2.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -92,6 +105,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.tektonV1alpha1 = tektonv1alpha1.New(c) + cs.tektonV1alpha2 = tektonv1alpha2.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 44ca723571a..ab49c4ecc5c 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -22,6 +22,8 @@ import ( clientset "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" tektonv1alpha1 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1" faketektonv1alpha1 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha1/fake" + tektonv1alpha2 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha2" + faketektonv1alpha2 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -80,3 +82,8 @@ func (c *Clientset) TektonV1alpha1() tektonv1alpha1.TektonV1alpha1Interface { func (c *Clientset) Tekton() tektonv1alpha1.TektonV1alpha1Interface { return &faketektonv1alpha1.FakeTektonV1alpha1{Fake: &c.Fake} } + +// TektonV1alpha2 retrieves the TektonV1alpha2Client +func (c *Clientset) TektonV1alpha2() tektonv1alpha2.TektonV1alpha2Interface { + return &faketektonv1alpha2.FakeTektonV1alpha2{Fake: &c.Fake} +} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index ee42d3210db..e3ab1e2e306 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -20,6 +20,7 @@ package fake import ( tektonv1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + tektonv1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,6 +33,7 @@ var codecs = serializer.NewCodecFactory(scheme) var parameterCodec = runtime.NewParameterCodec(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ tektonv1alpha1.AddToScheme, + tektonv1alpha2.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index b59db5f189a..591f92bb2fa 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -20,6 +20,7 @@ package scheme import ( tektonv1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + tektonv1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,6 +33,7 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ tektonv1alpha1.AddToScheme, + tektonv1alpha2.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/clustertask.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/clustertask.go new file mode 100644 index 00000000000..7b04cd7e03a --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/clustertask.go @@ -0,0 +1,147 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + scheme "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ClusterTasksGetter has a method to return a ClusterTaskInterface. +// A group's client should implement this interface. +type ClusterTasksGetter interface { + ClusterTasks() ClusterTaskInterface +} + +// ClusterTaskInterface has methods to work with ClusterTask resources. +type ClusterTaskInterface interface { + Create(*v1alpha2.ClusterTask) (*v1alpha2.ClusterTask, error) + Update(*v1alpha2.ClusterTask) (*v1alpha2.ClusterTask, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha2.ClusterTask, error) + List(opts v1.ListOptions) (*v1alpha2.ClusterTaskList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.ClusterTask, err error) + ClusterTaskExpansion +} + +// clusterTasks implements ClusterTaskInterface +type clusterTasks struct { + client rest.Interface +} + +// newClusterTasks returns a ClusterTasks +func newClusterTasks(c *TektonV1alpha2Client) *clusterTasks { + return &clusterTasks{ + client: c.RESTClient(), + } +} + +// Get takes name of the clusterTask, and returns the corresponding clusterTask object, and an error if there is any. +func (c *clusterTasks) Get(name string, options v1.GetOptions) (result *v1alpha2.ClusterTask, err error) { + result = &v1alpha2.ClusterTask{} + err = c.client.Get(). + Resource("clustertasks"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterTasks that match those selectors. +func (c *clusterTasks) List(opts v1.ListOptions) (result *v1alpha2.ClusterTaskList, err error) { + result = &v1alpha2.ClusterTaskList{} + err = c.client.Get(). + Resource("clustertasks"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterTasks. +func (c *clusterTasks) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("clustertasks"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a clusterTask and creates it. Returns the server's representation of the clusterTask, and an error, if there is any. +func (c *clusterTasks) Create(clusterTask *v1alpha2.ClusterTask) (result *v1alpha2.ClusterTask, err error) { + result = &v1alpha2.ClusterTask{} + err = c.client.Post(). + Resource("clustertasks"). + Body(clusterTask). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterTask and updates it. Returns the server's representation of the clusterTask, and an error, if there is any. +func (c *clusterTasks) Update(clusterTask *v1alpha2.ClusterTask) (result *v1alpha2.ClusterTask, err error) { + result = &v1alpha2.ClusterTask{} + err = c.client.Put(). + Resource("clustertasks"). + Name(clusterTask.Name). + Body(clusterTask). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterTask and deletes it. Returns an error if one occurs. +func (c *clusterTasks) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clustertasks"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterTasks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Resource("clustertasks"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched clusterTask. +func (c *clusterTasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.ClusterTask, err error) { + result = &v1alpha2.ClusterTask{} + err = c.client.Patch(pt). + Resource("clustertasks"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/condition.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/condition.go new file mode 100644 index 00000000000..8b14cc7db41 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/condition.go @@ -0,0 +1,157 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + scheme "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ConditionsGetter has a method to return a ConditionInterface. +// A group's client should implement this interface. +type ConditionsGetter interface { + Conditions(namespace string) ConditionInterface +} + +// ConditionInterface has methods to work with Condition resources. +type ConditionInterface interface { + Create(*v1alpha2.Condition) (*v1alpha2.Condition, error) + Update(*v1alpha2.Condition) (*v1alpha2.Condition, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha2.Condition, error) + List(opts v1.ListOptions) (*v1alpha2.ConditionList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Condition, err error) + ConditionExpansion +} + +// conditions implements ConditionInterface +type conditions struct { + client rest.Interface + ns string +} + +// newConditions returns a Conditions +func newConditions(c *TektonV1alpha2Client, namespace string) *conditions { + return &conditions{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the condition, and returns the corresponding condition object, and an error if there is any. +func (c *conditions) Get(name string, options v1.GetOptions) (result *v1alpha2.Condition, err error) { + result = &v1alpha2.Condition{} + err = c.client.Get(). + Namespace(c.ns). + Resource("conditions"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Conditions that match those selectors. +func (c *conditions) List(opts v1.ListOptions) (result *v1alpha2.ConditionList, err error) { + result = &v1alpha2.ConditionList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("conditions"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested conditions. +func (c *conditions) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("conditions"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a condition and creates it. Returns the server's representation of the condition, and an error, if there is any. +func (c *conditions) Create(condition *v1alpha2.Condition) (result *v1alpha2.Condition, err error) { + result = &v1alpha2.Condition{} + err = c.client.Post(). + Namespace(c.ns). + Resource("conditions"). + Body(condition). + Do(). + Into(result) + return +} + +// Update takes the representation of a condition and updates it. Returns the server's representation of the condition, and an error, if there is any. +func (c *conditions) Update(condition *v1alpha2.Condition) (result *v1alpha2.Condition, err error) { + result = &v1alpha2.Condition{} + err = c.client.Put(). + Namespace(c.ns). + Resource("conditions"). + Name(condition.Name). + Body(condition). + Do(). + Into(result) + return +} + +// Delete takes name of the condition and deletes it. Returns an error if one occurs. +func (c *conditions) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("conditions"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *conditions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("conditions"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched condition. +func (c *conditions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Condition, err error) { + result = &v1alpha2.Condition{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("conditions"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/doc.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/doc.go new file mode 100644 index 00000000000..1df2d63e633 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha2 diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/doc.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/doc.go new file mode 100644 index 00000000000..1ae476cf916 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_clustertask.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_clustertask.go new file mode 100644 index 00000000000..b42d65b0773 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_clustertask.go @@ -0,0 +1,120 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeClusterTasks implements ClusterTaskInterface +type FakeClusterTasks struct { + Fake *FakeTektonV1alpha2 +} + +var clustertasksResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1alpha2", Resource: "clustertasks"} + +var clustertasksKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha2", Kind: "ClusterTask"} + +// Get takes name of the clusterTask, and returns the corresponding clusterTask object, and an error if there is any. +func (c *FakeClusterTasks) Get(name string, options v1.GetOptions) (result *v1alpha2.ClusterTask, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clustertasksResource, name), &v1alpha2.ClusterTask{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.ClusterTask), err +} + +// List takes label and field selectors, and returns the list of ClusterTasks that match those selectors. +func (c *FakeClusterTasks) List(opts v1.ListOptions) (result *v1alpha2.ClusterTaskList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clustertasksResource, clustertasksKind, opts), &v1alpha2.ClusterTaskList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.ClusterTaskList{ListMeta: obj.(*v1alpha2.ClusterTaskList).ListMeta} + for _, item := range obj.(*v1alpha2.ClusterTaskList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterTasks. +func (c *FakeClusterTasks) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clustertasksResource, opts)) +} + +// Create takes the representation of a clusterTask and creates it. Returns the server's representation of the clusterTask, and an error, if there is any. +func (c *FakeClusterTasks) Create(clusterTask *v1alpha2.ClusterTask) (result *v1alpha2.ClusterTask, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clustertasksResource, clusterTask), &v1alpha2.ClusterTask{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.ClusterTask), err +} + +// Update takes the representation of a clusterTask and updates it. Returns the server's representation of the clusterTask, and an error, if there is any. +func (c *FakeClusterTasks) Update(clusterTask *v1alpha2.ClusterTask) (result *v1alpha2.ClusterTask, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clustertasksResource, clusterTask), &v1alpha2.ClusterTask{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.ClusterTask), err +} + +// Delete takes name of the clusterTask and deletes it. Returns an error if one occurs. +func (c *FakeClusterTasks) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(clustertasksResource, name), &v1alpha2.ClusterTask{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterTasks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clustertasksResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha2.ClusterTaskList{}) + return err +} + +// Patch applies the patch and returns the patched clusterTask. +func (c *FakeClusterTasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.ClusterTask, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clustertasksResource, name, data, subresources...), &v1alpha2.ClusterTask{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.ClusterTask), err +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_condition.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_condition.go new file mode 100644 index 00000000000..efd0507df32 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_condition.go @@ -0,0 +1,128 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeConditions implements ConditionInterface +type FakeConditions struct { + Fake *FakeTektonV1alpha2 + ns string +} + +var conditionsResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1alpha2", Resource: "conditions"} + +var conditionsKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha2", Kind: "Condition"} + +// Get takes name of the condition, and returns the corresponding condition object, and an error if there is any. +func (c *FakeConditions) Get(name string, options v1.GetOptions) (result *v1alpha2.Condition, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(conditionsResource, c.ns, name), &v1alpha2.Condition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Condition), err +} + +// List takes label and field selectors, and returns the list of Conditions that match those selectors. +func (c *FakeConditions) List(opts v1.ListOptions) (result *v1alpha2.ConditionList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(conditionsResource, conditionsKind, c.ns, opts), &v1alpha2.ConditionList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.ConditionList{ListMeta: obj.(*v1alpha2.ConditionList).ListMeta} + for _, item := range obj.(*v1alpha2.ConditionList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested conditions. +func (c *FakeConditions) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(conditionsResource, c.ns, opts)) + +} + +// Create takes the representation of a condition and creates it. Returns the server's representation of the condition, and an error, if there is any. +func (c *FakeConditions) Create(condition *v1alpha2.Condition) (result *v1alpha2.Condition, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(conditionsResource, c.ns, condition), &v1alpha2.Condition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Condition), err +} + +// Update takes the representation of a condition and updates it. Returns the server's representation of the condition, and an error, if there is any. +func (c *FakeConditions) Update(condition *v1alpha2.Condition) (result *v1alpha2.Condition, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(conditionsResource, c.ns, condition), &v1alpha2.Condition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Condition), err +} + +// Delete takes name of the condition and deletes it. Returns an error if one occurs. +func (c *FakeConditions) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(conditionsResource, c.ns, name), &v1alpha2.Condition{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeConditions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(conditionsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha2.ConditionList{}) + return err +} + +// Patch applies the patch and returns the patched condition. +func (c *FakeConditions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Condition, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(conditionsResource, c.ns, name, data, subresources...), &v1alpha2.Condition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Condition), err +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipeline.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipeline.go new file mode 100644 index 00000000000..4910eeab500 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipeline.go @@ -0,0 +1,140 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePipelines implements PipelineInterface +type FakePipelines struct { + Fake *FakeTektonV1alpha2 + ns string +} + +var pipelinesResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1alpha2", Resource: "pipelines"} + +var pipelinesKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha2", Kind: "Pipeline"} + +// Get takes name of the pipeline, and returns the corresponding pipeline object, and an error if there is any. +func (c *FakePipelines) Get(name string, options v1.GetOptions) (result *v1alpha2.Pipeline, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(pipelinesResource, c.ns, name), &v1alpha2.Pipeline{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Pipeline), err +} + +// List takes label and field selectors, and returns the list of Pipelines that match those selectors. +func (c *FakePipelines) List(opts v1.ListOptions) (result *v1alpha2.PipelineList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(pipelinesResource, pipelinesKind, c.ns, opts), &v1alpha2.PipelineList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.PipelineList{ListMeta: obj.(*v1alpha2.PipelineList).ListMeta} + for _, item := range obj.(*v1alpha2.PipelineList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested pipelines. +func (c *FakePipelines) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(pipelinesResource, c.ns, opts)) + +} + +// Create takes the representation of a pipeline and creates it. Returns the server's representation of the pipeline, and an error, if there is any. +func (c *FakePipelines) Create(pipeline *v1alpha2.Pipeline) (result *v1alpha2.Pipeline, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(pipelinesResource, c.ns, pipeline), &v1alpha2.Pipeline{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Pipeline), err +} + +// Update takes the representation of a pipeline and updates it. Returns the server's representation of the pipeline, and an error, if there is any. +func (c *FakePipelines) Update(pipeline *v1alpha2.Pipeline) (result *v1alpha2.Pipeline, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(pipelinesResource, c.ns, pipeline), &v1alpha2.Pipeline{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Pipeline), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakePipelines) UpdateStatus(pipeline *v1alpha2.Pipeline) (*v1alpha2.Pipeline, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(pipelinesResource, "status", c.ns, pipeline), &v1alpha2.Pipeline{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Pipeline), err +} + +// Delete takes name of the pipeline and deletes it. Returns an error if one occurs. +func (c *FakePipelines) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(pipelinesResource, c.ns, name), &v1alpha2.Pipeline{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePipelines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(pipelinesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha2.PipelineList{}) + return err +} + +// Patch applies the patch and returns the patched pipeline. +func (c *FakePipelines) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Pipeline, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(pipelinesResource, c.ns, name, data, subresources...), &v1alpha2.Pipeline{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Pipeline), err +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipeline_client.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipeline_client.go new file mode 100644 index 00000000000..eb388584d10 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipeline_client.go @@ -0,0 +1,64 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1alpha2" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeTektonV1alpha2 struct { + *testing.Fake +} + +func (c *FakeTektonV1alpha2) ClusterTasks() v1alpha2.ClusterTaskInterface { + return &FakeClusterTasks{c} +} + +func (c *FakeTektonV1alpha2) Conditions(namespace string) v1alpha2.ConditionInterface { + return &FakeConditions{c, namespace} +} + +func (c *FakeTektonV1alpha2) Pipelines(namespace string) v1alpha2.PipelineInterface { + return &FakePipelines{c, namespace} +} + +func (c *FakeTektonV1alpha2) PipelineResources(namespace string) v1alpha2.PipelineResourceInterface { + return &FakePipelineResources{c, namespace} +} + +func (c *FakeTektonV1alpha2) PipelineRuns(namespace string) v1alpha2.PipelineRunInterface { + return &FakePipelineRuns{c, namespace} +} + +func (c *FakeTektonV1alpha2) Tasks(namespace string) v1alpha2.TaskInterface { + return &FakeTasks{c, namespace} +} + +func (c *FakeTektonV1alpha2) TaskRuns(namespace string) v1alpha2.TaskRunInterface { + return &FakeTaskRuns{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeTektonV1alpha2) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipelineresource.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipelineresource.go new file mode 100644 index 00000000000..79157eea008 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipelineresource.go @@ -0,0 +1,140 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePipelineResources implements PipelineResourceInterface +type FakePipelineResources struct { + Fake *FakeTektonV1alpha2 + ns string +} + +var pipelineresourcesResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1alpha2", Resource: "pipelineresources"} + +var pipelineresourcesKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha2", Kind: "PipelineResource"} + +// Get takes name of the pipelineResource, and returns the corresponding pipelineResource object, and an error if there is any. +func (c *FakePipelineResources) Get(name string, options v1.GetOptions) (result *v1alpha2.PipelineResource, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(pipelineresourcesResource, c.ns, name), &v1alpha2.PipelineResource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.PipelineResource), err +} + +// List takes label and field selectors, and returns the list of PipelineResources that match those selectors. +func (c *FakePipelineResources) List(opts v1.ListOptions) (result *v1alpha2.PipelineResourceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(pipelineresourcesResource, pipelineresourcesKind, c.ns, opts), &v1alpha2.PipelineResourceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.PipelineResourceList{ListMeta: obj.(*v1alpha2.PipelineResourceList).ListMeta} + for _, item := range obj.(*v1alpha2.PipelineResourceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested pipelineResources. +func (c *FakePipelineResources) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(pipelineresourcesResource, c.ns, opts)) + +} + +// Create takes the representation of a pipelineResource and creates it. Returns the server's representation of the pipelineResource, and an error, if there is any. +func (c *FakePipelineResources) Create(pipelineResource *v1alpha2.PipelineResource) (result *v1alpha2.PipelineResource, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(pipelineresourcesResource, c.ns, pipelineResource), &v1alpha2.PipelineResource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.PipelineResource), err +} + +// Update takes the representation of a pipelineResource and updates it. Returns the server's representation of the pipelineResource, and an error, if there is any. +func (c *FakePipelineResources) Update(pipelineResource *v1alpha2.PipelineResource) (result *v1alpha2.PipelineResource, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(pipelineresourcesResource, c.ns, pipelineResource), &v1alpha2.PipelineResource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.PipelineResource), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakePipelineResources) UpdateStatus(pipelineResource *v1alpha2.PipelineResource) (*v1alpha2.PipelineResource, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(pipelineresourcesResource, "status", c.ns, pipelineResource), &v1alpha2.PipelineResource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.PipelineResource), err +} + +// Delete takes name of the pipelineResource and deletes it. Returns an error if one occurs. +func (c *FakePipelineResources) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(pipelineresourcesResource, c.ns, name), &v1alpha2.PipelineResource{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePipelineResources) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(pipelineresourcesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha2.PipelineResourceList{}) + return err +} + +// Patch applies the patch and returns the patched pipelineResource. +func (c *FakePipelineResources) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.PipelineResource, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(pipelineresourcesResource, c.ns, name, data, subresources...), &v1alpha2.PipelineResource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.PipelineResource), err +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipelinerun.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipelinerun.go new file mode 100644 index 00000000000..c6be7f35b14 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_pipelinerun.go @@ -0,0 +1,140 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePipelineRuns implements PipelineRunInterface +type FakePipelineRuns struct { + Fake *FakeTektonV1alpha2 + ns string +} + +var pipelinerunsResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1alpha2", Resource: "pipelineruns"} + +var pipelinerunsKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha2", Kind: "PipelineRun"} + +// Get takes name of the pipelineRun, and returns the corresponding pipelineRun object, and an error if there is any. +func (c *FakePipelineRuns) Get(name string, options v1.GetOptions) (result *v1alpha2.PipelineRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(pipelinerunsResource, c.ns, name), &v1alpha2.PipelineRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.PipelineRun), err +} + +// List takes label and field selectors, and returns the list of PipelineRuns that match those selectors. +func (c *FakePipelineRuns) List(opts v1.ListOptions) (result *v1alpha2.PipelineRunList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(pipelinerunsResource, pipelinerunsKind, c.ns, opts), &v1alpha2.PipelineRunList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.PipelineRunList{ListMeta: obj.(*v1alpha2.PipelineRunList).ListMeta} + for _, item := range obj.(*v1alpha2.PipelineRunList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested pipelineRuns. +func (c *FakePipelineRuns) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(pipelinerunsResource, c.ns, opts)) + +} + +// Create takes the representation of a pipelineRun and creates it. Returns the server's representation of the pipelineRun, and an error, if there is any. +func (c *FakePipelineRuns) Create(pipelineRun *v1alpha2.PipelineRun) (result *v1alpha2.PipelineRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(pipelinerunsResource, c.ns, pipelineRun), &v1alpha2.PipelineRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.PipelineRun), err +} + +// Update takes the representation of a pipelineRun and updates it. Returns the server's representation of the pipelineRun, and an error, if there is any. +func (c *FakePipelineRuns) Update(pipelineRun *v1alpha2.PipelineRun) (result *v1alpha2.PipelineRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(pipelinerunsResource, c.ns, pipelineRun), &v1alpha2.PipelineRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.PipelineRun), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakePipelineRuns) UpdateStatus(pipelineRun *v1alpha2.PipelineRun) (*v1alpha2.PipelineRun, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(pipelinerunsResource, "status", c.ns, pipelineRun), &v1alpha2.PipelineRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.PipelineRun), err +} + +// Delete takes name of the pipelineRun and deletes it. Returns an error if one occurs. +func (c *FakePipelineRuns) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(pipelinerunsResource, c.ns, name), &v1alpha2.PipelineRun{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePipelineRuns) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(pipelinerunsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha2.PipelineRunList{}) + return err +} + +// Patch applies the patch and returns the patched pipelineRun. +func (c *FakePipelineRuns) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.PipelineRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(pipelinerunsResource, c.ns, name, data, subresources...), &v1alpha2.PipelineRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.PipelineRun), err +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_task.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_task.go new file mode 100644 index 00000000000..0edb21c42db --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_task.go @@ -0,0 +1,128 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeTasks implements TaskInterface +type FakeTasks struct { + Fake *FakeTektonV1alpha2 + ns string +} + +var tasksResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1alpha2", Resource: "tasks"} + +var tasksKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha2", Kind: "Task"} + +// Get takes name of the task, and returns the corresponding task object, and an error if there is any. +func (c *FakeTasks) Get(name string, options v1.GetOptions) (result *v1alpha2.Task, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(tasksResource, c.ns, name), &v1alpha2.Task{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Task), err +} + +// List takes label and field selectors, and returns the list of Tasks that match those selectors. +func (c *FakeTasks) List(opts v1.ListOptions) (result *v1alpha2.TaskList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(tasksResource, tasksKind, c.ns, opts), &v1alpha2.TaskList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.TaskList{ListMeta: obj.(*v1alpha2.TaskList).ListMeta} + for _, item := range obj.(*v1alpha2.TaskList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested tasks. +func (c *FakeTasks) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(tasksResource, c.ns, opts)) + +} + +// Create takes the representation of a task and creates it. Returns the server's representation of the task, and an error, if there is any. +func (c *FakeTasks) Create(task *v1alpha2.Task) (result *v1alpha2.Task, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(tasksResource, c.ns, task), &v1alpha2.Task{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Task), err +} + +// Update takes the representation of a task and updates it. Returns the server's representation of the task, and an error, if there is any. +func (c *FakeTasks) Update(task *v1alpha2.Task) (result *v1alpha2.Task, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(tasksResource, c.ns, task), &v1alpha2.Task{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Task), err +} + +// Delete takes name of the task and deletes it. Returns an error if one occurs. +func (c *FakeTasks) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(tasksResource, c.ns, name), &v1alpha2.Task{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeTasks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(tasksResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha2.TaskList{}) + return err +} + +// Patch applies the patch and returns the patched task. +func (c *FakeTasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Task, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(tasksResource, c.ns, name, data, subresources...), &v1alpha2.Task{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Task), err +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_taskrun.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_taskrun.go new file mode 100644 index 00000000000..bed87a061ad --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/fake/fake_taskrun.go @@ -0,0 +1,140 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeTaskRuns implements TaskRunInterface +type FakeTaskRuns struct { + Fake *FakeTektonV1alpha2 + ns string +} + +var taskrunsResource = schema.GroupVersionResource{Group: "tekton.dev", Version: "v1alpha2", Resource: "taskruns"} + +var taskrunsKind = schema.GroupVersionKind{Group: "tekton.dev", Version: "v1alpha2", Kind: "TaskRun"} + +// Get takes name of the taskRun, and returns the corresponding taskRun object, and an error if there is any. +func (c *FakeTaskRuns) Get(name string, options v1.GetOptions) (result *v1alpha2.TaskRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(taskrunsResource, c.ns, name), &v1alpha2.TaskRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.TaskRun), err +} + +// List takes label and field selectors, and returns the list of TaskRuns that match those selectors. +func (c *FakeTaskRuns) List(opts v1.ListOptions) (result *v1alpha2.TaskRunList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(taskrunsResource, taskrunsKind, c.ns, opts), &v1alpha2.TaskRunList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.TaskRunList{ListMeta: obj.(*v1alpha2.TaskRunList).ListMeta} + for _, item := range obj.(*v1alpha2.TaskRunList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested taskRuns. +func (c *FakeTaskRuns) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(taskrunsResource, c.ns, opts)) + +} + +// Create takes the representation of a taskRun and creates it. Returns the server's representation of the taskRun, and an error, if there is any. +func (c *FakeTaskRuns) Create(taskRun *v1alpha2.TaskRun) (result *v1alpha2.TaskRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(taskrunsResource, c.ns, taskRun), &v1alpha2.TaskRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.TaskRun), err +} + +// Update takes the representation of a taskRun and updates it. Returns the server's representation of the taskRun, and an error, if there is any. +func (c *FakeTaskRuns) Update(taskRun *v1alpha2.TaskRun) (result *v1alpha2.TaskRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(taskrunsResource, c.ns, taskRun), &v1alpha2.TaskRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.TaskRun), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeTaskRuns) UpdateStatus(taskRun *v1alpha2.TaskRun) (*v1alpha2.TaskRun, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(taskrunsResource, "status", c.ns, taskRun), &v1alpha2.TaskRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.TaskRun), err +} + +// Delete takes name of the taskRun and deletes it. Returns an error if one occurs. +func (c *FakeTaskRuns) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(taskrunsResource, c.ns, name), &v1alpha2.TaskRun{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeTaskRuns) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(taskrunsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha2.TaskRunList{}) + return err +} + +// Patch applies the patch and returns the patched taskRun. +func (c *FakeTaskRuns) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.TaskRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(taskrunsResource, c.ns, name, data, subresources...), &v1alpha2.TaskRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.TaskRun), err +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/generated_expansion.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/generated_expansion.go new file mode 100644 index 00000000000..ae24bf4a74b --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/generated_expansion.go @@ -0,0 +1,33 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +type ClusterTaskExpansion interface{} + +type ConditionExpansion interface{} + +type PipelineExpansion interface{} + +type PipelineResourceExpansion interface{} + +type PipelineRunExpansion interface{} + +type TaskExpansion interface{} + +type TaskRunExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipeline.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipeline.go new file mode 100644 index 00000000000..42241ae29cf --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipeline.go @@ -0,0 +1,174 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + scheme "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PipelinesGetter has a method to return a PipelineInterface. +// A group's client should implement this interface. +type PipelinesGetter interface { + Pipelines(namespace string) PipelineInterface +} + +// PipelineInterface has methods to work with Pipeline resources. +type PipelineInterface interface { + Create(*v1alpha2.Pipeline) (*v1alpha2.Pipeline, error) + Update(*v1alpha2.Pipeline) (*v1alpha2.Pipeline, error) + UpdateStatus(*v1alpha2.Pipeline) (*v1alpha2.Pipeline, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha2.Pipeline, error) + List(opts v1.ListOptions) (*v1alpha2.PipelineList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Pipeline, err error) + PipelineExpansion +} + +// pipelines implements PipelineInterface +type pipelines struct { + client rest.Interface + ns string +} + +// newPipelines returns a Pipelines +func newPipelines(c *TektonV1alpha2Client, namespace string) *pipelines { + return &pipelines{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the pipeline, and returns the corresponding pipeline object, and an error if there is any. +func (c *pipelines) Get(name string, options v1.GetOptions) (result *v1alpha2.Pipeline, err error) { + result = &v1alpha2.Pipeline{} + err = c.client.Get(). + Namespace(c.ns). + Resource("pipelines"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Pipelines that match those selectors. +func (c *pipelines) List(opts v1.ListOptions) (result *v1alpha2.PipelineList, err error) { + result = &v1alpha2.PipelineList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("pipelines"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested pipelines. +func (c *pipelines) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("pipelines"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a pipeline and creates it. Returns the server's representation of the pipeline, and an error, if there is any. +func (c *pipelines) Create(pipeline *v1alpha2.Pipeline) (result *v1alpha2.Pipeline, err error) { + result = &v1alpha2.Pipeline{} + err = c.client.Post(). + Namespace(c.ns). + Resource("pipelines"). + Body(pipeline). + Do(). + Into(result) + return +} + +// Update takes the representation of a pipeline and updates it. Returns the server's representation of the pipeline, and an error, if there is any. +func (c *pipelines) Update(pipeline *v1alpha2.Pipeline) (result *v1alpha2.Pipeline, err error) { + result = &v1alpha2.Pipeline{} + err = c.client.Put(). + Namespace(c.ns). + Resource("pipelines"). + Name(pipeline.Name). + Body(pipeline). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *pipelines) UpdateStatus(pipeline *v1alpha2.Pipeline) (result *v1alpha2.Pipeline, err error) { + result = &v1alpha2.Pipeline{} + err = c.client.Put(). + Namespace(c.ns). + Resource("pipelines"). + Name(pipeline.Name). + SubResource("status"). + Body(pipeline). + Do(). + Into(result) + return +} + +// Delete takes name of the pipeline and deletes it. Returns an error if one occurs. +func (c *pipelines) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("pipelines"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *pipelines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("pipelines"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched pipeline. +func (c *pipelines) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Pipeline, err error) { + result = &v1alpha2.Pipeline{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("pipelines"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipeline_client.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipeline_client.go new file mode 100644 index 00000000000..e697b03d1c3 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipeline_client.go @@ -0,0 +1,120 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type TektonV1alpha2Interface interface { + RESTClient() rest.Interface + ClusterTasksGetter + ConditionsGetter + PipelinesGetter + PipelineResourcesGetter + PipelineRunsGetter + TasksGetter + TaskRunsGetter +} + +// TektonV1alpha2Client is used to interact with features provided by the tekton.dev group. +type TektonV1alpha2Client struct { + restClient rest.Interface +} + +func (c *TektonV1alpha2Client) ClusterTasks() ClusterTaskInterface { + return newClusterTasks(c) +} + +func (c *TektonV1alpha2Client) Conditions(namespace string) ConditionInterface { + return newConditions(c, namespace) +} + +func (c *TektonV1alpha2Client) Pipelines(namespace string) PipelineInterface { + return newPipelines(c, namespace) +} + +func (c *TektonV1alpha2Client) PipelineResources(namespace string) PipelineResourceInterface { + return newPipelineResources(c, namespace) +} + +func (c *TektonV1alpha2Client) PipelineRuns(namespace string) PipelineRunInterface { + return newPipelineRuns(c, namespace) +} + +func (c *TektonV1alpha2Client) Tasks(namespace string) TaskInterface { + return newTasks(c, namespace) +} + +func (c *TektonV1alpha2Client) TaskRuns(namespace string) TaskRunInterface { + return newTaskRuns(c, namespace) +} + +// NewForConfig creates a new TektonV1alpha2Client for the given config. +func NewForConfig(c *rest.Config) (*TektonV1alpha2Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &TektonV1alpha2Client{client}, nil +} + +// NewForConfigOrDie creates a new TektonV1alpha2Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *TektonV1alpha2Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new TektonV1alpha2Client for the given RESTClient. +func New(c rest.Interface) *TektonV1alpha2Client { + return &TektonV1alpha2Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha2.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *TektonV1alpha2Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipelineresource.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipelineresource.go new file mode 100644 index 00000000000..a8eccb19f3e --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipelineresource.go @@ -0,0 +1,174 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + scheme "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PipelineResourcesGetter has a method to return a PipelineResourceInterface. +// A group's client should implement this interface. +type PipelineResourcesGetter interface { + PipelineResources(namespace string) PipelineResourceInterface +} + +// PipelineResourceInterface has methods to work with PipelineResource resources. +type PipelineResourceInterface interface { + Create(*v1alpha2.PipelineResource) (*v1alpha2.PipelineResource, error) + Update(*v1alpha2.PipelineResource) (*v1alpha2.PipelineResource, error) + UpdateStatus(*v1alpha2.PipelineResource) (*v1alpha2.PipelineResource, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha2.PipelineResource, error) + List(opts v1.ListOptions) (*v1alpha2.PipelineResourceList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.PipelineResource, err error) + PipelineResourceExpansion +} + +// pipelineResources implements PipelineResourceInterface +type pipelineResources struct { + client rest.Interface + ns string +} + +// newPipelineResources returns a PipelineResources +func newPipelineResources(c *TektonV1alpha2Client, namespace string) *pipelineResources { + return &pipelineResources{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the pipelineResource, and returns the corresponding pipelineResource object, and an error if there is any. +func (c *pipelineResources) Get(name string, options v1.GetOptions) (result *v1alpha2.PipelineResource, err error) { + result = &v1alpha2.PipelineResource{} + err = c.client.Get(). + Namespace(c.ns). + Resource("pipelineresources"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PipelineResources that match those selectors. +func (c *pipelineResources) List(opts v1.ListOptions) (result *v1alpha2.PipelineResourceList, err error) { + result = &v1alpha2.PipelineResourceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("pipelineresources"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested pipelineResources. +func (c *pipelineResources) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("pipelineresources"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a pipelineResource and creates it. Returns the server's representation of the pipelineResource, and an error, if there is any. +func (c *pipelineResources) Create(pipelineResource *v1alpha2.PipelineResource) (result *v1alpha2.PipelineResource, err error) { + result = &v1alpha2.PipelineResource{} + err = c.client.Post(). + Namespace(c.ns). + Resource("pipelineresources"). + Body(pipelineResource). + Do(). + Into(result) + return +} + +// Update takes the representation of a pipelineResource and updates it. Returns the server's representation of the pipelineResource, and an error, if there is any. +func (c *pipelineResources) Update(pipelineResource *v1alpha2.PipelineResource) (result *v1alpha2.PipelineResource, err error) { + result = &v1alpha2.PipelineResource{} + err = c.client.Put(). + Namespace(c.ns). + Resource("pipelineresources"). + Name(pipelineResource.Name). + Body(pipelineResource). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *pipelineResources) UpdateStatus(pipelineResource *v1alpha2.PipelineResource) (result *v1alpha2.PipelineResource, err error) { + result = &v1alpha2.PipelineResource{} + err = c.client.Put(). + Namespace(c.ns). + Resource("pipelineresources"). + Name(pipelineResource.Name). + SubResource("status"). + Body(pipelineResource). + Do(). + Into(result) + return +} + +// Delete takes name of the pipelineResource and deletes it. Returns an error if one occurs. +func (c *pipelineResources) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("pipelineresources"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *pipelineResources) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("pipelineresources"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched pipelineResource. +func (c *pipelineResources) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.PipelineResource, err error) { + result = &v1alpha2.PipelineResource{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("pipelineresources"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipelinerun.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipelinerun.go new file mode 100644 index 00000000000..795794e7719 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/pipelinerun.go @@ -0,0 +1,174 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + scheme "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PipelineRunsGetter has a method to return a PipelineRunInterface. +// A group's client should implement this interface. +type PipelineRunsGetter interface { + PipelineRuns(namespace string) PipelineRunInterface +} + +// PipelineRunInterface has methods to work with PipelineRun resources. +type PipelineRunInterface interface { + Create(*v1alpha2.PipelineRun) (*v1alpha2.PipelineRun, error) + Update(*v1alpha2.PipelineRun) (*v1alpha2.PipelineRun, error) + UpdateStatus(*v1alpha2.PipelineRun) (*v1alpha2.PipelineRun, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha2.PipelineRun, error) + List(opts v1.ListOptions) (*v1alpha2.PipelineRunList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.PipelineRun, err error) + PipelineRunExpansion +} + +// pipelineRuns implements PipelineRunInterface +type pipelineRuns struct { + client rest.Interface + ns string +} + +// newPipelineRuns returns a PipelineRuns +func newPipelineRuns(c *TektonV1alpha2Client, namespace string) *pipelineRuns { + return &pipelineRuns{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the pipelineRun, and returns the corresponding pipelineRun object, and an error if there is any. +func (c *pipelineRuns) Get(name string, options v1.GetOptions) (result *v1alpha2.PipelineRun, err error) { + result = &v1alpha2.PipelineRun{} + err = c.client.Get(). + Namespace(c.ns). + Resource("pipelineruns"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PipelineRuns that match those selectors. +func (c *pipelineRuns) List(opts v1.ListOptions) (result *v1alpha2.PipelineRunList, err error) { + result = &v1alpha2.PipelineRunList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("pipelineruns"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested pipelineRuns. +func (c *pipelineRuns) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("pipelineruns"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a pipelineRun and creates it. Returns the server's representation of the pipelineRun, and an error, if there is any. +func (c *pipelineRuns) Create(pipelineRun *v1alpha2.PipelineRun) (result *v1alpha2.PipelineRun, err error) { + result = &v1alpha2.PipelineRun{} + err = c.client.Post(). + Namespace(c.ns). + Resource("pipelineruns"). + Body(pipelineRun). + Do(). + Into(result) + return +} + +// Update takes the representation of a pipelineRun and updates it. Returns the server's representation of the pipelineRun, and an error, if there is any. +func (c *pipelineRuns) Update(pipelineRun *v1alpha2.PipelineRun) (result *v1alpha2.PipelineRun, err error) { + result = &v1alpha2.PipelineRun{} + err = c.client.Put(). + Namespace(c.ns). + Resource("pipelineruns"). + Name(pipelineRun.Name). + Body(pipelineRun). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *pipelineRuns) UpdateStatus(pipelineRun *v1alpha2.PipelineRun) (result *v1alpha2.PipelineRun, err error) { + result = &v1alpha2.PipelineRun{} + err = c.client.Put(). + Namespace(c.ns). + Resource("pipelineruns"). + Name(pipelineRun.Name). + SubResource("status"). + Body(pipelineRun). + Do(). + Into(result) + return +} + +// Delete takes name of the pipelineRun and deletes it. Returns an error if one occurs. +func (c *pipelineRuns) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("pipelineruns"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *pipelineRuns) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("pipelineruns"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched pipelineRun. +func (c *pipelineRuns) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.PipelineRun, err error) { + result = &v1alpha2.PipelineRun{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("pipelineruns"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/task.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/task.go new file mode 100644 index 00000000000..7d642aa3f23 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/task.go @@ -0,0 +1,157 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + scheme "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// TasksGetter has a method to return a TaskInterface. +// A group's client should implement this interface. +type TasksGetter interface { + Tasks(namespace string) TaskInterface +} + +// TaskInterface has methods to work with Task resources. +type TaskInterface interface { + Create(*v1alpha2.Task) (*v1alpha2.Task, error) + Update(*v1alpha2.Task) (*v1alpha2.Task, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha2.Task, error) + List(opts v1.ListOptions) (*v1alpha2.TaskList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Task, err error) + TaskExpansion +} + +// tasks implements TaskInterface +type tasks struct { + client rest.Interface + ns string +} + +// newTasks returns a Tasks +func newTasks(c *TektonV1alpha2Client, namespace string) *tasks { + return &tasks{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the task, and returns the corresponding task object, and an error if there is any. +func (c *tasks) Get(name string, options v1.GetOptions) (result *v1alpha2.Task, err error) { + result = &v1alpha2.Task{} + err = c.client.Get(). + Namespace(c.ns). + Resource("tasks"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Tasks that match those selectors. +func (c *tasks) List(opts v1.ListOptions) (result *v1alpha2.TaskList, err error) { + result = &v1alpha2.TaskList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("tasks"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested tasks. +func (c *tasks) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("tasks"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a task and creates it. Returns the server's representation of the task, and an error, if there is any. +func (c *tasks) Create(task *v1alpha2.Task) (result *v1alpha2.Task, err error) { + result = &v1alpha2.Task{} + err = c.client.Post(). + Namespace(c.ns). + Resource("tasks"). + Body(task). + Do(). + Into(result) + return +} + +// Update takes the representation of a task and updates it. Returns the server's representation of the task, and an error, if there is any. +func (c *tasks) Update(task *v1alpha2.Task) (result *v1alpha2.Task, err error) { + result = &v1alpha2.Task{} + err = c.client.Put(). + Namespace(c.ns). + Resource("tasks"). + Name(task.Name). + Body(task). + Do(). + Into(result) + return +} + +// Delete takes name of the task and deletes it. Returns an error if one occurs. +func (c *tasks) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("tasks"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *tasks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("tasks"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched task. +func (c *tasks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Task, err error) { + result = &v1alpha2.Task{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("tasks"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/taskrun.go b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/taskrun.go new file mode 100644 index 00000000000..500c7e7f4dd --- /dev/null +++ b/pkg/client/clientset/versioned/typed/pipeline/v1alpha2/taskrun.go @@ -0,0 +1,174 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + scheme "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// TaskRunsGetter has a method to return a TaskRunInterface. +// A group's client should implement this interface. +type TaskRunsGetter interface { + TaskRuns(namespace string) TaskRunInterface +} + +// TaskRunInterface has methods to work with TaskRun resources. +type TaskRunInterface interface { + Create(*v1alpha2.TaskRun) (*v1alpha2.TaskRun, error) + Update(*v1alpha2.TaskRun) (*v1alpha2.TaskRun, error) + UpdateStatus(*v1alpha2.TaskRun) (*v1alpha2.TaskRun, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha2.TaskRun, error) + List(opts v1.ListOptions) (*v1alpha2.TaskRunList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.TaskRun, err error) + TaskRunExpansion +} + +// taskRuns implements TaskRunInterface +type taskRuns struct { + client rest.Interface + ns string +} + +// newTaskRuns returns a TaskRuns +func newTaskRuns(c *TektonV1alpha2Client, namespace string) *taskRuns { + return &taskRuns{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the taskRun, and returns the corresponding taskRun object, and an error if there is any. +func (c *taskRuns) Get(name string, options v1.GetOptions) (result *v1alpha2.TaskRun, err error) { + result = &v1alpha2.TaskRun{} + err = c.client.Get(). + Namespace(c.ns). + Resource("taskruns"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of TaskRuns that match those selectors. +func (c *taskRuns) List(opts v1.ListOptions) (result *v1alpha2.TaskRunList, err error) { + result = &v1alpha2.TaskRunList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("taskruns"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested taskRuns. +func (c *taskRuns) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("taskruns"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a taskRun and creates it. Returns the server's representation of the taskRun, and an error, if there is any. +func (c *taskRuns) Create(taskRun *v1alpha2.TaskRun) (result *v1alpha2.TaskRun, err error) { + result = &v1alpha2.TaskRun{} + err = c.client.Post(). + Namespace(c.ns). + Resource("taskruns"). + Body(taskRun). + Do(). + Into(result) + return +} + +// Update takes the representation of a taskRun and updates it. Returns the server's representation of the taskRun, and an error, if there is any. +func (c *taskRuns) Update(taskRun *v1alpha2.TaskRun) (result *v1alpha2.TaskRun, err error) { + result = &v1alpha2.TaskRun{} + err = c.client.Put(). + Namespace(c.ns). + Resource("taskruns"). + Name(taskRun.Name). + Body(taskRun). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *taskRuns) UpdateStatus(taskRun *v1alpha2.TaskRun) (result *v1alpha2.TaskRun, err error) { + result = &v1alpha2.TaskRun{} + err = c.client.Put(). + Namespace(c.ns). + Resource("taskruns"). + Name(taskRun.Name). + SubResource("status"). + Body(taskRun). + Do(). + Into(result) + return +} + +// Delete takes name of the taskRun and deletes it. Returns an error if one occurs. +func (c *taskRuns) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("taskruns"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *taskRuns) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("taskruns"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched taskRun. +func (c *taskRuns) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.TaskRun, err error) { + result = &v1alpha2.TaskRun{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("taskruns"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index a8f87a56336..e1f76c31527 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -22,6 +22,7 @@ import ( "fmt" v1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -68,6 +69,22 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1alpha1.SchemeGroupVersion.WithResource("taskruns"): return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha1().TaskRuns().Informer()}, nil + // Group=tekton.dev, Version=v1alpha2 + case v1alpha2.SchemeGroupVersion.WithResource("clustertasks"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha2().ClusterTasks().Informer()}, nil + case v1alpha2.SchemeGroupVersion.WithResource("conditions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha2().Conditions().Informer()}, nil + case v1alpha2.SchemeGroupVersion.WithResource("pipelines"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha2().Pipelines().Informer()}, nil + case v1alpha2.SchemeGroupVersion.WithResource("pipelineresources"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha2().PipelineResources().Informer()}, nil + case v1alpha2.SchemeGroupVersion.WithResource("pipelineruns"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha2().PipelineRuns().Informer()}, nil + case v1alpha2.SchemeGroupVersion.WithResource("tasks"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha2().Tasks().Informer()}, nil + case v1alpha2.SchemeGroupVersion.WithResource("taskruns"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Tekton().V1alpha2().TaskRuns().Informer()}, nil + } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/pkg/client/informers/externalversions/pipeline/interface.go b/pkg/client/informers/externalversions/pipeline/interface.go index c31159ee4be..72662a82687 100644 --- a/pkg/client/informers/externalversions/pipeline/interface.go +++ b/pkg/client/informers/externalversions/pipeline/interface.go @@ -21,12 +21,15 @@ package tekton import ( internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" v1alpha1 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha1" + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2" ) // Interface provides access to each of this group's versions. type Interface interface { // V1alpha1 provides access to shared informers for resources in V1alpha1. V1alpha1() v1alpha1.Interface + // V1alpha2 provides access to shared informers for resources in V1alpha2. + V1alpha2() v1alpha2.Interface } type group struct { @@ -44,3 +47,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V1alpha1() v1alpha1.Interface { return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1alpha2 returns a new v1alpha2.Interface. +func (g *group) V1alpha2() v1alpha2.Interface { + return v1alpha2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/pipeline/v1alpha2/clustertask.go b/pkg/client/informers/externalversions/pipeline/v1alpha2/clustertask.go new file mode 100644 index 00000000000..5fed5cc58fc --- /dev/null +++ b/pkg/client/informers/externalversions/pipeline/v1alpha2/clustertask.go @@ -0,0 +1,88 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + time "time" + + pipelinev1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + versioned "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" + internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterTaskInformer provides access to a shared informer and lister for +// ClusterTasks. +type ClusterTaskInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha2.ClusterTaskLister +} + +type clusterTaskInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterTaskInformer constructs a new informer for ClusterTask type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterTaskInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterTaskInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterTaskInformer constructs a new informer for ClusterTask type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterTaskInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha2().ClusterTasks().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha2().ClusterTasks().Watch(options) + }, + }, + &pipelinev1alpha2.ClusterTask{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterTaskInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterTaskInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterTaskInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&pipelinev1alpha2.ClusterTask{}, f.defaultInformer) +} + +func (f *clusterTaskInformer) Lister() v1alpha2.ClusterTaskLister { + return v1alpha2.NewClusterTaskLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/pipeline/v1alpha2/condition.go b/pkg/client/informers/externalversions/pipeline/v1alpha2/condition.go new file mode 100644 index 00000000000..79845f3b7bd --- /dev/null +++ b/pkg/client/informers/externalversions/pipeline/v1alpha2/condition.go @@ -0,0 +1,89 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + time "time" + + pipelinev1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + versioned "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" + internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ConditionInformer provides access to a shared informer and lister for +// Conditions. +type ConditionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha2.ConditionLister +} + +type conditionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewConditionInformer constructs a new informer for Condition type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewConditionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredConditionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredConditionInformer constructs a new informer for Condition type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredConditionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha2().Conditions(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha2().Conditions(namespace).Watch(options) + }, + }, + &pipelinev1alpha2.Condition{}, + resyncPeriod, + indexers, + ) +} + +func (f *conditionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredConditionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *conditionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&pipelinev1alpha2.Condition{}, f.defaultInformer) +} + +func (f *conditionInformer) Lister() v1alpha2.ConditionLister { + return v1alpha2.NewConditionLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/pipeline/v1alpha2/interface.go b/pkg/client/informers/externalversions/pipeline/v1alpha2/interface.go new file mode 100644 index 00000000000..1e99bb77c41 --- /dev/null +++ b/pkg/client/informers/externalversions/pipeline/v1alpha2/interface.go @@ -0,0 +1,87 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ClusterTasks returns a ClusterTaskInformer. + ClusterTasks() ClusterTaskInformer + // Conditions returns a ConditionInformer. + Conditions() ConditionInformer + // Pipelines returns a PipelineInformer. + Pipelines() PipelineInformer + // PipelineResources returns a PipelineResourceInformer. + PipelineResources() PipelineResourceInformer + // PipelineRuns returns a PipelineRunInformer. + PipelineRuns() PipelineRunInformer + // Tasks returns a TaskInformer. + Tasks() TaskInformer + // TaskRuns returns a TaskRunInformer. + TaskRuns() TaskRunInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ClusterTasks returns a ClusterTaskInformer. +func (v *version) ClusterTasks() ClusterTaskInformer { + return &clusterTaskInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Conditions returns a ConditionInformer. +func (v *version) Conditions() ConditionInformer { + return &conditionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Pipelines returns a PipelineInformer. +func (v *version) Pipelines() PipelineInformer { + return &pipelineInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PipelineResources returns a PipelineResourceInformer. +func (v *version) PipelineResources() PipelineResourceInformer { + return &pipelineResourceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PipelineRuns returns a PipelineRunInformer. +func (v *version) PipelineRuns() PipelineRunInformer { + return &pipelineRunInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Tasks returns a TaskInformer. +func (v *version) Tasks() TaskInformer { + return &taskInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// TaskRuns returns a TaskRunInformer. +func (v *version) TaskRuns() TaskRunInformer { + return &taskRunInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/pipeline/v1alpha2/pipeline.go b/pkg/client/informers/externalversions/pipeline/v1alpha2/pipeline.go new file mode 100644 index 00000000000..6801a3e82d0 --- /dev/null +++ b/pkg/client/informers/externalversions/pipeline/v1alpha2/pipeline.go @@ -0,0 +1,89 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + time "time" + + pipelinev1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + versioned "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" + internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PipelineInformer provides access to a shared informer and lister for +// Pipelines. +type PipelineInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha2.PipelineLister +} + +type pipelineInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPipelineInformer constructs a new informer for Pipeline type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPipelineInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPipelineInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPipelineInformer constructs a new informer for Pipeline type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPipelineInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha2().Pipelines(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha2().Pipelines(namespace).Watch(options) + }, + }, + &pipelinev1alpha2.Pipeline{}, + resyncPeriod, + indexers, + ) +} + +func (f *pipelineInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPipelineInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *pipelineInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&pipelinev1alpha2.Pipeline{}, f.defaultInformer) +} + +func (f *pipelineInformer) Lister() v1alpha2.PipelineLister { + return v1alpha2.NewPipelineLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/pipeline/v1alpha2/pipelineresource.go b/pkg/client/informers/externalversions/pipeline/v1alpha2/pipelineresource.go new file mode 100644 index 00000000000..bce24297780 --- /dev/null +++ b/pkg/client/informers/externalversions/pipeline/v1alpha2/pipelineresource.go @@ -0,0 +1,89 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + time "time" + + pipelinev1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + versioned "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" + internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PipelineResourceInformer provides access to a shared informer and lister for +// PipelineResources. +type PipelineResourceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha2.PipelineResourceLister +} + +type pipelineResourceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPipelineResourceInformer constructs a new informer for PipelineResource type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPipelineResourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPipelineResourceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPipelineResourceInformer constructs a new informer for PipelineResource type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPipelineResourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha2().PipelineResources(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha2().PipelineResources(namespace).Watch(options) + }, + }, + &pipelinev1alpha2.PipelineResource{}, + resyncPeriod, + indexers, + ) +} + +func (f *pipelineResourceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPipelineResourceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *pipelineResourceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&pipelinev1alpha2.PipelineResource{}, f.defaultInformer) +} + +func (f *pipelineResourceInformer) Lister() v1alpha2.PipelineResourceLister { + return v1alpha2.NewPipelineResourceLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/pipeline/v1alpha2/pipelinerun.go b/pkg/client/informers/externalversions/pipeline/v1alpha2/pipelinerun.go new file mode 100644 index 00000000000..44047dd06f1 --- /dev/null +++ b/pkg/client/informers/externalversions/pipeline/v1alpha2/pipelinerun.go @@ -0,0 +1,89 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + time "time" + + pipelinev1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + versioned "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" + internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PipelineRunInformer provides access to a shared informer and lister for +// PipelineRuns. +type PipelineRunInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha2.PipelineRunLister +} + +type pipelineRunInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPipelineRunInformer constructs a new informer for PipelineRun type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPipelineRunInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPipelineRunInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPipelineRunInformer constructs a new informer for PipelineRun type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPipelineRunInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha2().PipelineRuns(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha2().PipelineRuns(namespace).Watch(options) + }, + }, + &pipelinev1alpha2.PipelineRun{}, + resyncPeriod, + indexers, + ) +} + +func (f *pipelineRunInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPipelineRunInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *pipelineRunInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&pipelinev1alpha2.PipelineRun{}, f.defaultInformer) +} + +func (f *pipelineRunInformer) Lister() v1alpha2.PipelineRunLister { + return v1alpha2.NewPipelineRunLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/pipeline/v1alpha2/task.go b/pkg/client/informers/externalversions/pipeline/v1alpha2/task.go new file mode 100644 index 00000000000..d8bddca6a97 --- /dev/null +++ b/pkg/client/informers/externalversions/pipeline/v1alpha2/task.go @@ -0,0 +1,89 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + time "time" + + pipelinev1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + versioned "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" + internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// TaskInformer provides access to a shared informer and lister for +// Tasks. +type TaskInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha2.TaskLister +} + +type taskInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewTaskInformer constructs a new informer for Task type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTaskInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredTaskInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredTaskInformer constructs a new informer for Task type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredTaskInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha2().Tasks(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha2().Tasks(namespace).Watch(options) + }, + }, + &pipelinev1alpha2.Task{}, + resyncPeriod, + indexers, + ) +} + +func (f *taskInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredTaskInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *taskInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&pipelinev1alpha2.Task{}, f.defaultInformer) +} + +func (f *taskInformer) Lister() v1alpha2.TaskLister { + return v1alpha2.NewTaskLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/pipeline/v1alpha2/taskrun.go b/pkg/client/informers/externalversions/pipeline/v1alpha2/taskrun.go new file mode 100644 index 00000000000..614ff931881 --- /dev/null +++ b/pkg/client/informers/externalversions/pipeline/v1alpha2/taskrun.go @@ -0,0 +1,89 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + time "time" + + pipelinev1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + versioned "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" + internalinterfaces "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/internalinterfaces" + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// TaskRunInformer provides access to a shared informer and lister for +// TaskRuns. +type TaskRunInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha2.TaskRunLister +} + +type taskRunInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewTaskRunInformer constructs a new informer for TaskRun type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTaskRunInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredTaskRunInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredTaskRunInformer constructs a new informer for TaskRun type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredTaskRunInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha2().TaskRuns(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TektonV1alpha2().TaskRuns(namespace).Watch(options) + }, + }, + &pipelinev1alpha2.TaskRun{}, + resyncPeriod, + indexers, + ) +} + +func (f *taskRunInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredTaskRunInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *taskRunInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&pipelinev1alpha2.TaskRun{}, f.defaultInformer) +} + +func (f *taskRunInformer) Lister() v1alpha2.TaskRunLister { + return v1alpha2.NewTaskRunLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/clustertask/clustertask.go b/pkg/client/injection/informers/pipeline/v1alpha2/clustertask/clustertask.go new file mode 100644 index 00000000000..f99f39a8fde --- /dev/null +++ b/pkg/client/injection/informers/pipeline/v1alpha2/clustertask/clustertask.go @@ -0,0 +1,52 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package clustertask + +import ( + "context" + + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2" + factory "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Tekton().V1alpha2().ClusterTasks() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha2.ClusterTaskInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2.ClusterTaskInformer from context.") + } + return untyped.(v1alpha2.ClusterTaskInformer) +} diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/clustertask/fake/fake.go b/pkg/client/injection/informers/pipeline/v1alpha2/clustertask/fake/fake.go new file mode 100644 index 00000000000..241415d5657 --- /dev/null +++ b/pkg/client/injection/informers/pipeline/v1alpha2/clustertask/fake/fake.go @@ -0,0 +1,40 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + fake "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory/fake" + clustertask "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha2/clustertask" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = clustertask.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Tekton().V1alpha2().ClusterTasks() + return context.WithValue(ctx, clustertask.Key{}, inf), inf.Informer() +} diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/condition/condition.go b/pkg/client/injection/informers/pipeline/v1alpha2/condition/condition.go new file mode 100644 index 00000000000..7775e75f1ff --- /dev/null +++ b/pkg/client/injection/informers/pipeline/v1alpha2/condition/condition.go @@ -0,0 +1,52 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package condition + +import ( + "context" + + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2" + factory "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Tekton().V1alpha2().Conditions() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha2.ConditionInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2.ConditionInformer from context.") + } + return untyped.(v1alpha2.ConditionInformer) +} diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/condition/fake/fake.go b/pkg/client/injection/informers/pipeline/v1alpha2/condition/fake/fake.go new file mode 100644 index 00000000000..07f6b596880 --- /dev/null +++ b/pkg/client/injection/informers/pipeline/v1alpha2/condition/fake/fake.go @@ -0,0 +1,40 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + fake "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory/fake" + condition "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha2/condition" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = condition.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Tekton().V1alpha2().Conditions() + return context.WithValue(ctx, condition.Key{}, inf), inf.Informer() +} diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/pipeline/fake/fake.go b/pkg/client/injection/informers/pipeline/v1alpha2/pipeline/fake/fake.go new file mode 100644 index 00000000000..946e54037a7 --- /dev/null +++ b/pkg/client/injection/informers/pipeline/v1alpha2/pipeline/fake/fake.go @@ -0,0 +1,40 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + fake "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory/fake" + pipeline "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha2/pipeline" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = pipeline.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Tekton().V1alpha2().Pipelines() + return context.WithValue(ctx, pipeline.Key{}, inf), inf.Informer() +} diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/pipeline/pipeline.go b/pkg/client/injection/informers/pipeline/v1alpha2/pipeline/pipeline.go new file mode 100644 index 00000000000..ff19269f11d --- /dev/null +++ b/pkg/client/injection/informers/pipeline/v1alpha2/pipeline/pipeline.go @@ -0,0 +1,52 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package pipeline + +import ( + "context" + + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2" + factory "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Tekton().V1alpha2().Pipelines() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha2.PipelineInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2.PipelineInformer from context.") + } + return untyped.(v1alpha2.PipelineInformer) +} diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/pipelineresource/fake/fake.go b/pkg/client/injection/informers/pipeline/v1alpha2/pipelineresource/fake/fake.go new file mode 100644 index 00000000000..2a1ec5e4103 --- /dev/null +++ b/pkg/client/injection/informers/pipeline/v1alpha2/pipelineresource/fake/fake.go @@ -0,0 +1,40 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + fake "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory/fake" + pipelineresource "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha2/pipelineresource" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = pipelineresource.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Tekton().V1alpha2().PipelineResources() + return context.WithValue(ctx, pipelineresource.Key{}, inf), inf.Informer() +} diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/pipelineresource/pipelineresource.go b/pkg/client/injection/informers/pipeline/v1alpha2/pipelineresource/pipelineresource.go new file mode 100644 index 00000000000..e3b3a748253 --- /dev/null +++ b/pkg/client/injection/informers/pipeline/v1alpha2/pipelineresource/pipelineresource.go @@ -0,0 +1,52 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package pipelineresource + +import ( + "context" + + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2" + factory "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Tekton().V1alpha2().PipelineResources() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha2.PipelineResourceInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2.PipelineResourceInformer from context.") + } + return untyped.(v1alpha2.PipelineResourceInformer) +} diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun/fake/fake.go b/pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun/fake/fake.go new file mode 100644 index 00000000000..995fffc705a --- /dev/null +++ b/pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun/fake/fake.go @@ -0,0 +1,40 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + fake "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory/fake" + pipelinerun "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = pipelinerun.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Tekton().V1alpha2().PipelineRuns() + return context.WithValue(ctx, pipelinerun.Key{}, inf), inf.Informer() +} diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun/pipelinerun.go b/pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun/pipelinerun.go new file mode 100644 index 00000000000..8c18696bfab --- /dev/null +++ b/pkg/client/injection/informers/pipeline/v1alpha2/pipelinerun/pipelinerun.go @@ -0,0 +1,52 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package pipelinerun + +import ( + "context" + + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2" + factory "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Tekton().V1alpha2().PipelineRuns() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha2.PipelineRunInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2.PipelineRunInformer from context.") + } + return untyped.(v1alpha2.PipelineRunInformer) +} diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/task/fake/fake.go b/pkg/client/injection/informers/pipeline/v1alpha2/task/fake/fake.go new file mode 100644 index 00000000000..675368cd38c --- /dev/null +++ b/pkg/client/injection/informers/pipeline/v1alpha2/task/fake/fake.go @@ -0,0 +1,40 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + fake "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory/fake" + task "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha2/task" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = task.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Tekton().V1alpha2().Tasks() + return context.WithValue(ctx, task.Key{}, inf), inf.Informer() +} diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/task/task.go b/pkg/client/injection/informers/pipeline/v1alpha2/task/task.go new file mode 100644 index 00000000000..ee1f1c3ec0e --- /dev/null +++ b/pkg/client/injection/informers/pipeline/v1alpha2/task/task.go @@ -0,0 +1,52 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package task + +import ( + "context" + + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2" + factory "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Tekton().V1alpha2().Tasks() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha2.TaskInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2.TaskInformer from context.") + } + return untyped.(v1alpha2.TaskInformer) +} diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/taskrun/fake/fake.go b/pkg/client/injection/informers/pipeline/v1alpha2/taskrun/fake/fake.go new file mode 100644 index 00000000000..33ea930befa --- /dev/null +++ b/pkg/client/injection/informers/pipeline/v1alpha2/taskrun/fake/fake.go @@ -0,0 +1,40 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + fake "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory/fake" + taskrun "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha2/taskrun" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" +) + +var Get = taskrun.Get + +func init() { + injection.Fake.RegisterInformer(withInformer) +} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := fake.Get(ctx) + inf := f.Tekton().V1alpha2().TaskRuns() + return context.WithValue(ctx, taskrun.Key{}, inf), inf.Informer() +} diff --git a/pkg/client/injection/informers/pipeline/v1alpha2/taskrun/taskrun.go b/pkg/client/injection/informers/pipeline/v1alpha2/taskrun/taskrun.go new file mode 100644 index 00000000000..52addcae9c7 --- /dev/null +++ b/pkg/client/injection/informers/pipeline/v1alpha2/taskrun/taskrun.go @@ -0,0 +1,52 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package taskrun + +import ( + "context" + + v1alpha2 "github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2" + factory "github.com/tektoncd/pipeline/pkg/client/injection/informers/factory" + controller "knative.dev/pkg/controller" + injection "knative.dev/pkg/injection" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterInformer(withInformer) +} + +// Key is used for associating the Informer inside the context.Context. +type Key struct{} + +func withInformer(ctx context.Context) (context.Context, controller.Informer) { + f := factory.Get(ctx) + inf := f.Tekton().V1alpha2().TaskRuns() + return context.WithValue(ctx, Key{}, inf), inf.Informer() +} + +// Get extracts the typed informer from the context. +func Get(ctx context.Context) v1alpha2.TaskRunInformer { + untyped := ctx.Value(Key{}) + if untyped == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch github.com/tektoncd/pipeline/pkg/client/informers/externalversions/pipeline/v1alpha2.TaskRunInformer from context.") + } + return untyped.(v1alpha2.TaskRunInformer) +} diff --git a/pkg/client/listers/pipeline/v1alpha2/clustertask.go b/pkg/client/listers/pipeline/v1alpha2/clustertask.go new file mode 100644 index 00000000000..e71fbe7492a --- /dev/null +++ b/pkg/client/listers/pipeline/v1alpha2/clustertask.go @@ -0,0 +1,65 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterTaskLister helps list ClusterTasks. +type ClusterTaskLister interface { + // List lists all ClusterTasks in the indexer. + List(selector labels.Selector) (ret []*v1alpha2.ClusterTask, err error) + // Get retrieves the ClusterTask from the index for a given name. + Get(name string) (*v1alpha2.ClusterTask, error) + ClusterTaskListerExpansion +} + +// clusterTaskLister implements the ClusterTaskLister interface. +type clusterTaskLister struct { + indexer cache.Indexer +} + +// NewClusterTaskLister returns a new ClusterTaskLister. +func NewClusterTaskLister(indexer cache.Indexer) ClusterTaskLister { + return &clusterTaskLister{indexer: indexer} +} + +// List lists all ClusterTasks in the indexer. +func (s *clusterTaskLister) List(selector labels.Selector) (ret []*v1alpha2.ClusterTask, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.ClusterTask)) + }) + return ret, err +} + +// Get retrieves the ClusterTask from the index for a given name. +func (s *clusterTaskLister) Get(name string) (*v1alpha2.ClusterTask, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha2.Resource("clustertask"), name) + } + return obj.(*v1alpha2.ClusterTask), nil +} diff --git a/pkg/client/listers/pipeline/v1alpha2/condition.go b/pkg/client/listers/pipeline/v1alpha2/condition.go new file mode 100644 index 00000000000..f36e80afbfa --- /dev/null +++ b/pkg/client/listers/pipeline/v1alpha2/condition.go @@ -0,0 +1,94 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ConditionLister helps list Conditions. +type ConditionLister interface { + // List lists all Conditions in the indexer. + List(selector labels.Selector) (ret []*v1alpha2.Condition, err error) + // Conditions returns an object that can list and get Conditions. + Conditions(namespace string) ConditionNamespaceLister + ConditionListerExpansion +} + +// conditionLister implements the ConditionLister interface. +type conditionLister struct { + indexer cache.Indexer +} + +// NewConditionLister returns a new ConditionLister. +func NewConditionLister(indexer cache.Indexer) ConditionLister { + return &conditionLister{indexer: indexer} +} + +// List lists all Conditions in the indexer. +func (s *conditionLister) List(selector labels.Selector) (ret []*v1alpha2.Condition, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.Condition)) + }) + return ret, err +} + +// Conditions returns an object that can list and get Conditions. +func (s *conditionLister) Conditions(namespace string) ConditionNamespaceLister { + return conditionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ConditionNamespaceLister helps list and get Conditions. +type ConditionNamespaceLister interface { + // List lists all Conditions in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha2.Condition, err error) + // Get retrieves the Condition from the indexer for a given namespace and name. + Get(name string) (*v1alpha2.Condition, error) + ConditionNamespaceListerExpansion +} + +// conditionNamespaceLister implements the ConditionNamespaceLister +// interface. +type conditionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Conditions in the indexer for a given namespace. +func (s conditionNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.Condition, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.Condition)) + }) + return ret, err +} + +// Get retrieves the Condition from the indexer for a given namespace and name. +func (s conditionNamespaceLister) Get(name string) (*v1alpha2.Condition, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha2.Resource("condition"), name) + } + return obj.(*v1alpha2.Condition), nil +} diff --git a/pkg/client/listers/pipeline/v1alpha2/expansion_generated.go b/pkg/client/listers/pipeline/v1alpha2/expansion_generated.go new file mode 100644 index 00000000000..24312aa23ec --- /dev/null +++ b/pkg/client/listers/pipeline/v1alpha2/expansion_generated.go @@ -0,0 +1,71 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +// ClusterTaskListerExpansion allows custom methods to be added to +// ClusterTaskLister. +type ClusterTaskListerExpansion interface{} + +// ConditionListerExpansion allows custom methods to be added to +// ConditionLister. +type ConditionListerExpansion interface{} + +// ConditionNamespaceListerExpansion allows custom methods to be added to +// ConditionNamespaceLister. +type ConditionNamespaceListerExpansion interface{} + +// PipelineListerExpansion allows custom methods to be added to +// PipelineLister. +type PipelineListerExpansion interface{} + +// PipelineNamespaceListerExpansion allows custom methods to be added to +// PipelineNamespaceLister. +type PipelineNamespaceListerExpansion interface{} + +// PipelineResourceListerExpansion allows custom methods to be added to +// PipelineResourceLister. +type PipelineResourceListerExpansion interface{} + +// PipelineResourceNamespaceListerExpansion allows custom methods to be added to +// PipelineResourceNamespaceLister. +type PipelineResourceNamespaceListerExpansion interface{} + +// PipelineRunListerExpansion allows custom methods to be added to +// PipelineRunLister. +type PipelineRunListerExpansion interface{} + +// PipelineRunNamespaceListerExpansion allows custom methods to be added to +// PipelineRunNamespaceLister. +type PipelineRunNamespaceListerExpansion interface{} + +// TaskListerExpansion allows custom methods to be added to +// TaskLister. +type TaskListerExpansion interface{} + +// TaskNamespaceListerExpansion allows custom methods to be added to +// TaskNamespaceLister. +type TaskNamespaceListerExpansion interface{} + +// TaskRunListerExpansion allows custom methods to be added to +// TaskRunLister. +type TaskRunListerExpansion interface{} + +// TaskRunNamespaceListerExpansion allows custom methods to be added to +// TaskRunNamespaceLister. +type TaskRunNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/pipeline/v1alpha2/pipeline.go b/pkg/client/listers/pipeline/v1alpha2/pipeline.go new file mode 100644 index 00000000000..5fa74362ac4 --- /dev/null +++ b/pkg/client/listers/pipeline/v1alpha2/pipeline.go @@ -0,0 +1,94 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PipelineLister helps list Pipelines. +type PipelineLister interface { + // List lists all Pipelines in the indexer. + List(selector labels.Selector) (ret []*v1alpha2.Pipeline, err error) + // Pipelines returns an object that can list and get Pipelines. + Pipelines(namespace string) PipelineNamespaceLister + PipelineListerExpansion +} + +// pipelineLister implements the PipelineLister interface. +type pipelineLister struct { + indexer cache.Indexer +} + +// NewPipelineLister returns a new PipelineLister. +func NewPipelineLister(indexer cache.Indexer) PipelineLister { + return &pipelineLister{indexer: indexer} +} + +// List lists all Pipelines in the indexer. +func (s *pipelineLister) List(selector labels.Selector) (ret []*v1alpha2.Pipeline, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.Pipeline)) + }) + return ret, err +} + +// Pipelines returns an object that can list and get Pipelines. +func (s *pipelineLister) Pipelines(namespace string) PipelineNamespaceLister { + return pipelineNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PipelineNamespaceLister helps list and get Pipelines. +type PipelineNamespaceLister interface { + // List lists all Pipelines in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha2.Pipeline, err error) + // Get retrieves the Pipeline from the indexer for a given namespace and name. + Get(name string) (*v1alpha2.Pipeline, error) + PipelineNamespaceListerExpansion +} + +// pipelineNamespaceLister implements the PipelineNamespaceLister +// interface. +type pipelineNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Pipelines in the indexer for a given namespace. +func (s pipelineNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.Pipeline, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.Pipeline)) + }) + return ret, err +} + +// Get retrieves the Pipeline from the indexer for a given namespace and name. +func (s pipelineNamespaceLister) Get(name string) (*v1alpha2.Pipeline, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha2.Resource("pipeline"), name) + } + return obj.(*v1alpha2.Pipeline), nil +} diff --git a/pkg/client/listers/pipeline/v1alpha2/pipelineresource.go b/pkg/client/listers/pipeline/v1alpha2/pipelineresource.go new file mode 100644 index 00000000000..74f0569e169 --- /dev/null +++ b/pkg/client/listers/pipeline/v1alpha2/pipelineresource.go @@ -0,0 +1,94 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PipelineResourceLister helps list PipelineResources. +type PipelineResourceLister interface { + // List lists all PipelineResources in the indexer. + List(selector labels.Selector) (ret []*v1alpha2.PipelineResource, err error) + // PipelineResources returns an object that can list and get PipelineResources. + PipelineResources(namespace string) PipelineResourceNamespaceLister + PipelineResourceListerExpansion +} + +// pipelineResourceLister implements the PipelineResourceLister interface. +type pipelineResourceLister struct { + indexer cache.Indexer +} + +// NewPipelineResourceLister returns a new PipelineResourceLister. +func NewPipelineResourceLister(indexer cache.Indexer) PipelineResourceLister { + return &pipelineResourceLister{indexer: indexer} +} + +// List lists all PipelineResources in the indexer. +func (s *pipelineResourceLister) List(selector labels.Selector) (ret []*v1alpha2.PipelineResource, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.PipelineResource)) + }) + return ret, err +} + +// PipelineResources returns an object that can list and get PipelineResources. +func (s *pipelineResourceLister) PipelineResources(namespace string) PipelineResourceNamespaceLister { + return pipelineResourceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PipelineResourceNamespaceLister helps list and get PipelineResources. +type PipelineResourceNamespaceLister interface { + // List lists all PipelineResources in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha2.PipelineResource, err error) + // Get retrieves the PipelineResource from the indexer for a given namespace and name. + Get(name string) (*v1alpha2.PipelineResource, error) + PipelineResourceNamespaceListerExpansion +} + +// pipelineResourceNamespaceLister implements the PipelineResourceNamespaceLister +// interface. +type pipelineResourceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PipelineResources in the indexer for a given namespace. +func (s pipelineResourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.PipelineResource, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.PipelineResource)) + }) + return ret, err +} + +// Get retrieves the PipelineResource from the indexer for a given namespace and name. +func (s pipelineResourceNamespaceLister) Get(name string) (*v1alpha2.PipelineResource, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha2.Resource("pipelineresource"), name) + } + return obj.(*v1alpha2.PipelineResource), nil +} diff --git a/pkg/client/listers/pipeline/v1alpha2/pipelinerun.go b/pkg/client/listers/pipeline/v1alpha2/pipelinerun.go new file mode 100644 index 00000000000..c83afb1a6d1 --- /dev/null +++ b/pkg/client/listers/pipeline/v1alpha2/pipelinerun.go @@ -0,0 +1,94 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PipelineRunLister helps list PipelineRuns. +type PipelineRunLister interface { + // List lists all PipelineRuns in the indexer. + List(selector labels.Selector) (ret []*v1alpha2.PipelineRun, err error) + // PipelineRuns returns an object that can list and get PipelineRuns. + PipelineRuns(namespace string) PipelineRunNamespaceLister + PipelineRunListerExpansion +} + +// pipelineRunLister implements the PipelineRunLister interface. +type pipelineRunLister struct { + indexer cache.Indexer +} + +// NewPipelineRunLister returns a new PipelineRunLister. +func NewPipelineRunLister(indexer cache.Indexer) PipelineRunLister { + return &pipelineRunLister{indexer: indexer} +} + +// List lists all PipelineRuns in the indexer. +func (s *pipelineRunLister) List(selector labels.Selector) (ret []*v1alpha2.PipelineRun, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.PipelineRun)) + }) + return ret, err +} + +// PipelineRuns returns an object that can list and get PipelineRuns. +func (s *pipelineRunLister) PipelineRuns(namespace string) PipelineRunNamespaceLister { + return pipelineRunNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PipelineRunNamespaceLister helps list and get PipelineRuns. +type PipelineRunNamespaceLister interface { + // List lists all PipelineRuns in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha2.PipelineRun, err error) + // Get retrieves the PipelineRun from the indexer for a given namespace and name. + Get(name string) (*v1alpha2.PipelineRun, error) + PipelineRunNamespaceListerExpansion +} + +// pipelineRunNamespaceLister implements the PipelineRunNamespaceLister +// interface. +type pipelineRunNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PipelineRuns in the indexer for a given namespace. +func (s pipelineRunNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.PipelineRun, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.PipelineRun)) + }) + return ret, err +} + +// Get retrieves the PipelineRun from the indexer for a given namespace and name. +func (s pipelineRunNamespaceLister) Get(name string) (*v1alpha2.PipelineRun, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha2.Resource("pipelinerun"), name) + } + return obj.(*v1alpha2.PipelineRun), nil +} diff --git a/pkg/client/listers/pipeline/v1alpha2/task.go b/pkg/client/listers/pipeline/v1alpha2/task.go new file mode 100644 index 00000000000..9b8b2ee73eb --- /dev/null +++ b/pkg/client/listers/pipeline/v1alpha2/task.go @@ -0,0 +1,94 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// TaskLister helps list Tasks. +type TaskLister interface { + // List lists all Tasks in the indexer. + List(selector labels.Selector) (ret []*v1alpha2.Task, err error) + // Tasks returns an object that can list and get Tasks. + Tasks(namespace string) TaskNamespaceLister + TaskListerExpansion +} + +// taskLister implements the TaskLister interface. +type taskLister struct { + indexer cache.Indexer +} + +// NewTaskLister returns a new TaskLister. +func NewTaskLister(indexer cache.Indexer) TaskLister { + return &taskLister{indexer: indexer} +} + +// List lists all Tasks in the indexer. +func (s *taskLister) List(selector labels.Selector) (ret []*v1alpha2.Task, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.Task)) + }) + return ret, err +} + +// Tasks returns an object that can list and get Tasks. +func (s *taskLister) Tasks(namespace string) TaskNamespaceLister { + return taskNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// TaskNamespaceLister helps list and get Tasks. +type TaskNamespaceLister interface { + // List lists all Tasks in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha2.Task, err error) + // Get retrieves the Task from the indexer for a given namespace and name. + Get(name string) (*v1alpha2.Task, error) + TaskNamespaceListerExpansion +} + +// taskNamespaceLister implements the TaskNamespaceLister +// interface. +type taskNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Tasks in the indexer for a given namespace. +func (s taskNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.Task, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.Task)) + }) + return ret, err +} + +// Get retrieves the Task from the indexer for a given namespace and name. +func (s taskNamespaceLister) Get(name string) (*v1alpha2.Task, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha2.Resource("task"), name) + } + return obj.(*v1alpha2.Task), nil +} diff --git a/pkg/client/listers/pipeline/v1alpha2/taskrun.go b/pkg/client/listers/pipeline/v1alpha2/taskrun.go new file mode 100644 index 00000000000..53302307ef6 --- /dev/null +++ b/pkg/client/listers/pipeline/v1alpha2/taskrun.go @@ -0,0 +1,94 @@ +/* +Copyright 2019 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// TaskRunLister helps list TaskRuns. +type TaskRunLister interface { + // List lists all TaskRuns in the indexer. + List(selector labels.Selector) (ret []*v1alpha2.TaskRun, err error) + // TaskRuns returns an object that can list and get TaskRuns. + TaskRuns(namespace string) TaskRunNamespaceLister + TaskRunListerExpansion +} + +// taskRunLister implements the TaskRunLister interface. +type taskRunLister struct { + indexer cache.Indexer +} + +// NewTaskRunLister returns a new TaskRunLister. +func NewTaskRunLister(indexer cache.Indexer) TaskRunLister { + return &taskRunLister{indexer: indexer} +} + +// List lists all TaskRuns in the indexer. +func (s *taskRunLister) List(selector labels.Selector) (ret []*v1alpha2.TaskRun, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.TaskRun)) + }) + return ret, err +} + +// TaskRuns returns an object that can list and get TaskRuns. +func (s *taskRunLister) TaskRuns(namespace string) TaskRunNamespaceLister { + return taskRunNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// TaskRunNamespaceLister helps list and get TaskRuns. +type TaskRunNamespaceLister interface { + // List lists all TaskRuns in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha2.TaskRun, err error) + // Get retrieves the TaskRun from the indexer for a given namespace and name. + Get(name string) (*v1alpha2.TaskRun, error) + TaskRunNamespaceListerExpansion +} + +// taskRunNamespaceLister implements the TaskRunNamespaceLister +// interface. +type taskRunNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all TaskRuns in the indexer for a given namespace. +func (s taskRunNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.TaskRun, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.TaskRun)) + }) + return ret, err +} + +// Get retrieves the TaskRun from the indexer for a given namespace and name. +func (s taskRunNamespaceLister) Get(name string) (*v1alpha2.TaskRun, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha2.Resource("taskrun"), name) + } + return obj.(*v1alpha2.TaskRun), nil +} diff --git a/pkg/reconciler/pipelinerun/pipelinerun.go b/pkg/reconciler/pipelinerun/pipelinerun.go index d3f6e086b1c..c9a8d69e499 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun.go +++ b/pkg/reconciler/pipelinerun/pipelinerun.go @@ -546,7 +546,7 @@ func (c *Reconciler) createTaskRun(rprt *resources.ResolvedPipelineRunTask, pr * Kind: rprt.ResolvedTaskResources.Kind, }, Inputs: v1alpha1.TaskRunInputs{ - Params: rprt.PipelineTask.Params, + DeprecatedParams: rprt.PipelineTask.Params, }, ServiceAccountName: pr.GetServiceAccountName(rprt.PipelineTask.Name), Timeout: getTaskRunTimeout(pr), @@ -671,8 +671,8 @@ func (c *Reconciler) makeConditionCheckContainer(rprt *resources.ResolvedPipelin TaskSpec: taskSpec, ServiceAccountName: pr.GetServiceAccountName(rprt.PipelineTask.Name), Inputs: v1alpha1.TaskRunInputs{ - Params: rcc.PipelineTaskCondition.Params, - Resources: rcc.ToTaskResourceBindings(), + DeprecatedParams: rcc.PipelineTaskCondition.Params, + Resources: rcc.ToTaskResourceBindings(), }, Timeout: getTaskRunTimeout(pr), PodTemplate: pr.Spec.PodTemplate, diff --git a/pkg/reconciler/pipelinerun/resources/conditionresolution.go b/pkg/reconciler/pipelinerun/resources/conditionresolution.go index b6396039a8e..2b8151a4d91 100644 --- a/pkg/reconciler/pipelinerun/resources/conditionresolution.go +++ b/pkg/reconciler/pipelinerun/resources/conditionresolution.go @@ -101,7 +101,7 @@ func (rcc *ResolvedConditionCheck) ConditionToTaskSpec() (*v1alpha1.TaskSpec, er } t.Inputs = &v1alpha1.Inputs{ - Params: rcc.Condition.Spec.Params, + DeprecatedParams: rcc.Condition.Spec.Params, } for _, r := range rcc.Condition.Spec.Resources { diff --git a/pkg/reconciler/taskrun/resources/apply.go b/pkg/reconciler/taskrun/resources/apply.go index 730fb9c519d..a245a643f6e 100644 --- a/pkg/reconciler/taskrun/resources/apply.go +++ b/pkg/reconciler/taskrun/resources/apply.go @@ -42,7 +42,7 @@ func ApplyParameters(spec *v1alpha1.TaskSpec, tr *v1alpha1.TaskRun, defaults ... } } // Set and overwrite params with the ones from the TaskRun - for _, p := range tr.Spec.Inputs.Params { + for _, p := range tr.Spec.Inputs.DeprecatedParams { if p.Value.Type == v1alpha1.ParamTypeString { stringReplacements[fmt.Sprintf("inputs.params.%s", p.Name)] = p.Value.StringVal } else { diff --git a/pkg/reconciler/taskrun/taskrun.go b/pkg/reconciler/taskrun/taskrun.go index 9ac0e74bab0..27faf396f81 100644 --- a/pkg/reconciler/taskrun/taskrun.go +++ b/pkg/reconciler/taskrun/taskrun.go @@ -28,6 +28,7 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha2" listers "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1" "github.com/tektoncd/pipeline/pkg/reconciler" "github.com/tektoncd/pipeline/pkg/reconciler/taskrun/entrypoint" @@ -230,6 +231,11 @@ func (c *Reconciler) reconcile(ctx context.Context, tr *v1alpha1.TaskRun) error // and may not have had all of the assumed default specified. tr.SetDefaults(v1alpha1.WithUpgradeViaDefaulting(ctx)) + if err := tr.ConvertUp(ctx, &v1alpha2.TaskRun{}); err != nil { + // FIXME(vdemeester) handle cannot convert errors + return err + } + // If the taskrun is cancelled, kill resources and update status if tr.IsCancelled() { before := tr.Status.GetCondition(apis.ConditionSucceeded) @@ -295,7 +301,7 @@ func (c *Reconciler) reconcile(ctx context.Context, tr *v1alpha1.TaskRun) error return nil } - if err := ValidateResolvedTaskResources(tr.Spec.Inputs.Params, rtr); err != nil { + if err := ValidateResolvedTaskResources(tr.Spec.Inputs.DeprecatedParams, rtr); err != nil { c.Logger.Errorf("Failed to validate taskrun %q: %v", tr.Name, err) tr.Status.SetCondition(&apis.Condition{ Type: apis.ConditionSucceeded, @@ -501,7 +507,7 @@ func (c *Reconciler) createPod(tr *v1alpha1.TaskRun, rtr *resources.ResolvedTask var defaults []v1alpha1.ParamSpec if ts.Inputs != nil { - defaults = append(defaults, ts.Inputs.Params...) + defaults = append(defaults, ts.Inputs.DeprecatedParams...) } // Apply parameter substitution from the taskrun. ts = resources.ApplyParameters(ts, tr, defaults...) diff --git a/pkg/reconciler/taskrun/validate_resources.go b/pkg/reconciler/taskrun/validate_resources.go index defd3a391a2..3a282990877 100644 --- a/pkg/reconciler/taskrun/validate_resources.go +++ b/pkg/reconciler/taskrun/validate_resources.go @@ -67,8 +67,8 @@ func validateParams(inputs *v1alpha1.Inputs, params []v1alpha1.Param) error { var neededParams []string paramTypes := make(map[string]v1alpha1.ParamType) if inputs != nil { - neededParams = make([]string, 0, len(inputs.Params)) - for _, inputResourceParam := range inputs.Params { + neededParams = make([]string, 0, len(inputs.DeprecatedParams)) + for _, inputResourceParam := range inputs.DeprecatedParams { neededParams = append(neededParams, inputResourceParam.Name) paramTypes[inputResourceParam.Name] = inputResourceParam.Type } @@ -80,7 +80,7 @@ func validateParams(inputs *v1alpha1.Inputs, params []v1alpha1.Param) error { missingParams := list.DiffLeft(neededParams, providedParams) var missingParamsNoDefaults []string for _, param := range missingParams { - for _, inputResourceParam := range inputs.Params { + for _, inputResourceParam := range inputs.DeprecatedParams { if inputResourceParam.Name == param && inputResourceParam.Default == nil { missingParamsNoDefaults = append(missingParamsNoDefaults, param) } diff --git a/test/builder/task.go b/test/builder/task.go index 54e89604614..83b82c19b80 100644 --- a/test/builder/task.go +++ b/test/builder/task.go @@ -264,7 +264,7 @@ func InputsParamSpec(name string, pt v1alpha1.ParamType, ops ...ParamSpecOp) Inp for _, op := range ops { op(ps) } - i.Params = append(i.Params, *ps) + i.DeprecatedParams = append(i.DeprecatedParams, *ps) } } @@ -545,7 +545,7 @@ func TaskRunInputs(ops ...TaskRunInputsOp) TaskRunSpecOp { func TaskRunInputsParam(name, value string, additionalValues ...string) TaskRunInputsOp { arrayOrString := ArrayOrString(value, additionalValues...) return func(i *v1alpha1.TaskRunInputs) { - i.Params = append(i.Params, v1alpha1.Param{ + i.DeprecatedParams = append(i.DeprecatedParams, v1alpha1.Param{ Name: name, Value: *arrayOrString, }) diff --git a/third_party/VENDOR-LICENSE b/third_party/VENDOR-LICENSE index f056baf91b3..e69de29bb2d 100644 --- a/third_party/VENDOR-LICENSE +++ b/third_party/VENDOR-LICENSE @@ -1,9555 +0,0 @@ - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/cloud.google.com/go - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/contrib.go.opencensus.io/exporter/prometheus - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/contrib.go.opencensus.io/exporter/stackdriver - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/Azure/azure-sdk-for-go - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2016 Microsoft Corporation - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/Azure/go-autorest - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2015 Microsoft Corporation - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/aws/aws-sdk-go - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/beorn7/perks - -Copyright (C) 2013 Blake Mizerany - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/census-instrumentation/opencensus-proto - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/cloudevents/sdk-go - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/davecgh/go-spew - -ISC License - -Copyright (c) 2012-2016 Dave Collins - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/dgrijalva/jwt-go - -Copyright (c) 2012 Dave Grijalva - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/evanphx/json-patch - -Copyright (c) 2014, Evan Phoenix -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. -* Neither the name of the Evan Phoenix nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/ghodss/yaml - -The MIT License (MIT) - -Copyright (c) 2014 Sam Ghods - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - -Copyright (c) 2012 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/gobuffalo/envy - -The MIT License (MIT) - -Copyright (c) 2019 Mark Bates - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/gogo/protobuf - -Protocol Buffers for Go with Gadgets - -Copyright (c) 2013, The GoGo Authors. All rights reserved. -http://github.com/gogo/protobuf - -Go support for Protocol Buffers - Google's data interchange format - -Copyright 2010 The Go Authors. All rights reserved. -https://github.com/golang/protobuf - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/golang/glog - -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/golang/groupcache - -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/golang/protobuf - -Copyright 2010 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/google/btree - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/google/go-cmp - -Copyright (c) 2017 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/google/go-containerregistry - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/google/go-github - -Copyright (c) 2013 The go-github AUTHORS. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/google/go-querystring - -Copyright (c) 2013 Google. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/google/gofuzz - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/google/uuid - -Copyright (c) 2009,2014 Google Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/googleapis/gax-go - -Copyright 2016, Google Inc. -All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/googleapis/gnostic - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/gorilla/mux - -Copyright (c) 2012-2018 The Gorilla Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/gregjones/httpcache - -Copyright © 2012 Greg Jones (greg.jones@gmail.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/hashicorp/errwrap - -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. - - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/hashicorp/go-multierror - -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/hashicorp/golang-lru - -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. "Contributor" - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. "Contributor Version" - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the terms of - a Secondary License. - -1.6. "Executable Form" - - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - - means a work that combines Covered Software with other material, in a - separate file or files, that is not Covered Software. - -1.8. "License" - - means this document. - -1.9. "Licensable" - - means having the right to grant, to the maximum extent possible, whether - at the time of the initial grant or subsequently, any and all of the - rights conveyed by this License. - -1.10. "Modifications" - - means any of the following: - - a. any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. "Patent Claims" of a Contributor - - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the License, - by the making, using, selling, offering for sale, having made, import, - or transfer of either its Contributions or its Contributor Version. - -1.12. "Secondary License" - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. "Source Code Form" - - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, "control" means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution - become effective for each Contribution on the date the Contributor first - distributes such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under - this License. No additional rights or licenses will be implied from the - distribution or licensing of Covered Software under this License. - Notwithstanding Section 2.1(b) above, no patent license is granted by a - Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of - its Contributions. - - This License does not grant any rights in the trademarks, service marks, - or logos of any Contributor (except as may be necessary to comply with - the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this - License (see Section 10.2) or under the terms of a Secondary License (if - permitted under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its - Contributions are its original creation(s) or it has sufficient rights to - grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under - applicable copyright doctrines of fair use, fair dealing, or other - equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under - the terms of this License. You must inform recipients that the Source - Code Form of the Covered Software is governed by the terms of this - License, and how they can obtain a copy of this License. You may not - attempt to alter or restrict the recipients' rights in the Source Code - Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter the - recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for - the Covered Software. If the Larger Work is a combination of Covered - Software with a work governed by one or more Secondary Licenses, and the - Covered Software is not Incompatible With Secondary Licenses, this - License permits You to additionally distribute such Covered Software - under the terms of such Secondary License(s), so that the recipient of - the Larger Work may, at their option, further distribute the Covered - Software under the terms of either this License or such Secondary - License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices - (including copyright notices, patent notices, disclaimers of warranty, or - limitations of liability) contained within the Source Code Form of the - Covered Software, except that You may alter any license notices to the - extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on - behalf of any Contributor. You must make it absolutely clear that any - such warranty, support, indemnity, or liability obligation is offered by - You alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, - judicial order, or regulation then You must: (a) comply with the terms of - this License to the maximum extent possible; and (b) describe the - limitations and the code they affect. Such description must be placed in a - text file included with all distributions of the Covered Software under - this License. Except to the extent prohibited by statute or regulation, - such description must be sufficiently detailed for a recipient of ordinary - skill to be able to understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing - basis, if such Contributor fails to notify You of the non-compliance by - some reasonable means prior to 60 days after You have come back into - compliance. Moreover, Your grants from a particular Contributor are - reinstated on an ongoing basis if such Contributor notifies You of the - non-compliance by some reasonable means, this is the first time You have - received notice of non-compliance with this License from such - Contributor, and You become compliant prior to 30 days after Your receipt - of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, - counter-claims, and cross-claims) alleging that a Contributor Version - directly or indirectly infringes any patent, then the rights granted to - You by any and all Contributors for the Covered Software under Section - 2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an "as is" basis, - without warranty of any kind, either expressed, implied, or statutory, - including, without limitation, warranties that the Covered Software is free - of defects, merchantable, fit for a particular purpose or non-infringing. - The entire risk as to the quality and performance of the Covered Software - is with You. Should any Covered Software prove defective in any respect, - You (not any Contributor) assume the cost of any necessary servicing, - repair, or correction. This disclaimer of warranty constitutes an essential - part of this License. No use of any Covered Software is authorized under - this License except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from - such party's negligence to the extent applicable law prohibits such - limitation. Some jurisdictions do not allow the exclusion or limitation of - incidental or consequential damages, so this exclusion and limitation may - not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts - of a jurisdiction where the defendant maintains its principal place of - business and such litigation shall be governed by laws of that - jurisdiction, without reference to its conflict-of-law provisions. Nothing - in this Section shall prevent a party's ability to bring cross-claims or - counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. Any law or regulation which provides that - the language of a contract shall be construed against the drafter shall not - be used to construe this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version - of the License under which You originally received the Covered Software, - or under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a - modified version of this License if you rename the license and remove - any references to the name of the license steward (except to note that - such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary - Licenses If You choose to distribute Source Code Form that is - Incompatible With Secondary Licenses under the terms of this version of - the License, the notice described in Exhibit B of this License must be - attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, -then You may include the notice in a location (such as a LICENSE file in a -relevant directory) where a recipient would be likely to look for such a -notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice - - This Source Code Form is "Incompatible - With Secondary Licenses", as defined by - the Mozilla Public License, v. 2.0. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/imdario/mergo - -Copyright (c) 2013 Dario Castañé. All rights reserved. -Copyright (c) 2012 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/jmespath/go-jmespath - -Copyright 2015 James Saryerwinnie - -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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/joho/godotenv - -Copyright (c) 2013 John Barton - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/json-iterator/go - -MIT License - -Copyright (c) 2016 json-iterator - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/markbates/inflect - -Copyright (c) 2011 Chris Farmiloe - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/mattbaird/jsonpatch - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - 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. - - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/matttproud/golang_protobuf_extensions - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/mitchellh/go-homedir - -The MIT License (MIT) - -Copyright (c) 2013 Mitchell Hashimoto - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/modern-go/concurrent - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/modern-go/reflect2 - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/mohae/deepcopy - -The MIT License (MIT) - -Copyright (c) 2014 Joel - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/mohae/deepcopy - -The MIT License (MIT) - -Copyright (c) 2014 Joel - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/peterbourgon/diskv - -Copyright (c) 2011-2012 Peter Bourgon - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/pkg/errors - -Copyright (c) 2015, Dave Cheney -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/prometheus/client_golang - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/prometheus/client_model - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/prometheus/common - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/prometheus/procfs - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/rogpeppe/go-internal - -Copyright (c) 2018 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/github.com/spf13/pflag - -Copyright (c) 2012 Alex Ogier. All rights reserved. -Copyright (c) 2012 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/go.opencensus.io - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/go.uber.org/atomic - -Copyright (c) 2016 Uber Technologies, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/go.uber.org/multierr - -Copyright (c) 2017 Uber Technologies, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/go.uber.org/zap - -Copyright (c) 2016-2017 Uber Technologies, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/golang.org/x/crypto - -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/golang.org/x/net - -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/golang.org/x/oauth2 - -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/golang.org/x/sync - -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/golang.org/x/sys - -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/golang.org/x/text - -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/golang.org/x/time - -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/golang.org/x/xerrors - -Copyright (c) 2019 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/google.golang.org/api - -Copyright (c) 2011 Google Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/google.golang.org/genproto - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/google.golang.org/grpc - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/gopkg.in/inf.v0 - -Copyright (c) 2012 Péter Surányi. Portions Copyright (c) 2009 The Go -Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/gopkg.in/yaml.v2 - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/k8s.io/api - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/k8s.io/apimachinery - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/k8s.io/client-go - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/k8s.io/klog - -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/k8s.io/kube-openapi - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/k8s.io/kubernetes - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/knative.dev/caching - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/knative.dev/eventing-contrib - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/knative.dev/pkg - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - -=========================================================== -Import: github.com/tektoncd/pipeline/vendor/sigs.k8s.io/yaml - -The MIT License (MIT) - -Copyright (c) 2014 Sam Ghods - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - -Copyright (c) 2012 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -