Skip to content

Conversation

@Yongxuanzhang
Copy link
Member

@Yongxuanzhang Yongxuanzhang commented Feb 13, 2023

Changes

This commit skip the validation for skipped task results in pipeline results. This fixes #6139. The skipped task results are not emitted by design thus we shouldn't validate if they are emitted. Pipeline results referenced to skipped task will not be emitted.

/kind bug

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com

Submitter Checklist

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

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

A fix for regression issue that previously we don't fail the run when skipped task results don't emit, but failed when validation is introduced.

@tekton-robot
Copy link
Collaborator

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@tekton-robot tekton-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. release-note-none Denotes a PR that doesnt merit a release note. labels Feb 13, 2023
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 13, 2023
@Yongxuanzhang Yongxuanzhang marked this pull request as ready for review February 13, 2023 19:30
@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 Feb 13, 2023
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 97.5% 97.5% 0.1

@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/resources/apply.go 97.5% 97.5% 0.1

@Yongxuanzhang
Copy link
Member Author

Hi @pritidesai @jerop , could you take a look at this PR?

Copy link

@kyubisation kyubisation left a comment

Choose a reason for hiding this comment

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

Thank you very much for the quick fix! 😃
I'm not very familiar with the code base, but from my perspective this looks good to me. 👍

@jerop
Copy link
Member

jerop commented Feb 13, 2023

please fix the typo in the pr title and commit message

@Yongxuanzhang Yongxuanzhang changed the title don't validate skipped task resutls for pipeline results don't validate skipped task results for pipeline results Feb 13, 2023
@Yongxuanzhang Yongxuanzhang requested review from jerop and removed request for bobcatfish, imjasonh and lbernick February 13, 2023 21:04
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.

could it be more confusing for the pipeline result to remain as is - an unsubstituted reference to a task result? what if users assume pipeline results were produced by the pipeline, but then some are just the original references? wondering if we should just wait for tektoncd/community#954?

also @Yongxuanzhang please add to the commit message that this change is not only removing validation, but also leaving pipeline results as the original unsubstituted references to task results when the task was skipped

@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/resources/apply.go 97.5% 97.5% 0.1

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 97.5% 97.5% 0.1

@Yongxuanzhang
Copy link
Member Author

could it be more confusing for the pipeline result to remain as is - an unsubstituted reference to a task result? what if users assume pipeline results were produced by the pipeline, but then some are just the original references? wondering if we should just wait for tektoncd/community#954?

also @Yongxuanzhang please add to the commit message that this change is not only removing validation, but also leaving pipeline results as the original unsubstituted references to task results when the task was skipped

This commit skips the validation of "skipped tasks", my understanding is that if users use "when expressions" on tasks and they should be aware of some results cannot be replaced if tasks are skipped as mentioned in https://tekton.dev/docs/pipelines/pipelines/#emitting-results-from-a-pipeline

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 97.5% 97.5% 0.1

@pritidesai pritidesai added this to the Pipelines v0.46 milestone Mar 6, 2023
@pritidesai
Copy link
Member

Please update the release notes elaborating its a fix for a regression issue, thanks!

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesnt merit a release note. labels Mar 6, 2023
@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/resources/apply.go 97.5% 97.5% 0.1

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 97.5% 97.5% 0.1

Copy link
Member

@lbernick lbernick left a comment

Choose a reason for hiding this comment

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

I think it would be worth adding a reconciler unit test or an integration test with a full pipelinerun spec with skipped results

customTaskResults map[string][]v1beta1.CustomRunResult) ([]v1beta1.PipelineRunResult, error) {
customTaskResults map[string][]v1beta1.CustomRunResult,
skippedTasks []v1beta1.SkippedTask,
logger *zap.SugaredLogger) ([]v1beta1.PipelineRunResult, error) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think it would be a bit cleaner to get the logger from the context instead of passing it in as a param (more consistent with the rest of the codebase)

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh I see, thanks! Fixed!

} {
t.Run(tc.description, func(t *testing.T) {
received, _ := ApplyTaskResultsToPipelineResults(tc.results, tc.taskResults, tc.runResults)
received, _ := ApplyTaskResultsToPipelineResults(tc.results, tc.taskResults, tc.runResults, nil, logtesting.TestLogger(t))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
received, _ := ApplyTaskResultsToPipelineResults(tc.results, tc.taskResults, tc.runResults, nil, logtesting.TestLogger(t))
received, _ := ApplyTaskResultsToPipelineResults(tc.results, tc.taskResults, tc.runResults, nil /* skippedTasks */, logtesting.TestLogger(t))

skippedTasks: []v1beta1.SkippedTask{{
Name: "skippedTask",
}},
expectedResults: []v1beta1.PipelineRunResult{{
Copy link
Member

Choose a reason for hiding this comment

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

What output results existed prior to this regression? Was it just a non-replaced result expression? or was there no pipeline result? (based on the linked issue it looks like the latter.) I think an absent Pipeline result might make more sense than a Pipeline result like "$(tasks.skippedTask.results.foo)".

(everything else is mostly a nit but let's verify this)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah yes this is a great point! When I implemented this fix I didn't check the previous behaviour. I checked the previous version and there are no results if the task is skipped. We should definitely keep the previous behaviour otherwise this will be another issue

@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/resources/apply.go 98.0% 98.1% 0.1

@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/resources/apply.go 98.0% 98.1% 0.1

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 98.0% 98.1% 0.1

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 98.0% 98.1% 0.1

This commit skip the validation for skipped task results in pipeline
results. This fixes tektoncd#6139. The skipped task results are not emitted by
design thus we shouldn't validate if they are emitted. Pipeline results
referenced to skipped task will not be emitted.
@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/resources/apply.go 98.0% 98.1% 0.1

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 98.0% 98.1% 0.1

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 98.0% 98.1% 0.1

Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

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

Thank you for all the updates!
/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: afrittoli, kyubisation

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

The pull request process is described here

Details 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 Mar 16, 2023
@lbernick
Copy link
Member

/lgtm

I think we'll need to cherry pick this to all the releases after v0.37 we currently support-- which is v0.41-v0.45 :( (Although v0.45 EOL is tomorrow)

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/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pipeline failing with "invalid pipelineresults" when referencing results of skipped tasks

7 participants