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 circular input/output detection #7321
Conversation
09e0726
to
9fa37b6
Compare
[test] |
@smarterclayton @rhcarvalho ptal. the existing circular input/output detection was insufficient, it compared the input as "docker.io/openshift/ruby-22-centos7"(the imageref) to the output of "library/ruby-22-centos7" but really the input is "ruby-22-centos7"(the imagestream) in the sense that that is what triggers the build. It looks like it worked for the "centos" test case basically out of happenstance (both converted to library/centos and matched) |
still working on this, ignore for now. |
ok good to go again, i think. two major changes in output behavior here:
I haven't spent a ton of time thinking about other approaches, but basically i think this error checking needs to come last (after we've resolved everything) so avoiding the other output until we can do the validation seems like it might be a challenge given the current code structure. example output:
(in fact i'll even proactively argue that the additional descriptive "here's what we're doing" information could be useful in understanding the error being reported. So i'm going to claim this is a feature) |
The message is too long -
can probably be
or similar |
it's still kinda long, but changed to: |
[test] |
@@ -1113,6 +1112,25 @@ func (c *AppConfig) run(acceptors app.Acceptors) (*AppResult, error) { | |||
}, nil | |||
} | |||
|
|||
// checkCircularReferences ensures there are no builds that can trigger themselves | |||
// due to an imagechangetrigger that matches the output destination of the image. |
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.
Need to document what the argument objects
is (a "list" of objects that might contain build configs).
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 don't see how that documentation adds value nor it is it the kind of thing we tend to document anywhere else. It's clear from the type what objects is, and we don't document it anywhere else that we take an app.Objects parameter in a function (AddRoutes, AddServices). Not to mention it's a private function so it's not even like it's an api we expect people to consume. The only use is within this package.
And "might contain a buildconfig" is implied by the fact that the function says it's checking the builds, and in the future it might expand to check other things (non-buildconfig related) anyway.
I will add the comment in this case since you've requested it and i'm updating the file anyway, but in general this doesn't seem like a valuable change to make people iterate on.
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.
Yeah generally we'd define how we process the parameter, but we don't discuss the type of the parameter when it's obvious from observation.
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 think just because something is not exported is not an excuse to not document or make things clear.
And if something is missing elsewhere, it doesn't mean we cannot do better.
AFAIK, we're not generating "readable" godocs like one would read for the standard library or other libs we use, but I believe all devs are consuming those docs straight from code every day.
The type is explicit, we don't need to repeat ourselves, but intentions are not always obvious.
For instance, when reading this piece I first wondered why it operates on app.Objects
and not on a single api.BuildConfig
. It takes extra leaps of thought and clicking, digging, etc, to figure out what is app.Objects
and what it actually might contain.
I thought having this type of discussion was beneficial to a code review. After all, we're all going to maintain this code later.
need to actually compare the imagestreams that are being input/output, not the image represented by the input to the output. fixes https://bugzilla.redhat.com/show_bug.cgi?id=1306507
Evaluated for origin test up to e970008 |
continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/1226/) |
failures are unrelated to this change. the newapp tests passed. |
LGTM On Tue, Feb 16, 2016 at 5:55 PM, Ben Parees notifications@github.com
|
[merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/4984/) (Image: devenv-rhel7_3446) |
Evaluated for origin merge up to e970008 |
Merged by openshift-bot
need to actually compare the imagestreams that are being
input/output, not the image represented by the input to
the output.
fixes https://bugzilla.redhat.com/show_bug.cgi?id=1306507