@spinnaker/azure 0.3.31 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/pipeline/stages/bake/azureBakeStage.js +112 -18
- package/src/pipeline/stages/bake/bakeStage.html +88 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spinnaker/azure",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"lib": "npm run build"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@spinnaker/core": "^0.
|
|
16
|
+
"@spinnaker/core": "^0.23.0",
|
|
17
17
|
"@uirouter/angularjs": "1.0.26",
|
|
18
18
|
"angular": "1.6.10",
|
|
19
19
|
"angular-ui-bootstrap": "2.5.0",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"shx": "0.3.3",
|
|
36
36
|
"typescript": "4.3.5"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "4d61e53884040e8cae45d29b398c88e3814c6aca"
|
|
39
39
|
}
|
|
@@ -4,6 +4,7 @@ import { module } from 'angular';
|
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
+
AccountService,
|
|
7
8
|
AuthenticationService,
|
|
8
9
|
BakeExecutionLabel,
|
|
9
10
|
BakeryReader,
|
|
@@ -13,10 +14,16 @@ import {
|
|
|
13
14
|
} from '@spinnaker/core';
|
|
14
15
|
|
|
15
16
|
import { AZURE_PIPELINE_STAGES_BAKE_BAKEEXECUTIONDETAILS_CONTROLLER } from './bakeExecutionDetails.controller';
|
|
17
|
+
import { AZURE_IMAGE_IMAGE_READER } from '../../../image/image.reader';
|
|
18
|
+
import { AZURE_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER_SERVICE } from './../../../serverGroup/configure/serverGroupCommandBuilder.service';
|
|
16
19
|
|
|
17
20
|
export const AZURE_PIPELINE_STAGES_BAKE_AZUREBAKESTAGE = 'spinnaker.azure.pipeline.stage.bakeStage';
|
|
18
21
|
export const name = AZURE_PIPELINE_STAGES_BAKE_AZUREBAKESTAGE; // for backwards compatibility
|
|
19
|
-
module(AZURE_PIPELINE_STAGES_BAKE_AZUREBAKESTAGE, [
|
|
22
|
+
module(AZURE_PIPELINE_STAGES_BAKE_AZUREBAKESTAGE, [
|
|
23
|
+
AZURE_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER_SERVICE,
|
|
24
|
+
AZURE_IMAGE_IMAGE_READER,
|
|
25
|
+
AZURE_PIPELINE_STAGES_BAKE_BAKEEXECUTIONDETAILS_CONTROLLER,
|
|
26
|
+
])
|
|
20
27
|
.config(function () {
|
|
21
28
|
Registry.pipeline.registerStage({
|
|
22
29
|
provides: 'bake',
|
|
@@ -50,8 +57,9 @@ module(AZURE_PIPELINE_STAGES_BAKE_AZUREBAKESTAGE, [AZURE_PIPELINE_STAGES_BAKE_BA
|
|
|
50
57
|
.controller('azureBakeStageCtrl', [
|
|
51
58
|
'$scope',
|
|
52
59
|
'$q',
|
|
60
|
+
'azureImageReader',
|
|
53
61
|
'$uibModal',
|
|
54
|
-
function ($scope, $q, $uibModal) {
|
|
62
|
+
function ($scope, $q, azureImageReader, $uibModal) {
|
|
55
63
|
$scope.stage.extendedAttributes = $scope.stage.extendedAttributes || {};
|
|
56
64
|
$scope.stage.regions = $scope.stage.regions || [];
|
|
57
65
|
|
|
@@ -65,10 +73,12 @@ module(AZURE_PIPELINE_STAGES_BAKE_AZUREBAKESTAGE, [AZURE_PIPELINE_STAGES_BAKE_BA
|
|
|
65
73
|
|
|
66
74
|
function initialize() {
|
|
67
75
|
$q.all([
|
|
76
|
+
AccountService.getCredentialsKeyedByAccount('azure'),
|
|
68
77
|
BakeryReader.getRegions('azure'),
|
|
69
78
|
BakeryReader.getBaseOsOptions('azure'),
|
|
70
79
|
BakeryReader.getBaseLabelOptions(),
|
|
71
|
-
]).then(function ([regions, baseOsOptions, baseLabelOptions]) {
|
|
80
|
+
]).then(function ([credentialsKeyedByAccount, regions, baseOsOptions, baseLabelOptions]) {
|
|
81
|
+
$scope.accounts = Object.keys(credentialsKeyedByAccount);
|
|
72
82
|
$scope.regions = regions;
|
|
73
83
|
if ($scope.regions.length === 1) {
|
|
74
84
|
$scope.stage.region = $scope.regions[0];
|
|
@@ -82,32 +92,26 @@ module(AZURE_PIPELINE_STAGES_BAKE_AZUREBAKESTAGE, [AZURE_PIPELINE_STAGES_BAKE_BA
|
|
|
82
92
|
$scope.stage.regions.push($scope.application.defaultRegions.azure);
|
|
83
93
|
}
|
|
84
94
|
$scope.baseOsOptions = baseOsOptions.baseImages;
|
|
85
|
-
if ($scope.baseOsOptions.length) {
|
|
86
|
-
$scope.stage.osType = baseOsOptions.baseImages[0].osType;
|
|
87
|
-
}
|
|
88
95
|
|
|
89
96
|
$scope.baseLabelOptions = baseLabelOptions;
|
|
97
|
+
$scope.osTypeOptions = ['linux', 'windows'];
|
|
98
|
+
$scope.packageTypeOptions = ['DEB', 'RPM'];
|
|
90
99
|
|
|
91
|
-
if (!$scope.stage.baseOs && $scope.baseOsOptions && $scope.baseOsOptions.length) {
|
|
92
|
-
$scope.stage.baseOs = $scope.baseOsOptions[0].id;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (!$scope.stage.baseLabel && $scope.baseLabelOptions && $scope.baseLabelOptions.length) {
|
|
96
|
-
$scope.stage.baseLabel = $scope.baseLabelOptions[0];
|
|
97
|
-
}
|
|
98
100
|
$scope.viewState.roscoMode =
|
|
99
101
|
SETTINGS.feature.roscoMode ||
|
|
100
102
|
(typeof SETTINGS.feature.roscoSelector === 'function' && SETTINGS.feature.roscoSelector($scope.stage));
|
|
101
103
|
$scope.showAdvancedOptions = showAdvanced();
|
|
102
104
|
$scope.viewState.loading = false;
|
|
105
|
+
|
|
106
|
+
if ($scope.stage.managedImage != null) {
|
|
107
|
+
$scope.managedImagesWasChosen = true;
|
|
108
|
+
setManagedImages();
|
|
109
|
+
}
|
|
110
|
+
$scope.defaultImagesWasChosen = $scope.stage.baseOs != null;
|
|
111
|
+
$scope.customImagesWasChosen = $scope.stage.publisher != null;
|
|
103
112
|
});
|
|
104
113
|
}
|
|
105
114
|
|
|
106
|
-
this.baseOsChanged = () => {
|
|
107
|
-
const selectedOption = _.find($scope.baseOsOptions, { id: $scope.stage.baseOs });
|
|
108
|
-
$scope.stage.osType = selectedOption.osType;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
115
|
function stageUpdated() {
|
|
112
116
|
deleteEmptyProperties();
|
|
113
117
|
// Since the selector computes using stage as an input, it needs to be able to recompute roscoMode on updates
|
|
@@ -133,6 +137,33 @@ module(AZURE_PIPELINE_STAGES_BAKE_AZUREBAKESTAGE, [AZURE_PIPELINE_STAGES_BAKE_BA
|
|
|
133
137
|
});
|
|
134
138
|
}
|
|
135
139
|
|
|
140
|
+
function setManagedImages() {
|
|
141
|
+
azureImageReader
|
|
142
|
+
.findImages({ provider: 'azure', managedImages: true, account: $scope.stage.account })
|
|
143
|
+
.then(function (images) {
|
|
144
|
+
let managedImageOptions = [];
|
|
145
|
+
for (let i in images) {
|
|
146
|
+
let image = images[i];
|
|
147
|
+
let newImage = {
|
|
148
|
+
id: image.imageName,
|
|
149
|
+
osType: image.ostype,
|
|
150
|
+
name: image.imageName,
|
|
151
|
+
};
|
|
152
|
+
managedImageOptions.push(newImage);
|
|
153
|
+
}
|
|
154
|
+
$scope.managedImageOptions = managedImageOptions;
|
|
155
|
+
})
|
|
156
|
+
.catch(() => {});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function setRegions() {
|
|
160
|
+
AccountService.getRegionsForAccount($scope.stage.account)
|
|
161
|
+
.then(function (regions) {
|
|
162
|
+
$scope.regions = regions.map((r) => r.name);
|
|
163
|
+
})
|
|
164
|
+
.catch(() => {});
|
|
165
|
+
}
|
|
166
|
+
|
|
136
167
|
this.addExtendedAttribute = function () {
|
|
137
168
|
if (!$scope.stage.extendedAttributes) {
|
|
138
169
|
$scope.stage.extendedAttributes = {};
|
|
@@ -175,6 +206,69 @@ module(AZURE_PIPELINE_STAGES_BAKE_AZUREBAKESTAGE, [AZURE_PIPELINE_STAGES_BAKE_BA
|
|
|
175
206
|
return $scope.viewState.roscoMode || $scope.stage.varFileName;
|
|
176
207
|
};
|
|
177
208
|
|
|
209
|
+
this.showDefaultImages = function () {
|
|
210
|
+
$scope.managedImagesWasChosen = false;
|
|
211
|
+
$scope.defaultImagesWasChosen = true;
|
|
212
|
+
$scope.customImagesWasChosen = false;
|
|
213
|
+
|
|
214
|
+
$scope.stage.managedImage = null;
|
|
215
|
+
$scope.stage.publisher = null;
|
|
216
|
+
$scope.stage.offer = null;
|
|
217
|
+
$scope.stage.sku = null;
|
|
218
|
+
$scope.stage.osType = null;
|
|
219
|
+
$scope.stage.packageType = null;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
this.showManagedImages = function () {
|
|
223
|
+
setManagedImages();
|
|
224
|
+
|
|
225
|
+
$scope.managedImagesWasChosen = true;
|
|
226
|
+
$scope.defaultImagesWasChosen = false;
|
|
227
|
+
$scope.customImagesWasChosen = false;
|
|
228
|
+
|
|
229
|
+
$scope.stage.osType = null;
|
|
230
|
+
$scope.stage.baseOs = null;
|
|
231
|
+
$scope.stage.publisher = null;
|
|
232
|
+
$scope.stage.offer = null;
|
|
233
|
+
$scope.stage.sku = null;
|
|
234
|
+
$scope.stage.packageType = null;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
this.showCustomImages = function () {
|
|
238
|
+
$scope.managedImagesWasChosen = false;
|
|
239
|
+
$scope.defaultImagesWasChosen = false;
|
|
240
|
+
$scope.customImagesWasChosen = true;
|
|
241
|
+
|
|
242
|
+
$scope.stage.baseOs = null;
|
|
243
|
+
$scope.stage.managedImage = null;
|
|
244
|
+
$scope.stage.osType = null;
|
|
245
|
+
$scope.stage.packageType = null;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
this.onChangeAccount = () => {
|
|
249
|
+
$scope.stage.osType = null;
|
|
250
|
+
$scope.stage.packageType = null;
|
|
251
|
+
$scope.stage.managedImage = null;
|
|
252
|
+
|
|
253
|
+
if ($scope.stage.account) {
|
|
254
|
+
setRegions();
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if ($scope.managedImagesWasChosen) {
|
|
258
|
+
setManagedImages();
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
$scope.onChangeManagedImage = () => {
|
|
263
|
+
$scope.stage.packageType = null;
|
|
264
|
+
const selectedManagedImage = _.find($scope.managedImageOptions, { id: $scope.stage.managedImage });
|
|
265
|
+
$scope.stage.osType = selectedManagedImage.osType.toLowerCase();
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
this.onChangeOsType = function (e) {
|
|
269
|
+
$scope.stage.packageType = null;
|
|
270
|
+
};
|
|
271
|
+
|
|
178
272
|
$scope.$watch('stage', stageUpdated, true);
|
|
179
273
|
|
|
180
274
|
initialize();
|
|
@@ -3,15 +3,100 @@
|
|
|
3
3
|
<loading-spinner size="'small'"></loading-spinner>
|
|
4
4
|
</div>
|
|
5
5
|
<div ng-if="!viewState.loading">
|
|
6
|
+
<stage-config-field label="Account">
|
|
7
|
+
<account-select-field
|
|
8
|
+
component="stage"
|
|
9
|
+
field="account"
|
|
10
|
+
accounts="accounts"
|
|
11
|
+
provider="'azure'"
|
|
12
|
+
on-change="bakeStageCtrl.onChangeAccount()"
|
|
13
|
+
/>
|
|
14
|
+
</stage-config-field>
|
|
15
|
+
|
|
6
16
|
<stage-config-field label="Regions">
|
|
7
17
|
<checklist items="regions" model="stage.regions" inline="true" include-select-all-button="true"></checklist>
|
|
8
18
|
</stage-config-field>
|
|
19
|
+
|
|
20
|
+
<div class="panel panel-default">
|
|
21
|
+
<div class="panel-heading">
|
|
22
|
+
<label class="col-md-3 sm-label-right"></label>
|
|
23
|
+
<div class="btn-group btn-group-xs" role="group" aria-label="Source Image">
|
|
24
|
+
<button
|
|
25
|
+
class="btn btn-default"
|
|
26
|
+
aria-pressed="true"
|
|
27
|
+
ng-click="bakeStageCtrl.showDefaultImages()"
|
|
28
|
+
ng-class="{active: defaultImagesWasChosen}"
|
|
29
|
+
>
|
|
30
|
+
Default Images
|
|
31
|
+
</button>
|
|
32
|
+
<button
|
|
33
|
+
class="btn btn-default"
|
|
34
|
+
aria-pressed="true"
|
|
35
|
+
ng-click="bakeStageCtrl.showManagedImages()"
|
|
36
|
+
ng-class="{active: managedImagesWasChosen}"
|
|
37
|
+
>
|
|
38
|
+
Managed Images
|
|
39
|
+
</button>
|
|
40
|
+
<button
|
|
41
|
+
class="btn btn-default"
|
|
42
|
+
aria-pressed="true"
|
|
43
|
+
ng-click="bakeStageCtrl.showCustomImages()"
|
|
44
|
+
ng-class="{active: customImagesWasChosen}"
|
|
45
|
+
>
|
|
46
|
+
Custom Image
|
|
47
|
+
</button>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div class="panel-body">
|
|
52
|
+
<stage-config-field label="Base OS" ng-show="defaultImagesWasChosen">
|
|
53
|
+
<bake-stage-choose-os model="stage.baseOs" base-os-options="baseOsOptions"></bake-stage-choose-os>
|
|
54
|
+
</stage-config-field>
|
|
55
|
+
|
|
56
|
+
<stage-config-field label="Managed Image" ng-show="managedImagesWasChosen">
|
|
57
|
+
<bake-stage-choose-managed-image
|
|
58
|
+
model="stage.managedImage"
|
|
59
|
+
managed-image-options="managedImageOptions"
|
|
60
|
+
on-change="onChangeManagedImage"
|
|
61
|
+
></bake-stage-choose-managed-image>
|
|
62
|
+
</stage-config-field>
|
|
63
|
+
|
|
64
|
+
<stage-config-field label="Publisher" ng-show="customImagesWasChosen">
|
|
65
|
+
<input type="text" class="form-control input-sm" ng-model="stage.publisher" />
|
|
66
|
+
</stage-config-field>
|
|
67
|
+
<stage-config-field label="Offer" ng-show="customImagesWasChosen">
|
|
68
|
+
<input type="text" class="form-control input-sm" ng-model="stage.offer" />
|
|
69
|
+
</stage-config-field>
|
|
70
|
+
<stage-config-field label="SKU" ng-show="customImagesWasChosen">
|
|
71
|
+
<input type="text" class="form-control input-sm" ng-model="stage.sku" />
|
|
72
|
+
</stage-config-field>
|
|
73
|
+
|
|
74
|
+
<stage-config-field label="OS Type" ng-show="customImagesWasChosen">
|
|
75
|
+
<label class="radio-inline" ng-repeat="osType in osTypeOptions">
|
|
76
|
+
<input
|
|
77
|
+
type="radio"
|
|
78
|
+
ng-model="stage.osType"
|
|
79
|
+
ng-value="osType"
|
|
80
|
+
name="osType"
|
|
81
|
+
ng-change="bakeStageCtrl.onChangeOsType(value)"
|
|
82
|
+
/>
|
|
83
|
+
{{osType}}
|
|
84
|
+
</label>
|
|
85
|
+
</stage-config-field>
|
|
86
|
+
|
|
87
|
+
<stage-config-field label="Package Type" ng-show="stage.osType === 'linux'">
|
|
88
|
+
<label class="radio-inline" ng-repeat="packageType in packageTypeOptions">
|
|
89
|
+
<input type="radio" ng-model="stage.packageType" ng-value="packageType" name="packageType" />
|
|
90
|
+
{{packageType}}
|
|
91
|
+
</label>
|
|
92
|
+
</stage-config-field>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
9
96
|
<stage-config-field label="Package" help-key="pipeline.config.bake.package">
|
|
10
97
|
<input type="text" class="form-control input-sm" ng-model="stage.package" />
|
|
11
98
|
</stage-config-field>
|
|
12
|
-
|
|
13
|
-
<bake-stage-choose-os model="stage.baseOs" base-os-options="baseOsOptions"></bake-stage-choose-os>
|
|
14
|
-
</stage-config-field>
|
|
99
|
+
|
|
15
100
|
<stage-config-field label="Base Label">
|
|
16
101
|
<label class="radio-inline" ng-repeat="baseLabel in baseLabelOptions">
|
|
17
102
|
<input type="radio" ng-model="stage.baseLabel" ng-value="baseLabel" />
|