Skip to content

fix: Move when condition to higher priority #8569

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

Merged
merged 1 commit into from
Feb 20, 2025
Merged

Conversation

Allda
Copy link
Contributor

@Allda Allda commented Feb 17, 2025

When using "when" condition in pipelinerun definition we can sometime get into a situation when a task would be skipped due to "when" condition but instead it is skipped either by parent is skipped or result reference is missing. This behaviour has a negative impact on the rest of the tasks in the pipeline.

A good example of this issue is represented by this pipeline:

A -> B -> C

In case B depends on A's result and both A and B uses when condition that both evaluates to false the C is automatically skipped with "Parent Tasks were skipped" even-though C doesn't depend on any previous results.

With this change both A and B are skipped by evaluating the "when" condition and C is executed as expected.

This commit address the bug #7680.

Changes

Submitter Checklist

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

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • 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). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

fix: Move when condition to higher priority

/kind bug

@tekton-robot tekton-robot added the release-note-none Denotes a PR that doesnt merit a release note. label Feb 17, 2025
Copy link

linux-foundation-easycla bot commented Feb 17, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: Allda / name: Aleš Raszka (47b1efc)

@tekton-robot tekton-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 17, 2025
@tekton-robot
Copy link
Collaborator

Hi @Allda. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 tekton-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 17, 2025
@afrittoli
Copy link
Member

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 17, 2025
@afrittoli afrittoli added the kind/bug Categorizes issue or PR as related to a bug. label Feb 17, 2025
@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 Feb 17, 2025
@Allda
Copy link
Contributor Author

Allda commented Feb 17, 2025

/ok-to-test

@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 Feb 18, 2025
When using "when" condition in pipelinerun definition we can sometime
get into a situation when a task would be skipped due to "when"
condition but instead it is skipped either by parent is skipped or
result reference is missing. This behaviour has a negative impact on the
rest of the tasks in the pipeline.

A good example of this issue is represented by this pipeline:

A -> B -> C

In case B depends on A's result and both A and B uses when condition
that both evaluates to false the C is automatically skipped with
"Parent Tasks were skipped" even-though C doesn't depend on any previous
results.

With this change both A and B are skipped by evaluating the "when"
condition and C is executed as expected.

This commit address the bug tektoncd#7680.

Signed-off-by: Ales Raszka <[email protected]>
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.

Thanks for this! It looks good to me

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.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 19, 2025
@Allda
Copy link
Contributor Author

Allda commented Feb 20, 2025

@vdemeester @afrittoli Is there anything else needed in this PR or can it be merged?

@afrittoli
Copy link
Member

@vdemeester @afrittoli Is there anything else needed in this PR or can it be merged?

Nothing is missing. It's in tide's merge pool now, I'm not sure why it isn't merged yet, let me check tide's logs

@tekton-robot tekton-robot merged commit edb2613 into tektoncd:main Feb 20, 2025
31 checks passed
@afrittoli
Copy link
Member

It's in queue for merge after #8524, but CI was stalling there.
I poked that PR and it seem to have solved the issue.

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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants