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

Update PipelineSpec and TaskSpec fields of PipelineRun and TaskRun Status fields #4891

Conversation

chitrangpatel
Copy link
Contributor

@chitrangpatel chitrangpatel commented May 19, 2022

PipelineSpec was only stored in the PipelineRun Status field once, before any substitutions. The same thing was happening with the TaskSpec field of the TaskRun's Status (see here). As a result, after execution of the pipelinerun or taskrun, the (task/pipeline)specs of the status fields were not updated leading to confusion.

This commit also updates the TaskSpec and PipelineSpec of Status fields of TaskRun and PipelineRun, respectively, after application of the substitutions. As a result, the replacements are now visible in the run status. This PR addresses issue #4849.

Changes

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Docs included if any changes are user facing
  • Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Release notes block below has been filled in
    (if there are no user facing changes, use release note "NONE")

Release Notes

Update PipelineSpec and TaskSpec fields of PipelineRun and TaskRun Status fields

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label May 19, 2022
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 19, 2022
@chitrangpatel
Copy link
Contributor Author

/assign @jerop

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 86.2% 0.0

@chitrangpatel chitrangpatel force-pushed the Update-PipelineRun-TaskRun-Status-Specs branch from 1d7d0bb to a7e69c8 Compare May 20, 2022 15:13
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 86.2% 0.0
pkg/reconciler/taskrun/taskrun.go 80.2% 80.3% 0.2

@chitrangpatel
Copy link
Contributor Author

/retest

@jerop jerop added this to the Pipelines v0.36 milestone May 24, 2022
Copy link
Member

@jerop jerop left a comment

Choose a reason for hiding this comment

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

@chitrangpatel please add tests 🙏🏾

@chitrangpatel
Copy link
Contributor Author

chitrangpatel commented May 25, 2022

@chitrangpatel please add tests 🙏🏾

Hi @jerop, its hard to (or at least I dont know how yet) produce a unit test because a task run needs to be created from the pipeline run. Do you think an example file will suffice here?

@jerop jerop added the kind/bug Categorizes issue or PR as related to a bug. label May 25, 2022
@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 26, 2022
@chitrangpatel chitrangpatel force-pushed the Update-PipelineRun-TaskRun-Status-Specs branch from a7e69c8 to 1f44624 Compare May 26, 2022 21:37
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 26, 2022
…atus fields

`PipelineSpec` was only stored in the `PipelineRun` `Status` field [once](https://github.com/tektoncd/pipeline/blob/6f633b2a41455c6d7cad12d51243b2d1a8716544/pkg/reconciler/pipelinerun/pipelinerun.go#L358), before any substitutions. The same thing was happening with the `TaskSpec` field of the `TaskRun's` `Status` (See [here](https://github.com/tektoncd/pipeline/blob/6f633b2a41455c6d7cad12d51243b2d1a8716544/pkg/reconciler/taskrun/taskrun.go#L310)). As a result, after execution of the `pipelinerun` or `taskrun`, the `(task/pipeline)specs` of the `status` fields were not updated leading to confusion.

This commit also updates the `TaskSpec and PipelineSpec` of `Status` fields
of `TaskRun` and `PipelineRun`, respectively, after application of the
substitutions. As a result, the replacements are now visible in the
run status.
@chitrangpatel chitrangpatel force-pushed the Update-PipelineRun-TaskRun-Status-Specs branch from 1f44624 to 35e03c0 Compare May 26, 2022 21:39
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 26, 2022
@chitrangpatel
Copy link
Contributor Author

chitrangpatel commented May 26, 2022

@chitrangpatel please add tests 🙏🏾

Hi @jerop, its hard to (or at least I dont know how yet) produce a unit test because a task run needs to be created from the pipeline run. Do you think an example file will suffice here?

@jerop I managed to write an e2e test that validates this.

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.4% 86.4% 0.0
pkg/reconciler/taskrun/taskrun.go 80.2% 80.3% 0.2

@tekton-robot
Copy link
Collaborator

[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 May 30, 2022
@abayer
Copy link
Contributor

abayer commented May 31, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label May 31, 2022
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. kind/bug Categorizes issue or PR as related to a bug. 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants