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

Add 'Paused' to ImageChangeTrigger for BuildConfig #44

Merged
merged 1 commit into from
Jun 25, 2018

Conversation

wozniakjan
Copy link
Contributor

@wozniakjan wozniakjan commented May 4, 2018

When user adds ICT to BC, the image_trigger_controller.go starts a build and this may not be desired for certain scenarios where specifically only change in ImageStreamTag should trigger the build. Setting Paused: true tells the controller to not trigger the build.

https://trello.com/c/iT4bw5jg/1541-3-ability-to-set-imagechange-triggers-in-buildconfig-without-triggering-a-build-automatically

cc: @openshift/sig-developer-experience, @openshift/sig-master

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 4, 2018
@wozniakjan
Copy link
Contributor Author

@wozniakjan wozniakjan force-pushed the feature/imagechangetrigger branch from 69fcc7a to fec4f06 Compare May 4, 2018 11:28
@bparees
Copy link
Contributor

bparees commented May 4, 2018

@smarterclayton this is probably the place to have the discussion on what we want this API to be. Personally I like this approach because it mirrors the DC behavior which evolved after a number of painful experiences.

The challenges I see with the "paused" annotation is it's not clear what the behavior is for manually triggered builds and webhook triggered builds. It also doesn't allow for fine grained enable/disablement of ICTs which I admit isn't likely to be a 90% use case, but it's basically free w/ this implementation.

If we can define the expected behavior for a global "pause" on the resource, i'd be more amenable to it, but it's a deeper change since we'd have to add logical to our api to reject the build request (assuming we do indeed want to block all builds for the buildconfig when it is paused) and client tools to report the error to the user. It also becomes a very big hammer.

Alternatively, if the paused annotation still allowed webhook+manual triggered builds, I think users might find that confusing/surprising.

@bparees
Copy link
Contributor

bparees commented May 4, 2018

