Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ability to Specify PodTemplate for TaskRun/PipelineRun #1088

Merged
merged 1 commit into from
Aug 10, 2020
Merged

Add Ability to Specify PodTemplate for TaskRun/PipelineRun #1088

merged 1 commit into from
Aug 10, 2020

Conversation

danielhelfand
Copy link
Member

@danielhelfand danielhelfand commented Jul 29, 2020

Closes #668

This pull request adds the ability to specify PodTemplate properties supported by pipelines via a local or remote file definition as shown below:

tkn t start task1 --pod-template ./local/file.yaml

tkn p start pipeline1 --pod-template https:/user/repo/file.yaml

An example file definition is shown below:

schedulerName: SchedulerName
securityContext:
  runAsNonRoot: true
  runAsUser: 1001

In addition to adding support for PodTemplates, this pull request includes some refactoring of the file package to remove its dependency on the cli package.

NOTE: This will not work with v1alpha1 only versions of pipelines until the pipeline dependency is updated to include tektoncd/pipeline#3032.

Submitter Checklist

  • Includes tests (if functionality changed/added)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

Release Notes

Adds ability to specify PodTemplate properties via a local or remote file definition for TaskRuns/PipelineRuns

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jul 29, 2020
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jul 29, 2020
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/clustertask/start.go 91.2% 91.0% -0.2
pkg/cmd/pipeline/start.go 67.3% 67.6% 0.3
pkg/cmd/task/start.go 82.1% 82.2% 0.1
pkg/file/file.go 55.9% 51.7% -4.2
pkg/pods/pod_template.go Do not exist 100.0%

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/clustertask/start.go 79.8% 80.0% 0.2
pkg/cmd/pipeline/start.go 67.3% 67.6% 0.3
pkg/cmd/task/start.go 82.1% 82.2% 0.1
pkg/file/file.go 55.9% 51.7% -4.2
pkg/pods/pod_template.go Do not exist 100.0%

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/clustertask/start.go 79.8% 80.0% 0.2
pkg/cmd/pipeline/start.go 67.3% 67.6% 0.3
pkg/cmd/task/start.go 82.1% 82.2% 0.1
pkg/file/file.go 55.9% 51.7% -4.2
pkg/pods/pod_template.go Do not exist 100.0%

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/clustertask/start.go 79.8% 80.0% 0.2
pkg/cmd/pipeline/start.go 67.3% 67.6% 0.3
pkg/cmd/task/start.go 82.1% 82.2% 0.1
pkg/file/file.go 55.9% 51.7% -4.2
pkg/pods/pod_template.go Do not exist 100.0%

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/clustertask/start.go 79.8% 80.0% 0.2
pkg/cmd/pipeline/start.go 67.3% 67.6% 0.3
pkg/cmd/task/start.go 82.1% 82.2% 0.1
pkg/file/file.go 55.9% 51.7% -4.2
pkg/pods/pod_template.go Do not exist 100.0%

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/clustertask/start.go 79.8% 80.0% 0.2
pkg/cmd/pipeline/start.go 67.3% 67.6% 0.3
pkg/cmd/task/start.go 82.1% 82.2% 0.1
pkg/file/file.go 55.9% 51.7% -4.2
pkg/pods/pod_template.go Do not exist 100.0%

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/clustertask/start.go 79.8% 80.0% 0.2
pkg/cmd/pipeline/start.go 67.3% 67.6% 0.3
pkg/cmd/task/start.go 82.1% 82.2% 0.1
pkg/file/file.go 55.9% 51.7% -4.2
pkg/pods/pod_template.go Do not exist 100.0%

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/clustertask/start.go 79.8% 80.0% 0.2
pkg/cmd/pipeline/start.go 67.3% 67.6% 0.3
pkg/cmd/task/start.go 82.1% 82.2% 0.1
pkg/file/file.go 55.9% 51.7% -4.2
pkg/pods/pod_template.go Do not exist 100.0%

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/clustertask/start.go 79.8% 80.0% 0.2
pkg/cmd/pipeline/start.go 67.3% 67.6% 0.3
pkg/cmd/task/start.go 82.1% 82.2% 0.1
pkg/file/file.go 55.9% 51.7% -4.2
pkg/pods/pod_template.go Do not exist 100.0%

@danielhelfand danielhelfand changed the title WIP: Add Ability to Specify PodTemplate for TaskRun/PipelineRun Add Ability to Specify PodTemplate for TaskRun/PipelineRun Jul 31, 2020
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 31, 2020
Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 31, 2020
@danielhelfand danielhelfand added this to the 0.12.0 milestone Aug 4, 2020
Copy link
Contributor

@pradeepitm12 pradeepitm12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/meow

@tekton-robot
Copy link
Contributor

@vdemeester: cat image

In response to this:

/meow

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 10, 2020
@danielhelfand
Copy link
Member Author

Failure seems to be a timing issue getting the correct PipelineRun. The actual PipelineRun for the --pod-template test fails as expected:

 ---
        typemeta:
          kind: PipelineRun
          apiversion: tekton.dev/v1alpha1
        objectmeta:
          name: output-pipeline-run-tfgbk
          generatename: output-pipeline-run-
          namespace: testcli-f5n5m
          selflink: /apis/tekton.dev/v1alpha1/namespaces/testcli-f5n5m/pipelineruns/output-pipeline-run-tfgbk
          uid: e935c08f-150c-440e-9aa3-34404ff19d5c
          resourceversion: "3983"
          generation: 1
          creationtimestamp: "2020-08-10T14:35:38Z"
          deletiontimestamp: null
          deletiongraceperiodseconds: null
          labels:
            tekton.dev/pipeline: output-pipeline
          annotations: {}
          ownerreferences: []
          finalizers: []
          clustername: ""
          managedfields: []
        spec:
          pipelineref:
            name: output-pipeline
            apiversion: ""
          pipelinespec: null
          resources:
          - name: source-repo
            resourceref:
              name: skaffold-git
              apiversion: ""
            resourcespec: null
          params: []
          serviceaccountname: ""
          serviceaccountnames: []
          status: ""
          timeout:
            duration: 1h0m0s
          podtemplate:
            nodeselector: {}
            tolerations: []
            affinity: null
            securitycontext:
              selinuxoptions: null
              windowsoptions: null
              runasuser: 1001
              runasgroup: null
              runasnonroot: true
              supplementalgroups: []
              fsgroup: null
              sysctls: []
            volumes: []
            runtimeclassname: null
            automountserviceaccounttoken: null
            dnspolicy: null
            dnsconfig: null
            enableservicelinks: null
            priorityclassname: null
            schedulername: ""
            imagepullsecrets: []
            hostnetwork: false
          workspaces: []
          taskrunspecs: []
        status:
          status:
            observedgeneration: 0
            conditions:
            - type: Succeeded
              status: "False"
              severity: ""
              lasttransitiontime:
                inner: "2020-08-10T14:36:04Z"
              reason: Failed
              message: 'Tasks Completed: 1 (Failed: 1, Cancelled 0), Skipped: 1'
          pipelinerunstatusfields:
            starttime: "2020-08-10T14:35:38Z"
            completiontime: "2020-08-10T14:36:04Z"
            taskruns:
              output-pipeline-run-tfgbk-first-create-file-lr658:
                pipelinetaskname: first-create-file
                status:
                  status:
                    observedgeneration: 0
                    conditions:
                    - type: Succeeded
                      status: "False"
                      severity: ""
                      lasttransitiontime:
                        inner: "2020-08-10T14:36:04Z"
                      reason: Failed
                      message: |
                        "step-source-mkdir-workspace-s9scb" exited with code 1 (image: "docker-pullable://gcr.io/distroless/base@sha256:60f5ffe6fc481e9102747b043b3873a01893a5a8138f970c5f5fc06fb7494656"); for logs run: kubectl -n testcli-f5n5m logs output-pipeline-run-tfgbk-first-create-file-lr658-pod-gmdhh -c step-source-mkdir-workspace-s9scb
                  taskrunstatusfields:
                    podname: output-pipeline-run-tfgbk-first-create-file-lr658-pod-gmdhh
                    starttime: "2020-08-10T14:35:38Z"
                    completiontime: "2020-08-10T14:36:04Z"
                    steps:
                    - containerstate:
                        waiting: null
                        running: null
                        terminated:
                          exitcode: 0
                          signal: 0
                          reason: Completed
                          message: ""
                          startedat: "2020-08-10T14:36:02Z"
                          finishedat: "2020-08-10T14:36:02Z"
                          containerid: docker://91ebe7f10e0f09472f3151343883c6ce740192eb1f5fdf48709cbe48708f6799
                      name: read-docs-old
                      containername: step-read-docs-old
                      imageid: docker-pullable://ubuntu@sha256:60f560e52264ed1cb7829a0d59b1ee7740d7580e0eb293aca2d722136edb1e24
                    - containerstate:
                        waiting: null
                        running: null
                        terminated:
                          exitcode: 0
                          signal: 0
                          reason: Completed
                          message: ""
                          startedat: "2020-08-10T14:36:02Z"
                          finishedat: "2020-08-10T14:36:02Z"
                          containerid: docker://57946c7bbc89cc2487c872d7d2e2937316fb1825c2321d0aa299a09e271c1ab9
                      name: write-new-stuff
                      containername: step-write-new-stuff
                      imageid: docker-pullable://ubuntu@sha256:60f560e52264ed1cb7829a0d59b1ee7740d7580e0eb293aca2d722136edb1e24
                    - containerstate:
                        waiting: null
                        running: null
                        terminated:
                          exitcode: 0
                          signal: 0
                          reason: Completed
                          message: ""
                          startedat: "2020-08-10T14:35:57Z"
                          finishedat: "2020-08-10T14:35:57Z"
                          containerid: docker://e7b23678a88a86340a3c5bc93b186507e6e3bc5e3eec90720ec87f3fe5365852
                      name: create-dir-workspace-l6tfm
                      containername: step-create-dir-workspace-l6tfm
                      imageid: docker-pullable://gcr.io/distroless/base@sha256:60f5ffe6fc481e9102747b043b3873a01893a5a8138f970c5f5fc06fb7494656
                    - containerstate:
                        waiting: null
                        running: null
                        terminated:
                          exitcode: 1
                          signal: 0
                          reason: Error
                          message: ""
                          startedat: "2020-08-10T14:36:02Z"
                          finishedat: "2020-08-10T14:36:03Z"
                          containerid: docker://452d4301dd84f849b045d4c25389769819e9b7115b1f95e4f8b1ac7be86d7b06
                      name: source-copy-workspace-hsrwz
                      containername: step-source-copy-workspace-hsrwz
                      imageid: docker-pullable://gcr.io/distroless/base@sha256:60f5ffe6fc481e9102747b043b3873a01893a5a8138f970c5f5fc06fb7494656
                    - containerstate:
                        waiting: null
                        running: null
                        terminated:
                          exitcode: 1
                          signal: 0
                          reason: Error
                          message: ""
                          startedat: "2020-08-10T14:36:02Z"
                          finishedat: "2020-08-10T14:36:02Z"
                          containerid: docker://6f227c0a62e03e2c6bc3a4d69afc8b8f909370717168828d97a0d21351aaad05
                      name: source-mkdir-workspace-s9scb
                      containername: step-source-mkdir-workspace-s9scb
                      imageid: docker-pullable://gcr.io/distroless/base@sha256:60f5ffe6fc481e9102747b043b3873a01893a5a8138f970c5f5fc06fb7494656
                    - containerstate:
                        waiting: null
                        running: null
                        terminated:
                          exitcode: 0
                          signal: 0
                          reason: Completed
                          message: '[{"key":"commit","value":"8e0dfe2a5253b45c9ef8f9e1ce7eecc1d1b7236c","resourceName":"workspace","resourceRef":{"name":"workspace"}}]'
                          startedat: "2020-08-10T14:35:58Z"
                          finishedat: "2020-08-10T14:36:02Z"
                          containerid: docker://ba67783da8c3dfbc0663e7e14dc1c1c3a4ac072a3adc5c55ef2aa98b66ccddf1
                      name: git-source-workspace-cc9qh
                      containername: step-git-source-workspace-cc9qh
                      imageid: docker-pullable://gcr.io/tekton-nightly/github.com/tektoncd/pipeline/cmd/git-init@sha256:220cee1ec7877ddbb8e3886cf75884929b4086f7d50b8e52104a0d74a417f8eb
                    cloudevents: []
                    retriesstatus: []
                    resourcesresult: []
                    taskrunresults: []
                    sidecars: []
                    taskspec:
                      resources:
                        inputs:
                        - resourcedeclaration:
                            name: workspace
                            type: git
                            description: ""
                            targetpath: damnworkspace
                            optional: false
                        outputs:
                        - resourcedeclaration:
                            name: workspace
                            type: git
                            description: ""
                            targetpath: ""
                            optional: false
                      params: []
                      description: ""
                      steps:
                      - container:
                          name: read-docs-old
                          image: ubuntu
                          command:
                          - /bin/bash
                          args:
                          - -c
                          - ls -la /workspace/damnworkspace/docs/README.md
                          workingdir: ""
                          ports: []
                          envfrom: []
                          env: []
                          resources:
                            limits: {}
                            requests: {}
                          volumemounts: []
                          volumedevices: []
                          livenessprobe: null
                          readinessprobe: null
                          startupprobe: null
                          lifecycle: null
                          terminationmessagepath: ""
                          terminationmessagepolicy: ""
                          imagepullpolicy: ""
                          securitycontext: null
                          stdin: false
                          stdinonce: false
                          tty: false
                        script: ""
                      - container:
                          name: write-new-stuff
                          image: ubuntu
                          command:
                          - bash
                          args:
                          - -c
                          - ln -s /workspace/damnworkspace /workspace/output/workspace && echo some stuff > /workspace/output/workspace/stuff
                          workingdir: ""
                          ports: []
                          envfrom: []
                          env: []
                          resources:
                            limits: {}
                            requests: {}
                          volumemounts: []
                          volumedevices: []
                          livenessprobe: null
                          readinessprobe: null
                          startupprobe: null
                          lifecycle: null
                          terminationmessagepath: ""
                          terminationmessagepolicy: ""
                          imagepullpolicy: ""
                          securitycontext: null
                          stdin: false
                          stdinonce: false
                          tty: false
                        script: ""
                      volumes: []
                      steptemplate: null
                      sidecars: []
                      workspaces: []
                      results: []
                conditionchecks: {}
            pipelineresults: []
            pipelinespec:
              description: ""
              resources:
              - name: source-repo
                type: git
                optional: false
              tasks:
              - name: first-create-file
                taskref:
                  name: create-file
                  kind: Task
                  apiversion: ""
                taskspec: null
                conditions: []
                retries: 0
                runafter: []
                resources:
                  inputs:
                  - name: workspace
                    resource: source-repo
                    from: []
                  outputs:
                  - name: workspace
                    resource: source-repo
                params: []
                workspaces: []
                timeout: null
              - name: then-check
                taskref:
                  name: check-stuff-file-exists
                  kind: Task
                  apiversion: ""
                taskspec: null
                conditions: []
                retries: 0
                runafter: []
                resources:
                  inputs:
                  - name: workspace
                    resource: source-repo
                    from:
                    - first-create-file
                  outputs: []
                params: []
                workspaces: []
                timeout: null
              params: []
              workspaces: []
              results: []
              finally: []

@danielhelfand
Copy link
Member Author

/test pull-tekton-cli-integration-tests

@tekton-robot tekton-robot merged commit ac555b8 into tektoncd:master Aug 10, 2020
danielhelfand added a commit that referenced this pull request Aug 27, 2020
#1084 | [Pradeep Kumar] update version in readme | 2020/07/24-16:56
#1044 | [pthangad] Organize e2e | 2020/07/24-21:25
#1076 | [chetan-rns] Display results in task/taskrun describe command | 2020/07/29-05:54
#1051 | [vinamra28] ClusterTask start interactive mode | 2020/07/30-15:51
#1101 | [Daniel Helfand] add new line for No ClusterTasks found output | 2020/08/04-11:02
#1105 | [vinamra28] Display Results in the output of ClusterTask describe command | 2020/08/05-21:43
#1088 | [Daniel Helfand] add ability to specify podtemplate for taskrun/pipelinerun | 2020/08/10-16:24
#1108 | [Daniel Helfand] add triggers installation for e2e tests | 2020/08/12-16:54
#1110 | [Divyansh42] Display results in the output of pipeline/pipelinerun describe command | 2020/08/12-22:29
#1110 | [Divyansh42] Modify e2e test for pipeline | 2020/08/12-22:29
null | [vinamra28] Add --use-param-defaults option for tkn clustertask start | 2020/08/17-14:46
null | [rudeigerc] Fix the display of 0 Value for Timeout with tkn tr/pr describe | 2020/08/17-15:08
null | [Daniel Helfand] add check for timeout status for pipelinerun and taskrun cancel | 2020/08/18-13:43
null | [Vincent Demeester] pkg/suggestions: print help and error out 🏢 | 2020/08/18-15:57
null | [Vincent Demeester] pkg/suggestions: no help on subcommand errors | 2020/08/18-17:27
null | [Pratik Jagrut] Add EventListener's AVAILABLE Status with tkn eventlistener list | 2020/08/18-19:31
null | [Piyush Garg] Bump pipeline dep to v0.15.2 | 2020/08/19-04:43
null | [Piyush Garg] Bump triggers dep to v0.7.0 | 2020/08/19-06:01
null | [Daniel Helfand] consistent error messaging for triggers commands | 2020/08/19-07:13
null | [rudeigerc] Throw error when deleting tr/pr with non-existing task/pipeline | 2020/08/19-07:32
null | [Daniel Helfand] copy over pipelinerun and taskrun spec for --last and use run options | 2020/08/24-06:46
null | [vinamra28] Display Workspaces in the output of ClusterTask describe command | 2020/08/25-15:02
null | [vinamra28] Display Workspaces in the output of Task describe command | 2020/08/25-15:02
null | [vinamra28] Display workspaces in the output of TaskRun describe command | 2020/08/25-15:02
null | [Piyush Garg] Refactor status formatting | 2020/08/25-17:04
null | [Divyansh42] Modify --use-param-defaults flag and add e2e test | 2020/08/26-05:23
null | [Piyush Garg] Refactor taskrun description | 2020/08/26-09:40
null | [vinamra28] Display Workspaces in the output of Pipeline describe command | 2020/08/26-11:15
null | [vinamra28] Display Workspaces in the output of PipelineRun describe command | 2020/08/26-11:15

Signed-off-by: Daniel Helfand <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specify Pod Template via tkn for TaskRuns/PipelineRuns
4 participants