-
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
build trigger for upstream image changes #557
Conversation
d68ec8c
to
07ed8ab
Compare
@@ -37,6 +37,9 @@ type BuildParameters struct { | |||
|
|||
// Output describes the Docker image the Strategy should produce. | |||
Output BuildOutput `json:"output,omitempty" yaml:"output,omitempty"` | |||
|
|||
// UpstreamImage indicates the upstream docker image that should be used for this build | |||
UpstreamImage string `json:"dependentImage,omitempty" yaml:"dependentImage,omitempty"` |
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.
json/yaml mapping name should be consistent with field name, shouldn't it?
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.
yes
@marianitadn @soltysh fyi. Maciej, I don't think you've started the image change trigger bit, so i'm going to move on to that as i realize now adding the upstream image field didn't really represent much effort other than naming :) |
499b9a3
to
3101a9f
Compare
Stop <-chan struct{} | ||
} | ||
|
||
type icBuildConfigInterface interface { |
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.
what ic
stands for?
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 copied this from the deploymentcontroller but i believe it stands for imageChange.
3101a9f
to
89d462c
Compare
This code is currently a non-compiling mess, but I wanted to put it in here so @soltysh doesn't overlap the work i've done to implement the image_change_controller so far. Should also note that this implementation so far appears to be at odds with what @smarterclayton has in mind for this feature, so that still needs to be discussed before carrying this much further. |
f054e2c
to
2de71ff
Compare
4d7b5be
to
8f2fe96
Compare
@soltysh @jhadvig ok this is in much better shape now...it actually works, at least for STI builders (haven't tested for docker yet). things not yet done:
If you're looking for something to do, either #2 or #3 are reasonable things to look at..but let me know which, if either, you are doing so i can focus my efforts on the other parts. Note that if you're playing with this, you need to push the ruby-20-centos image into the local docker-registry, which is why i've updated the template json for the moment. |
8f2fe96
to
e8da2e3
Compare
----- Original Message -----
This may need to be opt-in - how do you know for sure that the image name should be specific (i.e. what if the custom build wants to use that value to perform some logic of its own against docker)?
|
@smarterclayton agreed, how we address custombuild strategies is not fully thought through yet. We could add an explicit "baseimage" field like we have for docker-builds, and put the impetus on the custombuilder to use that field if desired, but i don't love that idea since there's no particular requirement a custombuilder even uses a baseimage, so it becomes an (optional) parameter that doesn't necessarily make any sense. We could also only substitute specific keys but that's not much better than adding the optional first-class field, if it's better at all. do you see a third alternative? |
We've talked about a more sophisticated ENV story than what we have now, where you could indicate via env other things beyond just "use this value", similar to generation. There's nothing upstream yet so I'm hesitant to invent something. For step one, we can simply omit it from custom build and require you to use the ENV var we set as part of the base build. ----- Original Message -----
|
if we do that of course we need to pick an env var key that will not collide with anything they might want to use. |
Possibly reuse the same one as the base docker build - if they want to override it they can, if they don't override it they get the value we set.
|
func TestSimpleImageChangeBuildTrigger(t *testing.T) { | ||
t.Log("starting run") | ||
deleteAllEtcdKeys() | ||
//openshift := NewTestOpenshift(t) |
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 pretty confident you can nuke this comment 😉
@soltysh comments mostly addressed aside from the ones i commented on. |
e187f66
to
28b6c35
Compare
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_openshift3/711/) |
286d8c6
to
8646c39
Compare
@smarterclayton can I get a final review on this? The one big hole i'm aware of is that builds triggered by means other than an image change, will simply use the imageid from the original buildconfig rather than getting the latest imageid from the imagerepo(if one is associated with the build). i'm not even sure that's a huge problem (since if you setup your buildconfig+image tags correctly, your other builds will get the right thing anyway), but I think we can loop back and fix it later if it is important. |
// performing a custom build, if needed. | ||
CustomBuildStrategyBaseImageKey = "OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE" | ||
|
||
// DefaultImageTag is used when an image tag is needed and the configuration |
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.
This comment is incomplete
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.
comment completed
8646c39
to
41e4a8b
Compare
} | ||
} | ||
// update the actual custom build image with the new image, if applicable | ||
if build.Parameters.Strategy.CustomStrategy.Image == oldImage { |
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.
And here
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.
doh. fixed.
345ae7f
to
275caa2
Compare
@@ -100,7 +100,10 @@ func validateStrategy(strategy *buildapi.BuildStrategy) errs.ValidationErrorList | |||
allErrs = append(allErrs, validateSTIStrategy(strategy.STIStrategy).Prefix("stiStrategy")...) | |||
} | |||
case buildapi.DockerBuildStrategyType: | |||
// DockerStrategy is currently optional | |||
// DockerStrategy is currently optional, initialize it to a default state if it's not set. |
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.
@smarterclayton does this address your validation concern?
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.
Yes
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.
Note that the other types don't even test for 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.
STI does. Custom does not and should. i'll add that one.
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.
added.
275caa2
to
17d0023
Compare
LGTM - ready for merge? |
Quite. [merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_openshift3/592/) (Image: devenv-fedora_531) |
Evaluated for origin up to 17d0023 |
Merged by openshift-bot
* Passing a RESTClient through to the TPR storage cc/ @krancour * fixing more compile errs * Fixing test compile error * fixing integration test compile err * removing redundant import * disabling TPR integration tests enabling them will be done in a follow-up
No description provided.