@smarterclayton an orthogonal question: When the build is unpaused (either individual ICT or the whole build), and if the image changed while it was paused, should be a build be run to "catch it up" or should image changes that occurred while the build was paused get ignored? (which would basically mean that while the build is paused we'd keep updating the ICT metadata as if the image had triggered a build, but not actually run the build).

My inclination would be that when it becomes unpaused, and if the image has changed, we would run a build using the latest image. (Which i think would happen automatically w/ the current implementation since the image change controller would see the ICT changed and reprocess it and see that it was "behind" the latest image)

@smarterclayton
Copy link
Contributor

smarterclayton commented May 4, 2018 via email

@bparees
Copy link
Contributor

bparees commented May 4, 2018

We already have a fine grained pause attribute on image change triggers as annotation.

ok. So it sounds like we need to:

  1. add a paused attribute to the buildconfig ICT struct (basically what @wozniakjan did except rename it)
  2. when paused is set back to false, a build will immediately run if the image changed while it was paused (this will happen just based on how the image_change_controller works today, i believe)
  3. possibly someday in the future, add a paused attribute to our webhooks
  4. possibly someday in the future add a paused attribute to the buildconfig itself

accurate?

@wozniakjan wozniakjan force-pushed the feature/imagechangetrigger branch from fec4f06 to d52bc3f Compare May 7, 2018 11:49
@wozniakjan wozniakjan changed the title [WIP] Add 'Automatic' to ImageChangeTrigger for BuildConfig [WIP] Add 'Paused' to ImageChangeTrigger for BuildConfig May 7, 2018
@wozniakjan
Copy link
Contributor Author

  1. when paused is set back to false, a build will immediately run if the image changed while it was paused (this will happen just based on how the image_change_controller works today, i believe)

@bparees I think we may still need the change in buildconfigs.go handler used in image_change_controller.go as done here https://github.com/openshift/origin/pull/19624/files. Tested with a build from latest master and it happily triggered a build even with ICT paused=true field and I wasn't able to find any logic in the controller code that would lead me to think otherwise

@bparees
Copy link
Contributor

bparees commented May 9, 2018

@bparees I think we may still need the change in buildconfigs.go handler used in image_change_controller.go as done here

yeah, sorry I didn't mean to imply no changes were needed, we definitely need to look at whether the ICT is paused or not. What I was trying to say is that when you update the ICT to set paused=false, the image_change_controller will see the ICT update and reprocess the ICT and, if it's not paused and the image has changed, trigger a build. That logic is all in place already (watching for updates to buildconfigs/ICTs and running builds if the image is newer than what the ICT last saw).

@bparees bparees self-assigned this May 17, 2018
@@ -946,6 +946,9 @@ type ImageChangeTrigger struct {
// will be used. Only one ImageChangeTrigger with an empty From reference is allowed in
// a build configuration.
From *corev1.ObjectReference `json:"from,omitempty" protobuf:"bytes,2,opt,name=from"`

// paused controlls whether controller will trigger a build on an object change as well
Copy link
Contributor

Choose a reason for hiding this comment

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

s/controlls/controls/

@bparees
Copy link
Contributor

bparees commented May 17, 2018

@openshift/api-review i think this is ready to be re-reviewed.

Same comment as above - I wasn’t suggesting an annotation. We already have a fine grained pause attribute on image change triggers as annotation.

@smarterclayton i'm not familiar w/ this but we certainly don't have it for the imagechangetrigger object associated w/ builds (that object doesn't even have annotations)

@wozniakjan wozniakjan force-pushed the feature/imagechangetrigger branch from d52bc3f to c726713 Compare May 18, 2018 09:04
@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 18, 2018
@wozniakjan wozniakjan force-pushed the feature/imagechangetrigger branch from c726713 to 9248de1 Compare May 18, 2018 09:07
@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 18, 2018
@bparees
Copy link
Contributor

bparees commented May 25, 2018

@openshift/api-review bump

@wozniakjan wozniakjan force-pushed the feature/imagechangetrigger branch from 9248de1 to a621699 Compare June 11, 2018 09:12
@wozniakjan
Copy link
Contributor Author

@openshift/api-review any requests/comments?

@@ -946,6 +946,9 @@ type ImageChangeTrigger struct {
// will be used. Only one ImageChangeTrigger with an empty From reference is allowed in
// a build configuration.
From *corev1.ObjectReference `json:"from,omitempty" protobuf:"bytes,2,opt,name=from"`

// paused controls whether controller will trigger a build on an object change as well
Copy link
Contributor

Choose a reason for hiding this comment

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

s/object/image/

Copy link
Contributor

@liggitt liggitt Jun 19, 2018

Choose a reason for hiding this comment

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

the doc for objectfieldtrigger.paused is clearer:

// paused is true if this trigger is temporarily disabled. Optional.

would something like that be more accurate here? the "as well" in the current doc makes me wonder what paused: true doesn't pause

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah i think that doc would be better.

@bparees
Copy link
Contributor

bparees commented Jun 15, 2018

@openshift/api-review approval please?

@bparees bparees changed the title [WIP] Add 'Paused' to ImageChangeTrigger for BuildConfig Add 'Paused' to ImageChangeTrigger for BuildConfig Jun 18, 2018
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 18, 2018
@bparees
Copy link
Contributor

bparees commented Jun 18, 2018

@openshift/api-review WIP tag removed.

@liggitt
Copy link
Contributor

liggitt commented Jun 19, 2018

the doc improvement was all I noticed.

I had a hard time following the exchange between clayton and ben at #44 (comment). lgtm assuming that was resolved.

@bparees
Copy link
Contributor

bparees commented Jun 19, 2018

after this merges it will need to be cherry-picked into temporary-pre-3.11 and then origin can be bumped.

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 20, 2018
When user adds ICT to BC, the `image_trigger_controller` starts a build and this
may not be desired for certain scenarios. Setting `Paused: true` tells
the controller to not trigger the build.
@wozniakjan wozniakjan force-pushed the feature/imagechangetrigger branch from a621699 to 73d66ef Compare June 25, 2018 10:29
@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 25, 2018
@bparees bparees merged commit 64db63c into openshift:master Jun 25, 2018
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/api that referenced this pull request Feb 1, 2021
fix(crd): Fix CRD validation falsely error on unused CRD versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants