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

build trigger for upstream image changes #557

Merged
merged 1 commit into from
Jan 13, 2015

Conversation

bparees
Copy link
Contributor

@bparees bparees commented Dec 10, 2014

No description provided.

@bparees bparees changed the title add an upstream image field to builds [WIP][DO_NOT_MERGE] add an upstream image field to builds Dec 10, 2014
@@ -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"`
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

@bparees
Copy link
Contributor Author

bparees commented Dec 10, 2014

@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 :)

@bparees bparees force-pushed the add_dependency_id branch 2 times, most recently from 499b9a3 to 3101a9f Compare December 10, 2014 21:59
Stop <-chan struct{}
}

type icBuildConfigInterface interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

what ic stands for?

Copy link
Contributor Author

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.

@bparees
Copy link
Contributor Author

bparees commented Dec 15, 2014

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.

@bparees bparees force-pushed the add_dependency_id branch 6 times, most recently from f054e2c to 2de71ff Compare December 22, 2014 17:02
@bparees bparees force-pushed the add_dependency_id branch 2 times, most recently from 4d7b5be to 8f2fe96 Compare December 22, 2014 21:36
@bparees
Copy link
Contributor Author

bparees commented Dec 22, 2014

@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:

  1. implement substitution for custombuilds (probably will search all env var declarations for matching image names to replace)
  2. checking on startup that we have run a build for the current imageid associated with the imagerepository for all image change triggers (in case a new image was created while the controller was down).
  3. tests

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.

@smarterclayton
Copy link
Contributor

----- Original Message -----

@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:

  1. implement substitution for custombuilds (probably will search all env var
    declarations for matching image names to replace)

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)?

  1. checking on startup that we have run a build for the current imageid
    associated with the imagerepository for all image change triggers (in case a
    new image was created while the controller was down).
  2. tests

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.


Reply to this email directly or view it on GitHub:
#557 (comment)

@bparees
Copy link
Contributor Author

bparees commented Dec 22, 2014

@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?

@smarterclayton
Copy link
Contributor

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 -----

@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?


Reply to this email directly or view it on GitHub:
#557 (comment)

@bparees
Copy link
Contributor Author

bparees commented Dec 22, 2014

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.

@smarterclayton
Copy link
Contributor

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.

On Dec 22, 2014, at 5:12 PM, Ben Parees notifications@github.com wrote:

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.


Reply to this email directly or view it on GitHub.

func TestSimpleImageChangeBuildTrigger(t *testing.T) {
t.Log("starting run")
deleteAllEtcdKeys()
//openshift := NewTestOpenshift(t)
Copy link
Member

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 😉

@bparees
Copy link
Contributor Author

bparees commented Jan 9, 2015

@soltysh comments mostly addressed aside from the ones i commented on.

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_openshift3/711/)

@bparees bparees changed the title [DO_NOT_MERGE] build trigger for upstream image changes build trigger for upstream image changes Jan 12, 2015
@bparees
Copy link
Contributor Author

bparees commented Jan 12, 2015

@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
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is incomplete

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comment completed

}
}
// update the actual custom build image with the new image, if applicable
if build.Parameters.Strategy.CustomStrategy.Image == oldImage {
Copy link
Contributor

Choose a reason for hiding this comment

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

And here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

doh. fixed.

@bparees bparees force-pushed the add_dependency_id branch 2 times, most recently from 345ae7f to 275caa2 Compare January 12, 2015 22:18
@@ -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.
Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added.

@smarterclayton
Copy link
Contributor

LGTM - ready for merge?

@bparees
Copy link
Contributor Author

bparees commented Jan 13, 2015

Quite. [merge]

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_openshift3/592/) (Image: devenv-fedora_531)

@openshift-bot
Copy link
Contributor

Evaluated for origin up to 17d0023

openshift-bot pushed a commit that referenced this pull request Jan 13, 2015
@openshift-bot openshift-bot merged commit a5189c7 into openshift:master Jan 13, 2015
@bparees bparees deleted the add_dependency_id branch January 16, 2015 21:10
sjenning pushed a commit to sjenning/origin that referenced this pull request Jan 24, 2017
jpeeler pushed a commit to jpeeler/origin that referenced this pull request Feb 1, 2018
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants