Skip to content
This repository was archived by the owner on Dec 20, 2025. It is now read-only.

Commit a746c72

Browse files
Merge pull request #1790 from anotherchrisberry/rebakery
surface rebake option on manual execution, include details in pipeline
2 parents 426d613 + d647d17 commit a746c72

14 files changed

Lines changed: 455 additions & 85 deletions

app/scripts/modules/core/delivery/executionGroup/executionGroup.directive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ module.exports = angular
9595
this.triggerPipeline = () => {
9696
$uibModal.open({
9797
templateUrl: require('../manualExecution/manualPipelineExecution.html'),
98-
controller: 'ManualPipelineExecutionCtrl as ctrl',
98+
controller: 'ManualPipelineExecutionCtrl as vm',
9999
resolve: {
100100
pipeline: () => this.pipelineConfig,
101101
application: () => this.application,

app/scripts/modules/core/delivery/executions/executions.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ module.exports = angular.module('spinnaker.core.delivery.executions.controller',
128128
this.triggerPipeline = () => {
129129
$uibModal.open({
130130
templateUrl: require('../manualExecution/manualPipelineExecution.html'),
131-
controller: 'ManualPipelineExecutionCtrl as ctrl',
131+
controller: 'ManualPipelineExecutionCtrl as vm',
132132
resolve: {
133133
pipeline: () => null,
134134
application: () => this.application,

app/scripts/modules/core/delivery/manualExecution/manualPipelineExecution.controller.js

Lines changed: 60 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,34 @@
33
let angular = require('angular');
44

55
module.exports = angular.module('spinnaker.core.delivery.manualPipelineExecution.controller', [
6+
require('angular-ui-bootstrap'),
67
require('../../utils/lodash.js'),
78
require('../../pipeline/config/triggers/jenkins/jenkinsTrigger.module.js'),
9+
require('../../ci/jenkins/igor.service.js'),
810
])
9-
.controller('ManualPipelineExecutionCtrl', function($scope, $filter, _, igorService, $modalInstance, pipeline, application) {
11+
.controller('ManualPipelineExecutionCtrl', function (_, igorService, $modalInstance, pipeline, application) {
1012

11-
$scope.pipeline = pipeline;
12-
13-
$scope.application = application;
14-
15-
if (!pipeline) {
16-
$scope.pipelineOptions = application.pipelineConfigs;
17-
}
18-
19-
$scope.command = {
13+
this.command = {
2014
pipeline: pipeline,
2115
trigger: null,
2216
selectedBuild: null,
2317
};
2418

19+
this.viewState = {
20+
buildsLoading: true,
21+
};
22+
2523
let addTriggers = () => {
26-
if (!$scope.command.pipeline) {
27-
$scope.command.trigger = null;
24+
if (!this.command.pipeline) {
25+
this.command.trigger = null;
2826
return;
2927
}
3028

31-
$scope.triggers = _.chain($scope.command.pipeline.triggers)
29+
this.triggers = _.chain(this.command.pipeline.triggers)
3230
.filter('type', 'jenkins')
3331
.sortBy('enabled')
34-
.map(function (trigger) {
32+
.reverse()
33+
.map((trigger) => {
3534
var copy = _.clone(trigger);
3635
copy.buildNumber = null;
3736
copy.type = 'manual';
@@ -40,81 +39,90 @@ module.exports = angular.module('spinnaker.core.delivery.manualPipelineExecution
4039
})
4140
.value();
4241

43-
$scope.command.trigger = _.first($scope.triggers);
44-
$scope.builds = [];
42+
this.command.trigger = _.first(this.triggers);
43+
this.builds = [];
4544
};
4645

47-
$scope.viewState = {
48-
triggering: false,
49-
buildsLoading: true,
50-
};
5146

52-
$scope.triggerUpdated = function(trigger) {
53-
$scope.viewState.buildsLoading = true;
54-
let command = $scope.command;
47+
/**
48+
* Controller API
49+
*/
50+
51+
this.triggerUpdated = (trigger) => {
52+
this.viewState.buildsLoading = true;
53+
let command = this.command;
5554

5655
if( trigger !== undefined ) {
5756
command.trigger = trigger;
5857
}
5958

6059
if (command.trigger) {
61-
$scope.viewState.buildsLoading = true;
62-
igorService.listBuildsForJob(command.trigger.master, command.trigger.job).then(function(builds) {
63-
$scope.builds = _.filter(builds, {building: false, result: 'SUCCESS'});
60+
this.viewState.buildsLoading = true;
61+
igorService.listBuildsForJob(command.trigger.master, command.trigger.job).then((builds) => {
62+
this.builds = _.filter(builds, {building: false, result: 'SUCCESS'});
6463
if (!angular.isDefined(command.trigger.build)) {
65-
command.selectedBuild = $scope.builds[0];
64+
command.selectedBuild = this.builds[0];
6665
}
67-
$scope.viewState.buildsLoading = false;
66+
this.viewState.buildsLoading = false;
6867
});
6968
} else {
70-
$scope.builds = [];
71-
$scope.viewState.buildsLoading = false;
69+
this.builds = [];
70+
this.viewState.buildsLoading = false;
7271
}
7372
};
7473

75-
$scope.pipelineSelected = () => {
76-
let pipeline = $scope.command.pipeline,
74+
this.pipelineSelected = () => {
75+
let pipeline = this.command.pipeline,
7776
executions = application.executions || [];
78-
$scope.currentlyRunningExecutions = executions
77+
this.currentlyRunningExecutions = executions
7978
.filter((execution) => execution.pipelineConfigId === pipeline.id && execution.isActive);
8079
addTriggers();
81-
$scope.triggerUpdated();
82-
if (pipeline.parameterConfig !== undefined && pipeline.parameterConfig.length){
83-
$scope.parameters = {};
84-
_.each(pipeline.parameterConfig, function(parameter) {
85-
$scope.parameters[parameter.name] = parameter.default;
86-
});
87-
}
80+
this.triggerUpdated();
8881

89-
};
82+
this.showRebakeOption = pipeline.stages.some((stage) => stage.type === 'bake');
9083

84+
if (pipeline.parameterConfig !== undefined && pipeline.parameterConfig.length) {
85+
this.parameters = {};
86+
pipeline.parameterConfig.forEach((parameter) => {
87+
this.parameters[parameter.name] = parameter.default;
88+
});
89+
}
9190

92-
$scope.updateSelectedBuild = function(item) {
93-
$scope.command.selectedBuild = item;
9491
};
9592

96-
this.cancel = function() {
97-
$modalInstance.dismiss();
93+
this.updateSelectedBuild = (item) => {
94+
this.command.selectedBuild = item;
9895
};
9996

100-
this.execute = function() {
101-
let selectedTrigger = $scope.command.trigger || {},
97+
this.execute = () => {
98+
let selectedTrigger = this.command.trigger || {},
10299
command = { trigger: selectedTrigger },
103-
pipeline = $scope.command.pipeline;
100+
pipeline = this.command.pipeline;
104101

105102
command.pipelineName = pipeline.name;
106103

107-
if (selectedTrigger && $scope.command.selectedBuild) {
108-
selectedTrigger.buildNumber = $scope.command.selectedBuild.number;
104+
if (selectedTrigger && this.command.selectedBuild) {
105+
selectedTrigger.buildNumber = this.command.selectedBuild.number;
109106
}
110107
if (pipeline.parameterConfig !== undefined && pipeline.parameterConfig.length) {
111-
selectedTrigger.parameters = $scope.parameters;
108+
selectedTrigger.parameters = this.parameters;
112109
}
113110
$modalInstance.close(command);
114111
};
115112

113+
this.cancel = $modalInstance.dismiss;
114+
115+
116+
/**
117+
* Initialization
118+
*/
119+
116120
if (pipeline) {
117-
$scope.pipelineSelected();
121+
this.pipelineSelected();
122+
}
123+
124+
if (!pipeline) {
125+
this.pipelineOptions = application.pipelineConfigs;
118126
}
119127

120128
}).name;

0 commit comments

Comments
 (0)