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

Fix unknown strategy kind reconcile issue #1534

Merged
merged 2 commits into from
Mar 13, 2024
Merged

Conversation

HeavyWombat
Copy link
Contributor

Changes

Set status when strategy kind is not one of the supported ones.

Add test cases to strategy validation.

Refactor strategy validation code to be more compact and readable.

Fixes #1531

Submitter Checklist

  • Includes tests if functionality changed/was added
  • Includes docs if changes are user-facing
  • Set a kind label on this PR
  • Release notes block has been filled in, or marked NONE

See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.

Release Notes

NONE

@HeavyWombat HeavyWombat added the kind/bug Categorizes issue or PR as related to a bug. label Mar 8, 2024
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 8, 2024
@openshift-ci openshift-ci bot added the release-note-none Label for when a PR does not need a release note label Mar 8, 2024
@HeavyWombat HeavyWombat changed the title Fix unknown strategy kind reconcile issue #1531 Fix unknown strategy kind reconcile issue Mar 8, 2024
@SaschaSchwarze0 SaschaSchwarze0 added this to the release-v0.13.0 milestone Mar 8, 2024
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 left a comment

Choose a reason for hiding this comment

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

Looks mostly good. Do we have a test case for a standalone buildrun with an inline build spec with an invalid strategy kind?

pkg/validate/strategies.go Outdated Show resolved Hide resolved
pkg/validate/strategies.go Outdated Show resolved Hide resolved
pkg/reconciler/build/build_test.go Outdated Show resolved Hide resolved
@HeavyWombat
Copy link
Contributor Author

Looks mostly good. Do we have a test case for a standalone buildrun with an inline build spec with an invalid strategy kind?

Another good catch. Looking into it.

@HeavyWombat
Copy link
Contributor Author

Looks mostly good. Do we have a test case for a standalone buildrun with an inline build spec with an invalid strategy kind?

This was actually more complicated than I thought. We kind of never had the same validations for the BuildSpec of an embedded BuildRun like the ones for a Build. I needed to refactor a little bit to get this one in. I think we should consider to refactor the whole validation code as it seems to be a bit of a patch work at this time.

Copy link
Contributor

@qu1queee qu1queee left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 12, 2024
// BuildRunFields runs field validations against a BuildRun to detect
// disallowed field combinations
// BuildRun runs field validations against a BuildRun to detect
// disallowed field combinations and issues
func BuildRunFields(buildRun *build.BuildRun) (string, string) {
Copy link
Member

Choose a reason for hiding this comment

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

Should not the comment start with the function name by convention ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Fixed it.

@qu1queee
Copy link
Contributor

@HeavyWombat on

This was actually more complicated than I thought. We kind of never had the same validations for the BuildSpec of an embedded BuildRun like the ones for a Build. I needed to refactor a little bit to get this one in. I think we should consider to refactor the whole validation code as it seems to be a bit of a patch work at this time.

I think the above didn't hold true, can you just comment on it, not to confuse people please.

@HeavyWombat
Copy link
Contributor Author

@HeavyWombat on

This was actually more complicated than I thought. We kind of never had the same validations for the BuildSpec of an embedded BuildRun like the ones for a Build. I needed to refactor a little bit to get this one in. I think we should consider to refactor the whole validation code as it seems to be a bit of a patch work at this time.

I think the above didn't hold true, can you just comment on it, not to confuse people please.

Yes, I went down a wrong path here. The validation was in place already, but later in reconcile function. It is fine where it is and I made sure to adopt back the changes that I introduced. We have a test case to catch the scenario.

HeavyWombat and others added 2 commits March 13, 2024 09:33
Ref: #1531

Set status when strategy kind is not one of the supported ones.

Add test cases to strategy validation.

Refactor strategy validation code to be more compact and readable.

Signed-off-by: Matthias Diester <[email protected]>
Fix variable usage in message.

Co-authored-by: Sascha Schwarze <[email protected]>
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 13, 2024
@qu1queee qu1queee self-requested a review March 13, 2024 09:51
Copy link
Contributor

@qu1queee qu1queee left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 13, 2024
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 left a comment

Choose a reason for hiding this comment

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

/approve

Copy link
Contributor

openshift-ci bot commented Mar 13, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SaschaSchwarze0

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 13, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 8e46bc8 into main Mar 13, 2024
14 checks passed
@openshift-merge-bot openshift-merge-bot bot deleted the fix/issue-1531 branch March 13, 2024 10:18
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-none Label for when a PR does not need a release note size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[BUG] Endless reconcile of build when strategy kind is unknown
3 participants