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 BuildConfigInstantiateFailed warning when lastVersion == 0 #17146

Merged
merged 1 commit into from
Feb 20, 2018
Merged

Fix BuildConfigInstantiateFailed warning when lastVersion == 0 #17146

merged 1 commit into from
Feb 20, 2018

Conversation

coreydaley
Copy link
Member

Build config instatiate should not emit a warning when
bc.Status.LastVersion != lastVersion and lastVersion == 0
Fixes #16557

@openshift-ci-robot openshift-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 2, 2017
@coreydaley
Copy link
Member Author

@openshift/sig-developer-experience ptal

@bparees
Copy link
Contributor

bparees commented Nov 2, 2017

I don't think this is the right fix. You've not just eliminated the warning, isn't this now going to run two builds (the configchangetriggered one and the imagechangetriggered one)?

@openshift-ci-robot
Copy link

openshift-ci-robot commented Nov 2, 2017

@coreydaley: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/extended_conformance_gce 14a0f39 link /test extended_conformance_gce
ci/openshift-jenkins/extended_conformance_install_update 14a0f39 link /test extended_conformance_install_update

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@bparees
Copy link
Contributor

bparees commented Jan 17, 2018

@coreydaley did you forget about this?

@coreydaley
Copy link
Member Author

@bparees nope, it's next on my list

@coreydaley coreydaley closed this Feb 17, 2018
@openshift-ci-robot openshift-ci-robot added retest-not-required-docs-only approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 17, 2018
@bparees
Copy link
Contributor

bparees commented Feb 17, 2018 via email

@coreydaley
Copy link
Member Author

I reset my branch so that I could start over on this PR and pushed it, weird that it closed, reopening with new code.

@coreydaley coreydaley reopened this Feb 17, 2018
@openshift-ci-robot openshift-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed retest-not-required-docs-only approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 17, 2018
@coreydaley
Copy link
Member Author

@openshift/sig-developer-experience ptal

// Don't emit this event if the BuildRequest.LastVersion equals zero
// Caused by a race condition between the ImageChangeTrigger vs the BuildConfigChangeTrigger
// Fixes https://github.com/openshift/origin/issues/16557
if *request.LastVersion != int64(0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

request.LastVersion will always be zero in this codepath. so you're going to mask any/all errors.

I think you need to actually look at the error you got from Instantiate (and/or make Instantiate throw a more distinctive error you can look for)

@coreydaley
Copy link
Member Author

@bparees ptal

Copy link
Contributor

@gabemontero gabemontero left a comment

Choose a reason for hiding this comment

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

One item occurred to me ... apologies if it was previously discussed and I missed it.

// Caused by a race condition between the ImageChangeTrigger vs the BuildConfigChangeTrigger
if !strings.Contains(instantiateErr.Error(), fmt.Sprintf("the LastVersion(1) on build config %s/%s does not match the build request LastVersion(0)", bc.Namespace, bc.Name)) {
c.recorder.Event(bc, kapi.EventTypeWarning, "BuildConfigInstantiateFailed", instantiateErr.Error())
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What if a single request comes through (i.e. not a race between ICT and CCT) after the initial BC create with a bad last version? Wouldn't we be masking a legitimate error in that case?

Unfortunately, don't know if I have a super great solution ... perhaps we fetch the BC before performing this filter and see if it was recently created ... where determining what is recent is perhaps kludgy ... but maybe at least an improvement.

Dumb non-transactional databases

Copy link
Contributor

Choose a reason for hiding this comment

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

What if a single request comes through (i.e. not a race between ICT and CCT) after the initial BC create with a bad last version?

request comes from where? to where? this logic is all in the buildconfig controller. There are no other buildrequests its going to process.

@coreydaley your check on LastVersion(1) is too specific. I could potentially start multiple builds before the buildconfig controller puts in its request. Then the error would be "the LastVersion(5) on build config..." or whatever.

Just check for the back half: does not match the build request LastVersion(0)

@coreydaley
Copy link
Member Author

@jim-minter any thoughts?

@gabemontero
Copy link
Contributor

gabemontero commented Feb 19, 2018 via email

@bparees
Copy link
Contributor

bparees commented Feb 19, 2018

So you are saying somebody couldn't manually hit the build config rest endpoint with a HTTP req and interfere with this?

interfere with this how?

@coreydaley
Copy link
Member Author

@bparees update pushed

@gabemontero
Copy link
Contributor

gabemontero commented Feb 19, 2018 via email

@bparees
Copy link
Contributor

bparees commented Feb 19, 2018

And when the say the human manually builds ths json for the request he uses
the wrong last version

the code that handles that buildrequest is not the codepath that @coreydaley added his error checking/filtering to. (both codepaths call instantiate, but only the buildconfigcontroller codepath is having the filtering added to it)

@bparees
Copy link
Contributor

bparees commented Feb 19, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 19, 2018
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bparees, coreydaley

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 19, 2018
@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue.

@openshift-merge-robot openshift-merge-robot merged commit 4e52d0a into openshift:master Feb 20, 2018
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. lgtm Indicates that a PR is ready to be merged. sig/developer-experience size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants