-
Notifications
You must be signed in to change notification settings - Fork 113
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
Handle non-existing annotation #460
Handle non-existing annotation #460
Conversation
} | ||
} | ||
case "false": | ||
case "", "false": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, just to be very clear, the switch is not covering the scenario when build.AnnotationBuildRunDeletion
annotation is not present. I think we should not cover this in this switch/case
, mainly because there is no need to run the underlying logic when the annotation is not defined.
I think you can use this https://play.golang.org/p/HklUW5yVfas logic, to validate prior to the switch if the annotation key is defined or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @qu1queee, I think your proposal will mean the following behavior:
- Create a build b1 without the annotation
- Create a buildrun br1 which references b1 -> the buildrun has no owner, that's fine
--
- Create a build b2 with annotation build.build.dev/build-run-deletion=true
- Create a buildrun br2 which references b2 -> the buildrun br2 will be owned by the build b2
- Update the build b2 to delete the annotation build.build.dev/build-run-deletion -> the buildrun br2 still has b2 as owner although b2 does not anymore express that buildrun deletion should happen
Based on that, handling ""
in the same way as "false"
is in my opinion accurate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, sorry it was not clear from the PR that this was the rational. I think the current code was a strict one, based on #409 (review) . I think this is ideal, but you will need to provide an integration test case for this flow. Use https://github.com/shipwright-io/build/blob/master/test/integration/build_to_buildruns_test.go#L344-L372 as a reference, where the patch part should be a removal of the annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting test case for the flow when the annotation gets deleted, but previous ownerreferences still define.
/test 4.4-unit |
Integration test added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, lgtm.
/approve |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qu1queee, zhangtbj 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 |
I just noticed these output in the operator logs in a travis build https://travis-ci.org/github/shipwright-io/build/builds/740734332:
We forgot to handle the non-existing annotation in the same was as one with value
false
. I am correcting this.