Skip to content

Commit dd195cf

Browse files
committed
Add trigger, but set automatic to false
If a user unchecks the deploy automatically on new images, still add the image change trigger, but set automatic to false. This avoids image pull errors.
1 parent 668739b commit dd195cf

File tree

5 files changed

+25
-21
lines changed

5 files changed

+25
-21
lines changed

app/scripts/services/applicationGenerator.js

+13-15
Original file line numberDiff line numberDiff line change
@@ -220,23 +220,21 @@ angular.module("openshiftConsole")
220220
}
221221
}
222222
};
223-
if(input.deploymentConfig.deployOnNewImage){
224-
deploymentConfig.spec.triggers.push(
225-
{
226-
type: "ImageChange",
227-
imageChangeParams: {
228-
automatic: true,
229-
containerNames: [
230-
input.name
231-
],
232-
from: {
233-
kind: imageSpec.kind,
234-
name: imageSpec.toString()
235-
}
223+
deploymentConfig.spec.triggers.push(
224+
{
225+
type: "ImageChange",
226+
imageChangeParams: {
227+
automatic: !!input.deploymentConfig.deployOnNewImage,
228+
containerNames: [
229+
input.name
230+
],
231+
from: {
232+
kind: imageSpec.kind,
233+
name: imageSpec.toString()
236234
}
237235
}
238-
);
239-
}
236+
}
237+
);
240238
if (input.deploymentConfig.deployOnConfigChange) {
241239
deploymentConfig.spec.triggers.push({type: "ConfigChange"});
242240
}

app/views/_triggers.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</div>
2020
<div class="build-phase">
2121
<status-icon status="build.status.phase"></status-icon>
22-
{{build.status.phase}}<span ng-if="build | isIncompleteBuild">. A new deployment will be created automatically once the build completes.</span>
22+
{{build.status.phase}}<span ng-if="(build | isIncompleteBuild) && trigger.imageChangeParams.automatic">. A new deployment will be created automatically once the build completes.</span>
2323
</div>
2424
<relative-timestamp timestamp="build.metadata.creationTimestamp" class="build-timestamp"></relative-timestamp>
2525
<div ng-if="'builds/log' | canI : 'get'" class="build-links">

app/views/browse/deployment-config.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,10 @@ <h3>Triggers</h3>
210210
<span ng-switch-default>{{trigger.type}}</span>
211211
<span ng-switch-when="ImageChange" ng-if="trigger.imageChangeParams.from">
212212
<dt>New Image For:</dt>
213-
<dd>{{trigger.imageChangeParams.from | imageObjectRef : deploymentConfig.metadata.namespace}}</dd>
213+
<dd>
214+
{{trigger.imageChangeParams.from | imageObjectRef : deploymentConfig.metadata.namespace}}
215+
<small ng-if="!trigger.imageChangeParams.automatic" class="text-muted">(disabled)</small>
216+
</dd>
214217
</span>
215218
<span ng-switch-when="ConfigChange">
216219
<dt>Change Of:</dt>

dist/scripts/scripts.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1765,10 +1765,10 @@ containers:[ g ]
17651765
}
17661766
}
17671767
};
1768-
return a.deploymentConfig.deployOnNewImage && h.spec.triggers.push({
1768+
return h.spec.triggers.push({
17691769
type:"ImageChange",
17701770
imageChangeParams:{
1771-
automatic:!0,
1771+
automatic:!!a.deploymentConfig.deployOnNewImage,
17721772
containerNames:[ a.name ],
17731773
from:{
17741774
kind:b.kind,

dist/scripts/templates.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
743743
"</div>\n" +
744744
"<div class=\"build-phase\">\n" +
745745
"<status-icon status=\"build.status.phase\"></status-icon>\n" +
746-
"{{build.status.phase}}<span ng-if=\"build | isIncompleteBuild\">. A new deployment will be created automatically once the build completes.</span>\n" +
746+
"{{build.status.phase}}<span ng-if=\"(build | isIncompleteBuild) && trigger.imageChangeParams.automatic\">. A new deployment will be created automatically once the build completes.</span>\n" +
747747
"</div>\n" +
748748
"<relative-timestamp timestamp=\"build.metadata.creationTimestamp\" class=\"build-timestamp\"></relative-timestamp>\n" +
749749
"<div ng-if=\"'builds/log' | canI : 'get'\" class=\"build-links\">\n" +
@@ -2117,7 +2117,10 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
21172117
"<span ng-switch-default>{{trigger.type}}</span>\n" +
21182118
"<span ng-switch-when=\"ImageChange\" ng-if=\"trigger.imageChangeParams.from\">\n" +
21192119
"<dt>New Image For:</dt>\n" +
2120-
"<dd>{{trigger.imageChangeParams.from | imageObjectRef : deploymentConfig.metadata.namespace}}</dd>\n" +
2120+
"<dd>\n" +
2121+
"{{trigger.imageChangeParams.from | imageObjectRef : deploymentConfig.metadata.namespace}}\n" +
2122+
"<small ng-if=\"!trigger.imageChangeParams.automatic\" class=\"text-muted\">(disabled)</small>\n" +
2123+
"</dd>\n" +
21212124
"</span>\n" +
21222125
"<span ng-switch-when=\"ConfigChange\">\n" +
21232126
"<dt>Change Of:</dt>\n" +

0 commit comments

Comments
 (0)