Skip to content

Commit 90fc417

Browse files
committed
Bug 1366936: fix ICT matching in the trigger controller
1 parent 5d96c1f commit 90fc417

File tree

3 files changed

+86
-3
lines changed

3 files changed

+86
-3
lines changed

pkg/deploy/controller/generictrigger/controller.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,15 @@ func triggeredByDifferentImage(ictParams deployapi.DeploymentTriggerImageChangeP
190190
continue
191191
}
192192

193-
if t.ImageChangeParams.From.Name != ictParams.From.Name &&
193+
if t.ImageChangeParams.From.Name != ictParams.From.Name ||
194194
t.ImageChangeParams.From.Namespace != ictParams.From.Namespace {
195195
continue
196196
}
197-
198-
return t.ImageChangeParams.LastTriggeredImage != ictParams.LastTriggeredImage
197+
if t.ImageChangeParams.LastTriggeredImage != ictParams.LastTriggeredImage {
198+
glog.V(4).Infof("Deployment config %q triggered by different image: %s -> %s", previous.Name, t.ImageChangeParams.LastTriggeredImage, ictParams.LastTriggeredImage)
199+
return true
200+
}
201+
return false
199202
}
200203
return false
201204
}

test/extended/deployments/deployments.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var _ = g.Describe("deploymentconfigs", func() {
3333
brokenDeploymentFixture = exutil.FixturePath("testdata", "test-deployment-broken.yaml")
3434
historyLimitedDeploymentFixture = exutil.FixturePath("testdata", "deployment-history-limit.yaml")
3535
minReadySecondsFixture = exutil.FixturePath("testdata", "deployment-min-ready-seconds.yaml")
36+
multipleICTFixture = exutil.FixturePath("testdata", "deployment-example.yaml")
3637
)
3738

3839
g.Describe("when run iteratively", func() {
@@ -242,6 +243,20 @@ var _ = g.Describe("deploymentconfigs", func() {
242243
})
243244
})
244245

246+
g.Describe("with multiple image change triggers", func() {
247+
g.AfterEach(func() {
248+
failureTrap(oc, "example", g.CurrentGinkgoTestDescription().Failed)
249+
})
250+
251+
g.It("should run a successful deployment [Conformance]", func() {
252+
_, name, err := createFixture(oc, multipleICTFixture)
253+
o.Expect(err).NotTo(o.HaveOccurred())
254+
255+
g.By("verifying the deployment is marked complete")
256+
o.Expect(waitForLatestCondition(oc, name, deploymentRunTimeout, deploymentReachedCompletion)).NotTo(o.HaveOccurred())
257+
})
258+
})
259+
245260
g.Describe("with enhanced status", func() {
246261
g.AfterEach(func() {
247262
failureTrap(oc, "deployment-simple", g.CurrentGinkgoTestDescription().Failed)
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
apiVersion: v1
2+
items:
3+
- apiVersion: v1
4+
kind: DeploymentConfig
5+
metadata:
6+
labels:
7+
app: example
8+
name: example
9+
spec:
10+
replicas: 1
11+
template:
12+
metadata:
13+
labels:
14+
app: example
15+
spec:
16+
containers:
17+
- imagePullPolicy: Always
18+
name: ruby
19+
command:
20+
- /bin/sleep
21+
- "100"
22+
ports:
23+
- containerPort: 8080
24+
protocol: TCP
25+
resources: {}
26+
terminationMessagePath: /dev/termination-log
27+
- imagePullPolicy: Always
28+
name: mongodb
29+
command:
30+
- /bin/sleep
31+
- "100"
32+
ports:
33+
- containerPort: 5000
34+
protocol: TCP
35+
resources: {}
36+
terminationMessagePath: /dev/termination-log
37+
dnsPolicy: ClusterFirst
38+
restartPolicy: Always
39+
securityContext: {}
40+
terminationGracePeriodSeconds: 30
41+
test: false
42+
triggers:
43+
- type: ConfigChange
44+
- imageChangeParams:
45+
automatic: true
46+
containerNames:
47+
- ruby
48+
from:
49+
kind: ImageStreamTag
50+
name: ruby:latest
51+
namespace: openshift
52+
type: ImageChange
53+
- imageChangeParams:
54+
automatic: true
55+
containerNames:
56+
- mongodb
57+
from:
58+
kind: ImageStreamTag
59+
name: mongodb:latest
60+
namespace: openshift
61+
type: ImageChange
62+
status:
63+
observedGeneration: 1
64+
kind: List
65+
metadata: {}

0 commit comments

Comments
 (0)