-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Removed fields added to the build strategy when using --strategy=docker. #9553
Conversation
Rebased |
[test] |
I think the buildconfig you've produced is invalid because it has an ImageChangeTrigger defined, but there is no image for the ICT to trigger from. That should result in a validation error if you actually let new-app try to create these objects: I also think is solution is overly aggressive, for example it prevents me from doing: which i might want to do if i definitely do want the FROM line in my Dockerfile to be overwritten by a particular image that i'm basing my build on. As was noted here: #6347 (comment) |
@oatmealraisin thanks for taking a look at this! Suggestions:
|
I added some logic to check if we got the image from a Dockerfile. @bparees ptal? Output from [source]:
Output from [image]~[source]:
|
ScratchImage bool | ||
ExpectToBuild bool | ||
ScratchImage bool | ||
FromDockerfile bool |
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.
since you were complaining about comments before, comment your new field :)
lgtm but please add some tests that cover the different behaviors so we can confirm we don't regress this behavior later. |
Added some tests, hopefully they pass this time! |
[test] |
@@ -299,6 +302,9 @@ type ComponentInput struct { | |||
|
|||
ExpectToBuild bool | |||
ScratchImage bool | |||
// For keeping track of if this image was retrieved from a Dockerfile, | |||
// which changes our BuildConfig results |
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'm a bit confused, is this about a Dockerfile or about a reference to a Docker image?
In oc new-app php~https://github.com/org/repo
, php
refers to a Docker image, not a Dockerfile.
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.
@rhcarvalho in your scenario, FromDockerfile would be false.
FromDockerfile is true when we figured out which image you want to use by parsing the Dockerfile you supplied (either in the repo or via the -D flag).
@oatmealraisin it would be better if this comment explained how it changes the results. "when true, an imagechangetrigger will not be associated with the buildconfig because the user has not expressed a desire to reference an imagestream, they are directly referencing an image" or some such thing.
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.
Aha, so it doesn't relate to that syntax. Thanks @bparees.
Can't say the flow is absolutely clear to me, but at least the name seems 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.
@bparees I was thinking about whether it should explain the intent instead of the idea, I'll change the comment
@rhcarvalho When the input [image]~[source] gets converted into a ComponentReference, and then into an ImageRef, the information about where the image came from gets lost. If we just specify the [source], the image gets filled in from the Dockerfile "FROM". I added a flag so that some information gets preserved, and then I use that information to change the outputted BuildConfig. I really don't like the flow either, it's kinda scotch-tape, but couldn't find a better way to do it. I'm definitely open to suggestions!
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.
it's kinda scotch-tape
👍 💯
but couldn't find a better way to do it. I'm definitely open to suggestions!
I think the approach you described is perfectly valid, no concerns there.
[test] |
re[test] |
rebased |
Changed the comment, @bparees @rhcarvalho ptal? Also, I've added a test to newapp.sh, should I add one anywhere else? |
@@ -140,6 +140,10 @@ type ImageRef struct { | |||
OutputImage bool | |||
Insecure bool | |||
HasEmptyDir bool | |||
// For keeping track of if this image was retrieved from a Dockerfile, |
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.
proper godoc starts w/ the object name, so "FromDockerfile keeps track of....."
same for the other one above.
@oatmealraisin you still need to fix tests which are broken by these changes, the ones you reported as a flake here: #9879 |
@@ -204,14 +204,17 @@ func (r *SourceRepository) Detect(d Detector, dockerStrategy bool) error { | |||
if r.info != nil { | |||
return nil | |||
} | |||
|
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.
Are the new lines here intentional? It's strange to change this file as part of this PR just for the empty lines.
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.
+1, i'm not averse to introducing whitespace if you're already touching the file anyway, but it does tend to cross a line if you're not making any other changes.
re[test] |
1 similar comment
re[test] |
@bparees I updated some tests to prevent regression, and also removed tests that were invalidated because of this change. ptal? |
@oatmealraisin we can't just remove the tests/checks for warnings, we need to create equivalent ones that will still test the circular build warning logic for scenarios under which it can still happen. |
@oatmealraisin bump |
@bparees I've modified the tests to trigger the proper responses, but one of the tests relies on the input repository having the same name as the requested builder image (openshift/ruby-20-centos7~https://github.com/oatmealraisin/ruby-20-centos7). I've used my own repository to do this, but we probably want something with the openshift account? |
This allows us to check later in new-app whether an Image needs a ImageChangeTrigger, or whether we should continue to get it from the Dockerfile it was found in.
Flake #11452, [test] |
Evaluated for origin test up to 834ce8d |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/11178/) (Base Commit: 046fad4) |
@oatmealraisin i apologize because i know you've spent a ton of time on this but with the benefit of hindsight, I think the original issue should be closed (in fact i have closed it) rather than implementing what it proposes. I put my reasoning in the original issue (#6347 (comment)) |
Roger that! |
Fixes #6347
Old output:
New Output: