From 534733820eb9fad50d1a8942eaec4ecc161d02b6 Mon Sep 17 00:00:00 2001 From: Andrew Bayer Date: Wed, 12 Jun 2019 13:13:39 -0400 Subject: [PATCH] fix(tekton): Set a default PipelineRun timeout of 10 days Starting in Tekton Pipelines v0.4.0, the default timeout for `TaskRun`s of 10 minutes when no timeout is specified is actually enforced. The only way to specify a timeout for a `TaskRun` is by setting a timeout on the `PipelineRun`, so until https://github.com/tektoncd/pipeline/issues/978 and/or https://github.com/tektoncd/pipeline/issues/979 are addressed, we should just set a ridiculously high timeout on all `PipelineRun`s. Signed-off-by: Andrew Bayer --- pkg/cmd/step/create/step_create_task_test.go | 2 ++ .../add-env-to-default-in-buildpack/pipelinerun.yml | 3 ++- .../pipelinerun.yml | 3 ++- .../append-and-prepend-stage-steps/pipelinerun.yml | 1 + .../command-as-multiline-script/pipelinerun.yml | 3 ++- .../containeroptions-on-pipelineconfig/pipelinerun.yml | 1 + .../correct-pipeline-stage-is-removed/pipelinerun.yml | 3 ++- .../step_create_task/default-in-buildpack/pipelinerun.yml | 3 ++- .../step_create_task/default-in-jenkins-x-yml/pipelinerun.yml | 3 ++- .../test_data/step_create_task/from_yaml/pipelinerun.yml | 4 +++- .../test_data/step_create_task/js_build_pack/pipelinerun.yml | 3 ++- .../step_create_task/kaniko_entrypoint/pipelinerun.yml | 3 ++- .../step_create_task/loop-in-buildpack-syntax/pipelinerun.yml | 3 ++- .../step_create_task/maven_build_pack/pipelinerun.yml | 1 + .../override-agent-container-with-build-pack/pipelinerun.yml | 3 ++- .../override-default-in-buildpack/pipelinerun.yml | 3 ++- .../override-default-in-jenkins-x-yml/pipelinerun.yml | 3 ++- .../test_data/step_create_task/override-steps/pipelinerun.yml | 3 ++- .../step_create_task/override_block_step/pipelinerun.yml | 3 ++- .../per_step_container_build_pack/pipelinerun.yml | 1 + .../remove-stage-from-jenkins-x-yml/pipelinerun.yml | 3 ++- .../test_data/step_create_task/remove-stage/pipelinerun.yml | 1 + .../replace-stage-steps-in-jenkins-x-yml/pipelinerun.yml | 3 ++- .../step_create_task/replace-stage-steps/pipelinerun.yml | 1 + .../pipelinerun.yml | 3 ++- pkg/tekton/pipelines.go | 2 ++ 26 files changed, 47 insertions(+), 18 deletions(-) diff --git a/pkg/cmd/step/create/step_create_task_test.go b/pkg/cmd/step/create/step_create_task_test.go index 6537e85329..ef693bdd3e 100644 --- a/pkg/cmd/step/create/step_create_task_test.go +++ b/pkg/cmd/step/create/step_create_task_test.go @@ -380,6 +380,8 @@ func TestGenerateTektonCRDs(t *testing.T) { } if d := cmp.Diff(tekton_helpers_test.AssertLoadPipelineRun(t, caseDir), crds.PipelineRun()); d != "" { + pry, _ := yaml.Marshal(crds.PipelineRun()) + t.Logf("PR: %s", pry) t.Errorf("Generated PipelineRun did not match expected: %s", d) } if d := cmp.Diff(tekton_helpers_test.AssertLoadPipelineStructure(t, caseDir), crds.Structure()); d != "" { diff --git a/pkg/cmd/step/create/test_data/step_create_task/add-env-to-default-in-buildpack/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/add-env-to-default-in-buildpack/pipelinerun.yml index 8a1b78a6d7..6843cf6c82 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/add-env-to-default-in-buildpack/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/add-env-to-default-in-buildpack/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-golang-qs-test-master serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/append-and-prepend-stage-steps-in-jenkins-x-yml/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/append-and-prepend-stage-steps-in-jenkins-x-yml/pipelinerun.yml index 22928c07b3..2d6ce8f68a 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/append-and-prepend-stage-steps-in-jenkins-x-yml/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/append-and-prepend-stage-steps-in-jenkins-x-yml/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-js-test-repo-really-long serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/append-and-prepend-stage-steps/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/append-and-prepend-stage-steps/pipelinerun.yml index 1deed49cb0..0eab2380ae 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/append-and-prepend-stage-steps/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/append-and-prepend-stage-steps/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-jx-demo-qs-master serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/command-as-multiline-script/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/command-as-multiline-script/pipelinerun.yml index 22928c07b3..2d6ce8f68a 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/command-as-multiline-script/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/command-as-multiline-script/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-js-test-repo-really-long serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/containeroptions-on-pipelineconfig/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/containeroptions-on-pipelineconfig/pipelinerun.yml index 1deed49cb0..0eab2380ae 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/containeroptions-on-pipelineconfig/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/containeroptions-on-pipelineconfig/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-jx-demo-qs-master serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/correct-pipeline-stage-is-removed/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/correct-pipeline-stage-is-removed/pipelinerun.yml index 22928c07b3..2d6ce8f68a 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/correct-pipeline-stage-is-removed/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/correct-pipeline-stage-is-removed/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-js-test-repo-really-long serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/default-in-buildpack/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/default-in-buildpack/pipelinerun.yml index 8a1b78a6d7..6843cf6c82 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/default-in-buildpack/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/default-in-buildpack/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-golang-qs-test-master serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/default-in-jenkins-x-yml/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/default-in-jenkins-x-yml/pipelinerun.yml index 22928c07b3..2d6ce8f68a 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/default-in-jenkins-x-yml/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/default-in-jenkins-x-yml/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-js-test-repo-really-long serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/from_yaml/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/from_yaml/pipelinerun.yml index 22928c07b3..1d06089cd6 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/from_yaml/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/from_yaml/pipelinerun.yml @@ -20,6 +20,8 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-js-test-repo-really-long serviceAccount: tekton-bot + timeout: 240h0m0s + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/js_build_pack/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/js_build_pack/pipelinerun.yml index 6b372df835..f4edf3baaa 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/js_build_pack/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/js_build_pack/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-js-test-repo-build-pack serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual - status: {} \ No newline at end of file + status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/kaniko_entrypoint/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/kaniko_entrypoint/pipelinerun.yml index db9ae950c5..6913915a1d 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/kaniko_entrypoint/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/kaniko_entrypoint/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: jenkins-x-jx-fix-kaniko-special serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/loop-in-buildpack-syntax/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/loop-in-buildpack-syntax/pipelinerun.yml index dd32a5a247..0eab2380ae 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/loop-in-buildpack-syntax/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/loop-in-buildpack-syntax/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-jx-demo-qs-master serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/maven_build_pack/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/maven_build_pack/pipelinerun.yml index 1deed49cb0..0eab2380ae 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/maven_build_pack/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/maven_build_pack/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-jx-demo-qs-master serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/override-agent-container-with-build-pack/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/override-agent-container-with-build-pack/pipelinerun.yml index 876c0f1b77..b95bddbbba 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/override-agent-container-with-build-pack/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/override-agent-container-with-build-pack/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-js-test-repo-override-de serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/override-default-in-buildpack/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/override-default-in-buildpack/pipelinerun.yml index 8a1b78a6d7..6843cf6c82 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/override-default-in-buildpack/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/override-default-in-buildpack/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-golang-qs-test-master serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/override-default-in-jenkins-x-yml/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/override-default-in-jenkins-x-yml/pipelinerun.yml index 22928c07b3..2d6ce8f68a 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/override-default-in-jenkins-x-yml/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/override-default-in-jenkins-x-yml/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-js-test-repo-really-long serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/override-steps/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/override-steps/pipelinerun.yml index dd32a5a247..0eab2380ae 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/override-steps/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/override-steps/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-jx-demo-qs-master serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/override_block_step/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/override_block_step/pipelinerun.yml index 8a1b78a6d7..6843cf6c82 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/override_block_step/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/override_block_step/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-golang-qs-test-master serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/per_step_container_build_pack/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/per_step_container_build_pack/pipelinerun.yml index fff1127899..6843cf6c82 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/per_step_container_build_pack/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/per_step_container_build_pack/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-golang-qs-test-master serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/remove-stage-from-jenkins-x-yml/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/remove-stage-from-jenkins-x-yml/pipelinerun.yml index 22928c07b3..2d6ce8f68a 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/remove-stage-from-jenkins-x-yml/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/remove-stage-from-jenkins-x-yml/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-js-test-repo-really-long serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/remove-stage/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/remove-stage/pipelinerun.yml index 1deed49cb0..0eab2380ae 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/remove-stage/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/remove-stage/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-jx-demo-qs-master serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/replace-stage-steps-in-jenkins-x-yml/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/replace-stage-steps-in-jenkins-x-yml/pipelinerun.yml index 22928c07b3..2d6ce8f68a 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/replace-stage-steps-in-jenkins-x-yml/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/replace-stage-steps-in-jenkins-x-yml/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-js-test-repo-really-long serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/replace-stage-steps/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/replace-stage-steps/pipelinerun.yml index 1deed49cb0..0eab2380ae 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/replace-stage-steps/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/replace-stage-steps/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-jx-demo-qs-master serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual status: {} diff --git a/pkg/cmd/step/create/test_data/step_create_task/set-agent-container-with-agentless-build-pack/pipelinerun.yml b/pkg/cmd/step/create/test_data/step_create_task/set-agent-container-with-agentless-build-pack/pipelinerun.yml index 66dfce5e78..97776244c3 100755 --- a/pkg/cmd/step/create/test_data/step_create_task/set-agent-container-with-agentless-build-pack/pipelinerun.yml +++ b/pkg/cmd/step/create/test_data/step_create_task/set-agent-container-with-agentless-build-pack/pipelinerun.yml @@ -20,6 +20,7 @@ spec: apiVersion: tekton.dev/v1alpha1 name: abayer-js-test-repo-no-default serviceAccount: tekton-bot + timeout: 240h0m0s trigger: type: manual -status: {} \ No newline at end of file +status: {} diff --git a/pkg/tekton/pipelines.go b/pkg/tekton/pipelines.go index 6acd07ad8d..789ee20ac0 100644 --- a/pkg/tekton/pipelines.go +++ b/pkg/tekton/pipelines.go @@ -221,6 +221,8 @@ func CreatePipelineRun(resources []*pipelineapi.PipelineResource, }, Resources: resourceBindings, Params: pipelineParams, + // TODO: This should be configurable, and we shouldn't have to set a timeout in the first place. See https://github.com/tektoncd/pipeline/issues/978 + Timeout: &metav1.Duration{ Duration: 240 * time.Hour}, }, }