Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/docs/apis-build.openshift.io/v1.BuildConfig.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ Populated by the system. Read-only. More info: http://kubernetes.io/docs/user-gu
</div><div style="margin-left:13px;"> <span title="(string) Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency">resourceVersion</span>:
</div><div style="margin-left:13px;"> <span title="(string) UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids">uid</span>:
</div></details><div style="margin-left:13px;"> <span title="(string) lastTriggeredImageID is used internally by the ImageChangeController to save last used image ID for build">lastTriggeredImageID</span>:
</div><div style="margin-left:13px;"> <span title="(boolean) paused is true if this trigger is temporarily disabled. Optional.">paused</span>:
</div></details><div style="margin-left:13px;"> <span title="(string) type is the type of build trigger">type</span>:
</div></details></details><details><summary><span title="(v1.BuildConfigStatus) status holds any relevant information about a build config">status</span>:
</summary><div style="margin-left:13px;"> <span title="(integer) lastVersion is used to inform about number of last triggered build.">lastVersion</span>:
Expand Down
1 change: 1 addition & 0 deletions api/docs/oapi/v1.BuildConfig.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ Populated by the system. Read-only. More info: http://kubernetes.io/docs/user-gu
</div><div style="margin-left:13px;"> <span title="(string) Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency">resourceVersion</span>:
</div><div style="margin-left:13px;"> <span title="(string) UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids">uid</span>:
</div></details><div style="margin-left:13px;"> <span title="(string) lastTriggeredImageID is used internally by the ImageChangeController to save last used image ID for build">lastTriggeredImageID</span>:
</div><div style="margin-left:13px;"> <span title="(boolean) paused is true if this trigger is temporarily disabled. Optional.">paused</span>:
</div></details><div style="margin-left:13px;"> <span title="(string) type is the type of build trigger">type</span>:
</div></details></details><details><summary><span title="(v1.BuildConfigStatus) status holds any relevant information about a build config">status</span>:
</summary><div style="margin-left:13px;"> <span title="(integer) lastVersion is used to inform about number of last triggered build.">lastVersion</span>:
Expand Down
3 changes: 3 additions & 0 deletions api/protobuf-spec/github_com_openshift_api_build_v1.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions api/swagger-spec/oapi-v1.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions api/swagger-spec/openshift-openapi-spec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 16 additions & 6 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/build/apis/build/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,9 @@ type ImageChangeTrigger struct {
// will be used. Only one ImageChangeTrigger with an empty From reference is allowed in
// a build configuration.
From *kapi.ObjectReference

// Paused is true if this trigger is temporarily disabled. Optional.
Paused bool
}

// BuildTriggerPolicy describes a policy for a single trigger that results in a new Build.
Expand Down
2 changes: 2 additions & 0 deletions pkg/build/apis/build/v1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/image/trigger/buildconfigs/buildconfigs.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ func (r *buildConfigReactor) ImageChanged(obj runtime.Object, tagRetriever trigg
if p == nil || (p.From != nil && p.From.Kind != "ImageStreamTag") {
continue
}
if p.Paused {
glog.V(5).Infof("Skipping paused build on bc: %s/%s for trigger: %s", bc.Namespace, bc.Name, t)
continue
}
var from *kapi.ObjectReference
if p.From != nil {
from = p.From
Expand Down
34 changes: 34 additions & 0 deletions pkg/image/trigger/buildconfigs/buildconfigs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,40 @@ func TestBuildConfigReactor(t *testing.T) {
map[string]string{"stream-1:1": "image-lookup-1"},
),
},

{
// won't fire because it is paused
tags: []fakeTagResponse{{Namespace: "other", Name: "stream-1:1", Ref: "image-lookup-1", RV: 2}},
obj: testBuildConfig([]buildapi.ImageChangeTrigger{
{
From: &kapi.ObjectReference{Name: "stream-1:1", Namespace: "other", Kind: "ImageStreamTag"},
Paused: true,
},
}),
},

{
// will fire only for unpaused if multiple triggers are resolved
tags: []fakeTagResponse{
{Namespace: "other", Name: "stream-1:1", Ref: "image-lookup-1", RV: 2},
{Namespace: "other", Name: "stream-2:1", Ref: "image-lookup-2", RV: 2},
},
obj: testBuildConfig([]buildapi.ImageChangeTrigger{
{
From: &kapi.ObjectReference{Name: "stream-1:1", Namespace: "other", Kind: "ImageStreamTag"},
Paused: true,
},
{
From: &kapi.ObjectReference{Name: "stream-2:1", Namespace: "other", Kind: "ImageStreamTag"},
},
}),
response: &buildapi.Build{},
expected: testBuildRequest(
&kapi.ObjectReference{Name: "stream-2:1", Namespace: "other", Kind: "ImageStreamTag"},
"image-lookup-2",
map[string]string{"stream-2:1": "image-lookup-2"},
),
},
}

for i, test := range testCases {
Expand Down
7 changes: 7 additions & 0 deletions pkg/openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading