@spinnaker/appengine 0.0.0-2025.1-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.
Files changed (138) hide show
  1. package/CHANGELOG.md +981 -0
  2. package/LICENSE.txt +203 -0
  3. package/dist/appengine.logoc2c312af6aa99037.png +0 -0
  4. package/dist/appengine.module.d.ts +5 -0
  5. package/dist/appengine.settings.d.ts +7 -0
  6. package/dist/common/FormikAccountRegionSelector.d.ts +26 -0
  7. package/dist/common/appengineHealth.d.ts +3 -0
  8. package/dist/common/componentUrlDetails.component.d.ts +1 -0
  9. package/dist/common/conditionalDescriptionListItem.component.d.ts +1 -0
  10. package/dist/common/loadBalancerMessage.component.d.ts +1 -0
  11. package/dist/domain/IAppengineAccount.d.ts +6 -0
  12. package/dist/domain/IAppengineInstance.d.ts +20 -0
  13. package/dist/domain/IAppengineLoadBalancer.d.ts +19 -0
  14. package/dist/domain/IAppengineServerGroup.d.ts +11 -0
  15. package/dist/domain/IAppengineStageScope.d.ts +18 -0
  16. package/dist/domain/IAppengineTriggers.d.ts +11 -0
  17. package/dist/domain/index.d.ts +6 -0
  18. package/dist/helpContents/appengineHelpContents.d.ts +1 -0
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +4084 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/instance/details/details.controller.d.ts +1 -0
  23. package/dist/loadBalancer/configure/wizard/advancedSettings.component.d.ts +1 -0
  24. package/dist/loadBalancer/configure/wizard/allocationConfigurationRow.component.d.ts +1 -0
  25. package/dist/loadBalancer/configure/wizard/basicSettings.component.d.ts +1 -0
  26. package/dist/loadBalancer/configure/wizard/stageAllocationConfigurationRow.component.d.ts +1 -0
  27. package/dist/loadBalancer/configure/wizard/wizard.controller.d.ts +2 -0
  28. package/dist/loadBalancer/details/details.controller.d.ts +1 -0
  29. package/dist/loadBalancer/loadBalancer.module.d.ts +1 -0
  30. package/dist/loadBalancer/transformer.d.ts +40 -0
  31. package/dist/pipeline/pipeline.module.d.ts +1 -0
  32. package/dist/pipeline/stages/appengineStage.controller.d.ts +12 -0
  33. package/dist/pipeline/stages/deployAppengineConfig/DeployAppengineConfigForm.d.ts +16 -0
  34. package/dist/pipeline/stages/deployAppengineConfig/DeployAppengineConfigurationConfig.d.ts +5 -0
  35. package/dist/pipeline/stages/deployAppengineConfig/deployAppengineConfigStage.d.ts +1 -0
  36. package/dist/pipeline/stages/destroyAsg/appengineDestroyAsgStage.d.ts +1 -0
  37. package/dist/pipeline/stages/disableAsg/appengineDisableAsgStage.d.ts +1 -0
  38. package/dist/pipeline/stages/editLoadBalancer/appengineEditLoadBalancerStage.d.ts +1 -0
  39. package/dist/pipeline/stages/editLoadBalancer/loadBalancerChoice.modal.controller.d.ts +1 -0
  40. package/dist/pipeline/stages/enableAsg/appengineEnableAsgStage.d.ts +1 -0
  41. package/dist/pipeline/stages/shrinkCluster/appengineShrinkClusterStage.d.ts +1 -0
  42. package/dist/pipeline/stages/startServerGroup/appengineStartServerGroupStage.d.ts +1 -0
  43. package/dist/pipeline/stages/stopServerGroup/appengineStopServerGroupStage.d.ts +1 -0
  44. package/dist/serverGroup/configure/serverGroupCommandBuilder.service.d.ts +74 -0
  45. package/dist/serverGroup/configure/wizard/ConfigFileArtifactList.d.ts +10 -0
  46. package/dist/serverGroup/configure/wizard/basicSettings.controller.d.ts +1 -0
  47. package/dist/serverGroup/configure/wizard/cloneServerGroup.controller.d.ts +2 -0
  48. package/dist/serverGroup/configure/wizard/configFileArtifactList.module.d.ts +1 -0
  49. package/dist/serverGroup/configure/wizard/configFiles.component.d.ts +20 -0
  50. package/dist/serverGroup/configure/wizard/dynamicBranchLabel.component.d.ts +1 -0
  51. package/dist/serverGroup/details/details.controller.d.ts +1 -0
  52. package/dist/serverGroup/transformer.d.ts +45 -0
  53. package/dist/serverGroup/writer/serverGroup.write.service.d.ts +8 -0
  54. package/dist/validation/ApplicationNameValidator.d.ts +1 -0
  55. package/package.json +46 -0
  56. package/src/appengine.module.ts +70 -0
  57. package/src/appengine.settings.ts +14 -0
  58. package/src/common/FormikAccountRegionSelector.tsx +107 -0
  59. package/src/common/appengineHealth.ts +3 -0
  60. package/src/common/componentUrlDetails.component.ts +29 -0
  61. package/src/common/conditionalDescriptionListItem.component.ts +37 -0
  62. package/src/common/loadBalancerMessage.component.html +33 -0
  63. package/src/common/loadBalancerMessage.component.ts +13 -0
  64. package/src/domain/IAppengineAccount.ts +8 -0
  65. package/src/domain/IAppengineInstance.ts +21 -0
  66. package/src/domain/IAppengineLoadBalancer.ts +21 -0
  67. package/src/domain/IAppengineServerGroup.ts +13 -0
  68. package/src/domain/IAppengineStageScope.ts +22 -0
  69. package/src/domain/IAppengineTriggers.ts +12 -0
  70. package/src/domain/index.ts +6 -0
  71. package/src/helpContents/appengineHelpContents.ts +141 -0
  72. package/src/index.ts +1 -0
  73. package/src/instance/details/details.controller.ts +116 -0
  74. package/src/instance/details/details.html +99 -0
  75. package/src/loadBalancer/configure/wizard/advancedSettings.component.ts +56 -0
  76. package/src/loadBalancer/configure/wizard/allocationConfigurationRow.component.ts +70 -0
  77. package/src/loadBalancer/configure/wizard/basicSettings.component.html +65 -0
  78. package/src/loadBalancer/configure/wizard/basicSettings.component.ts +98 -0
  79. package/src/loadBalancer/configure/wizard/stageAllocationConfigurationRow.component.html +117 -0
  80. package/src/loadBalancer/configure/wizard/stageAllocationConfigurationRow.component.ts +108 -0
  81. package/src/loadBalancer/configure/wizard/wizard.controller.ts +163 -0
  82. package/src/loadBalancer/configure/wizard/wizard.html +44 -0
  83. package/src/loadBalancer/configure/wizard/wizard.less +17 -0
  84. package/src/loadBalancer/details/details.controller.ts +151 -0
  85. package/src/loadBalancer/details/details.html +102 -0
  86. package/src/loadBalancer/loadBalancer.module.ts +21 -0
  87. package/src/loadBalancer/transformer.ts +170 -0
  88. package/src/logo/appengine.icon.svg +37 -0
  89. package/src/logo/appengine.logo.less +6 -0
  90. package/src/logo/appengine.logo.png +0 -0
  91. package/src/pipeline/pipeline.module.ts +20 -0
  92. package/src/pipeline/stages/appengineStage.controller.ts +45 -0
  93. package/src/pipeline/stages/deployAppengineConfig/DeployAppengineConfigForm.tsx +203 -0
  94. package/src/pipeline/stages/deployAppengineConfig/DeployAppengineConfigurationConfig.tsx +34 -0
  95. package/src/pipeline/stages/deployAppengineConfig/deployAppengineConfigStage.ts +19 -0
  96. package/src/pipeline/stages/destroyAsg/appengineDestroyAsgStage.ts +45 -0
  97. package/src/pipeline/stages/destroyAsg/destroyAsgStage.html +16 -0
  98. package/src/pipeline/stages/destroyAsg/destroyAsgStepLabel.html +1 -0
  99. package/src/pipeline/stages/disableAsg/appengineDisableAsgStage.ts +54 -0
  100. package/src/pipeline/stages/disableAsg/disableAsgStage.html +18 -0
  101. package/src/pipeline/stages/disableAsg/disableAsgStepLabel.html +1 -0
  102. package/src/pipeline/stages/editLoadBalancer/appengineEditLoadBalancerStage.ts +74 -0
  103. package/src/pipeline/stages/editLoadBalancer/editLoadBalancerExecutionDetails.html +33 -0
  104. package/src/pipeline/stages/editLoadBalancer/editLoadBalancerStage.html +51 -0
  105. package/src/pipeline/stages/editLoadBalancer/loadBalancerChoice.modal.controller.ts +65 -0
  106. package/src/pipeline/stages/editLoadBalancer/loadBalancerChoice.modal.html +45 -0
  107. package/src/pipeline/stages/enableAsg/appengineEnableAsgStage.ts +49 -0
  108. package/src/pipeline/stages/enableAsg/enableAsgStage.html +18 -0
  109. package/src/pipeline/stages/enableAsg/enableAsgStepLabel.html +1 -0
  110. package/src/pipeline/stages/shrinkCluster/appengineShrinkClusterStage.ts +62 -0
  111. package/src/pipeline/stages/shrinkCluster/shrinkClusterStage.html +41 -0
  112. package/src/pipeline/stages/startServerGroup/appengineStartServerGroupStage.ts +54 -0
  113. package/src/pipeline/stages/startServerGroup/startServerGroupExecutionDetails.html +26 -0
  114. package/src/pipeline/stages/startServerGroup/startServerGroupStage.html +18 -0
  115. package/src/pipeline/stages/startServerGroup/startServerGroupStepLabel.html +1 -0
  116. package/src/pipeline/stages/stopServerGroup/appengineStopServerGroupStage.ts +54 -0
  117. package/src/pipeline/stages/stopServerGroup/stopServerGroupExecutionDetails.html +26 -0
  118. package/src/pipeline/stages/stopServerGroup/stopServerGroupStage.html +18 -0
  119. package/src/pipeline/stages/stopServerGroup/stopServerGroupStepLabel.html +1 -0
  120. package/src/serverGroup/configure/serverGroupCommandBuilder.service.ts +235 -0
  121. package/src/serverGroup/configure/wizard/ConfigFileArtifactList.tsx +81 -0
  122. package/src/serverGroup/configure/wizard/advancedSettings.html +33 -0
  123. package/src/serverGroup/configure/wizard/basicSettings.controller.ts +151 -0
  124. package/src/serverGroup/configure/wizard/basicSettings.html +287 -0
  125. package/src/serverGroup/configure/wizard/cloneServerGroup.controller.ts +103 -0
  126. package/src/serverGroup/configure/wizard/configFileArtifactList.module.ts +18 -0
  127. package/src/serverGroup/configure/wizard/configFileArtifactList.spec.tsx +78 -0
  128. package/src/serverGroup/configure/wizard/configFiles.component.html +81 -0
  129. package/src/serverGroup/configure/wizard/configFiles.component.ts +121 -0
  130. package/src/serverGroup/configure/wizard/dynamicBranchLabel.component.ts +19 -0
  131. package/src/serverGroup/configure/wizard/serverGroupWizard.html +39 -0
  132. package/src/serverGroup/configure/wizard/serverGroupWizard.less +28 -0
  133. package/src/serverGroup/details/details.controller.ts +463 -0
  134. package/src/serverGroup/details/details.html +229 -0
  135. package/src/serverGroup/transformer.ts +92 -0
  136. package/src/serverGroup/transformet.spec.ts +40 -0
  137. package/src/serverGroup/writer/serverGroup.write.service.ts +57 -0
  138. package/src/validation/ApplicationNameValidator.ts +40 -0
@@ -0,0 +1,49 @@
1
+ import { module } from 'angular';
2
+
3
+ import { Registry } from '@spinnaker/core';
4
+
5
+ import { AppengineStageCtrl } from '../appengineStage.controller';
6
+ import { AppengineHealth } from '../../../common/appengineHealth';
7
+ import type { IAppengineStageScope } from '../../../domain';
8
+
9
+ class AppengineEnableAsgStageCtrl extends AppengineStageCtrl {
10
+ public static $inject = ['$scope'];
11
+ constructor(protected $scope: IAppengineStageScope) {
12
+ super($scope);
13
+
14
+ super.setAccounts().then(() => {
15
+ super.setStageRegion();
16
+ });
17
+
18
+ super.setStageCloudProvider();
19
+ super.setTargets();
20
+ super.setStageCredentials();
21
+
22
+ if (
23
+ $scope.stage.isNew &&
24
+ $scope.application.attributes.platformHealthOnlyShowOverride &&
25
+ $scope.application.attributes.platformHealthOnly
26
+ ) {
27
+ $scope.stage.interestingHealthProviderNames = [AppengineHealth.PLATFORM];
28
+ }
29
+ }
30
+ }
31
+
32
+ export const APPENGINE_ENABLE_ASG_STAGE = 'spinnaker.appengine.pipeline.stage.enableAsgStage';
33
+
34
+ module(APPENGINE_ENABLE_ASG_STAGE, [])
35
+ .config(() => {
36
+ Registry.pipeline.registerStage({
37
+ provides: 'enableServerGroup',
38
+ key: 'enableServerGroup',
39
+ cloudProvider: 'appengine',
40
+ templateUrl: require('./enableAsgStage.html'),
41
+ executionStepLabelUrl: require('./enableAsgStepLabel.html'),
42
+ validators: [
43
+ { type: 'requiredField', fieldName: 'cluster' },
44
+ { type: 'requiredField', fieldName: 'target' },
45
+ { type: 'requiredField', fieldName: 'credentials', fieldLabel: 'account' },
46
+ ],
47
+ });
48
+ })
49
+ .controller('appengineEnableAsgStageCtrl', AppengineEnableAsgStageCtrl);
@@ -0,0 +1,18 @@
1
+ <div ng-controller="appengineEnableAsgStageCtrl as enableAsgStageCtrl" class="form-horizontal">
2
+ <div ng-if="!pipeline.strategy">
3
+ <account-region-cluster-selector
4
+ application="application"
5
+ component="stage"
6
+ single-region="true"
7
+ disable-region-select="true"
8
+ on-account-update="enableAsgStageCtrl.setStageRegion()"
9
+ accounts="accounts"
10
+ >
11
+ </account-region-cluster-selector>
12
+ </div>
13
+ <stage-config-field label="Target">
14
+ <target-select model="stage" options="targets"></target-select>
15
+ </stage-config-field>
16
+ <stage-platform-health-override application="application" stage="stage" platform-health-type="platformHealth">
17
+ </stage-platform-health-override>
18
+ </div>
@@ -0,0 +1 @@
1
+ <span class="task-label"> Enable Server Group: {{step.context.serverGroupName}} ({{step.context.region}}) </span>
@@ -0,0 +1,62 @@
1
+ import { module } from 'angular';
2
+
3
+ import { Registry } from '@spinnaker/core';
4
+
5
+ import { AppengineStageCtrl } from '../appengineStage.controller';
6
+ import type { IAppengineStage, IAppengineStageScope } from '../../../domain/index';
7
+
8
+ interface IAppengineShrinkClusterStage extends IAppengineStage {
9
+ shrinkToSize: number;
10
+ allowDeleteActive: boolean;
11
+ retainLargerOverNewer: string | boolean;
12
+ }
13
+
14
+ class AppengineShrinkClusterStageCtrl extends AppengineStageCtrl {
15
+ public static $inject = ['$scope'];
16
+ constructor(public $scope: IAppengineStageScope) {
17
+ super($scope);
18
+
19
+ super.setAccounts().then(() => {
20
+ super.setStageRegion();
21
+ });
22
+ super.setStageCloudProvider();
23
+ super.setStageCredentials();
24
+
25
+ const stage = $scope.stage as IAppengineShrinkClusterStage;
26
+ if (stage.shrinkToSize === undefined) {
27
+ stage.shrinkToSize = 1;
28
+ }
29
+
30
+ if (stage.allowDeleteActive === undefined) {
31
+ stage.allowDeleteActive = false;
32
+ }
33
+
34
+ if (stage.retainLargerOverNewer === undefined) {
35
+ stage.retainLargerOverNewer = 'false';
36
+ }
37
+
38
+ stage.retainLargerOverNewer = stage.retainLargerOverNewer.toString();
39
+ }
40
+
41
+ public pluralize(str: string, val: number): string {
42
+ return val === 1 ? str : str + 's';
43
+ }
44
+ }
45
+
46
+ export const APPENGINE_SHRINK_CLUSTER_STAGE = 'spinnaker.appengine.pipeline.stage.shrinkClusterStage';
47
+
48
+ module(APPENGINE_SHRINK_CLUSTER_STAGE, [])
49
+ .config(function () {
50
+ Registry.pipeline.registerStage({
51
+ provides: 'shrinkCluster',
52
+ key: 'shrinkCluster',
53
+ cloudProvider: 'appengine',
54
+ templateUrl: require('./shrinkClusterStage.html'),
55
+ validators: [
56
+ { type: 'requiredField', fieldName: 'cluster' },
57
+ { type: 'requiredField', fieldName: 'shrinkToSize', fieldLabel: 'shrink to [X] Server Groups' },
58
+ { type: 'requiredField', fieldName: 'credentials', fieldLabel: 'account' },
59
+ ],
60
+ });
61
+ })
62
+ .controller('appengineShrinkClusterStageCtrl', AppengineShrinkClusterStageCtrl);
@@ -0,0 +1,41 @@
1
+ <div ng-controller="appengineShrinkClusterStageCtrl as shrinkClusterStageCtrl" class="form-horizontal">
2
+ <div ng-if="!pipeline.strategy">
3
+ <account-region-cluster-selector
4
+ application="application"
5
+ component="stage"
6
+ single-region="true"
7
+ disable-region-select="true"
8
+ on-account-update="shrinkClusterStageCtrl.setStageRegion()"
9
+ accounts="accounts"
10
+ >
11
+ </account-region-cluster-selector>
12
+ </div>
13
+ <stage-config-field label="Shrink Options">
14
+ <div class="form-inline">
15
+ Shrink to
16
+ <input
17
+ type="number"
18
+ min="0"
19
+ required
20
+ ng-model="stage.shrinkToSize"
21
+ class="form-control input-sm"
22
+ style="width: 50px"
23
+ />
24
+ {{shrinkClusterStageCtrl.pluralize('server group', stage.shrinkToSize)}}, keeping the
25
+ <select class="form-control input-sm" ng-model="stage.retainLargerOverNewer" style="width: 100px">
26
+ <option value="true">largest</option>
27
+ <option value="false">newest</option>
28
+ </select>
29
+ </div>
30
+ </stage-config-field>
31
+ <div class="form-group">
32
+ <div class="col-md-offset-3 col-md-6 checkbox">
33
+ <label>
34
+ <input type="checkbox" ng-model="stage.allowDeleteActive" />
35
+ Allow deletion of active server groups
36
+ </label>
37
+ </div>
38
+ </div>
39
+ <stage-platform-health-override application="application" stage="stage" platform-health-type="platformHealth">
40
+ </stage-platform-health-override>
41
+ </div>
@@ -0,0 +1,54 @@
1
+ import { module } from 'angular';
2
+
3
+ import { Registry } from '@spinnaker/core';
4
+
5
+ import { AppengineStageCtrl } from '../appengineStage.controller';
6
+ import { AppengineHealth } from '../../../common/appengineHealth';
7
+ import type { IAppengineStageScope } from '../../../domain';
8
+
9
+ class AppengineStartServerGroupStageCtrl extends AppengineStageCtrl {
10
+ public static $inject = ['$scope'];
11
+ constructor(public $scope: IAppengineStageScope) {
12
+ super($scope);
13
+
14
+ super.setAccounts().then(() => {
15
+ super.setStageRegion();
16
+ });
17
+
18
+ super.setStageCloudProvider();
19
+ super.setTargets();
20
+ super.setStageCredentials();
21
+
22
+ if (
23
+ $scope.stage.isNew &&
24
+ $scope.application.attributes.platformHealthOnlyShowOverride &&
25
+ $scope.application.attributes.platformHealthOnly
26
+ ) {
27
+ $scope.stage.interestingHealthProviderNames = [AppengineHealth.PLATFORM];
28
+ }
29
+ }
30
+ }
31
+
32
+ export const APPENGINE_START_SERVER_GROUP_STAGE = 'spinnaker.appengine.pipeline.stage.startServerGroupStage';
33
+
34
+ module(APPENGINE_START_SERVER_GROUP_STAGE, [])
35
+ .config(() => {
36
+ Registry.pipeline.registerStage({
37
+ label: 'Start Server Group',
38
+ description: 'Starts a server group.',
39
+ key: 'startAppEngineServerGroup',
40
+ templateUrl: require('./startServerGroupStage.html'),
41
+ executionDetailsUrl: require('./startServerGroupExecutionDetails.html'),
42
+ executionConfigSections: ['startServerGroupConfig', 'taskStatus'],
43
+ executionStepLabelUrl: require('./startServerGroupStepLabel.html'),
44
+ controller: 'appengineStartServerGroupStageCtrl',
45
+ controllerAs: 'startServerGroupStageCtrl',
46
+ validators: [
47
+ { type: 'requiredField', fieldName: 'cluster' },
48
+ { type: 'requiredField', fieldName: 'target' },
49
+ { type: 'requiredField', fieldName: 'credentials', fieldLabel: 'account' },
50
+ ],
51
+ cloudProvider: 'appengine',
52
+ });
53
+ })
54
+ .controller('appengineStartServerGroupStageCtrl', AppengineStartServerGroupStageCtrl);
@@ -0,0 +1,26 @@
1
+ <div ng-controller="BaseExecutionDetailsCtrl">
2
+ <execution-details-section-nav sections="configSections"></execution-details-section-nav>
3
+ <div class="step-section-details" ng-if="detailsSection === 'startServerGroupConfig'">
4
+ <div class="row">
5
+ <div class="col-md-9">
6
+ <dl class="dl-narrow dl-horizontal">
7
+ <dt>Account</dt>
8
+ <dd>
9
+ <account-tag account="stage.context.credentials"></account-tag>
10
+ </dd>
11
+ <dt>Region</dt>
12
+ <dd>{{stage.context.region}}</dd>
13
+ <dt>Server Group</dt>
14
+ <dd>{{stage.context.serverGroupName}}</dd>
15
+ </dl>
16
+ </div>
17
+ </div>
18
+ <stage-failure-message stage="stage" message="stage.failureMessage"></stage-failure-message>
19
+ </div>
20
+
21
+ <div class="step-section-details" ng-if="detailsSection === 'taskStatus'">
22
+ <div class="row">
23
+ <execution-step-details item="stage"></execution-step-details>
24
+ </div>
25
+ </div>
26
+ </div>
@@ -0,0 +1,18 @@
1
+ <div ng-controller="appengineStartServerGroupStageCtrl as startServerGroupStageCtrl" class="form-horizontal">
2
+ <div ng-if="!pipeline.strategy">
3
+ <account-region-cluster-selector
4
+ application="application"
5
+ component="stage"
6
+ single-region="true"
7
+ disable-region-select="true"
8
+ on-account-update="startServerGroupStageCtrl.setStageRegion()"
9
+ accounts="accounts"
10
+ >
11
+ </account-region-cluster-selector>
12
+ </div>
13
+ <stage-config-field label="Target">
14
+ <target-select model="stage" options="targets"></target-select>
15
+ </stage-config-field>
16
+ <stage-platform-health-override application="application" stage="stage" platform-health-type="platformHealth">
17
+ </stage-platform-health-override>
18
+ </div>
@@ -0,0 +1 @@
1
+ <span class="task-label"> Start Server Group: {{step.context.serverGroupName}} ({{step.context.region}}) </span>
@@ -0,0 +1,54 @@
1
+ import { module } from 'angular';
2
+
3
+ import { Registry } from '@spinnaker/core';
4
+
5
+ import { AppengineStageCtrl } from '../appengineStage.controller';
6
+ import { AppengineHealth } from '../../../common/appengineHealth';
7
+ import type { IAppengineStageScope } from '../../../domain/index';
8
+
9
+ class AppengineStopServerGroupStageCtrl extends AppengineStageCtrl {
10
+ public static $inject = ['$scope'];
11
+ constructor(public $scope: IAppengineStageScope) {
12
+ super($scope);
13
+
14
+ super.setAccounts().then(() => {
15
+ super.setStageRegion();
16
+ });
17
+
18
+ super.setStageCloudProvider();
19
+ super.setTargets();
20
+ super.setStageCredentials();
21
+
22
+ if (
23
+ $scope.stage.isNew &&
24
+ $scope.application.attributes.platformHealthOnlyShowOverride &&
25
+ $scope.application.attributes.platformHealthOnly
26
+ ) {
27
+ $scope.stage.interestingHealthProviderNames = [AppengineHealth.PLATFORM];
28
+ }
29
+ }
30
+ }
31
+
32
+ export const APPENGINE_STOP_SERVER_GROUP_STAGE = 'spinnaker.appengine.pipeline.stage.stopServerGroupStage';
33
+
34
+ module(APPENGINE_STOP_SERVER_GROUP_STAGE, [])
35
+ .config(() => {
36
+ Registry.pipeline.registerStage({
37
+ label: 'Stop Server Group',
38
+ description: 'Stops a server group.',
39
+ key: 'stopAppEngineServerGroup',
40
+ templateUrl: require('./stopServerGroupStage.html'),
41
+ executionDetailsUrl: require('./stopServerGroupExecutionDetails.html'),
42
+ executionConfigSections: ['stopServerGroupConfig', 'taskStatus'],
43
+ executionStepLabelUrl: require('./stopServerGroupStepLabel.html'),
44
+ controller: 'appengineStopServerGroupStageCtrl',
45
+ controllerAs: 'stopServerGroupStageCtrl',
46
+ validators: [
47
+ { type: 'requiredField', fieldName: 'cluster' },
48
+ { type: 'requiredField', fieldName: 'target' },
49
+ { type: 'requiredField', fieldName: 'credentials', fieldLabel: 'account' },
50
+ ],
51
+ cloudProvider: 'appengine',
52
+ });
53
+ })
54
+ .controller('appengineStopServerGroupStageCtrl', AppengineStopServerGroupStageCtrl);
@@ -0,0 +1,26 @@
1
+ <div ng-controller="appengineStopServerGroupExecutionDetailsCtrl">
2
+ <execution-details-section-nav sections="configSections"></execution-details-section-nav>
3
+ <div class="step-section-details" ng-if="detailsSection === 'stopServerGroupConfig'">
4
+ <div class="row">
5
+ <div class="col-md-9">
6
+ <dl class="dl-narrow dl-horizontal">
7
+ <dt>Account</dt>
8
+ <dd>
9
+ <account-tag account="stage.context.credentials"></account-tag>
10
+ </dd>
11
+ <dt>Region</dt>
12
+ <dd>{{stage.context.region}}</dd>
13
+ <dt>Server Group</dt>
14
+ <dd>{{stage.context.serverGroupName}}</dd>
15
+ </dl>
16
+ </div>
17
+ </div>
18
+ <stage-failure-message stage="stage" message="stage.failureMessage"></stage-failure-message>
19
+ </div>
20
+
21
+ <div class="step-section-details" ng-if="detailsSection === 'taskStatus'">
22
+ <div class="row">
23
+ <execution-step-details item="stage"></execution-step-details>
24
+ </div>
25
+ </div>
26
+ </div>
@@ -0,0 +1,18 @@
1
+ <div ng-controller="appengineStopServerGroupStageCtrl as stopServerGroupStageCtrl" class="form-horizontal">
2
+ <div ng-if="!pipeline.strategy">
3
+ <account-region-cluster-selector
4
+ application="application"
5
+ component="stage"
6
+ single-region="true"
7
+ disable-region-select="true"
8
+ on-account-update="stopServerGroupStageCtrl.setStageRegion()"
9
+ accounts="accounts"
10
+ >
11
+ </account-region-cluster-selector>
12
+ </div>
13
+ <stage-config-field label="Target">
14
+ <target-select model="stage" options="targets"></target-select>
15
+ </stage-config-field>
16
+ <stage-platform-health-override application="application" stage="stage" platform-health-type="platformHealth">
17
+ </stage-platform-health-override>
18
+ </div>
@@ -0,0 +1 @@
1
+ <span class="task-label"> Stop Server Group: {{step.context.serverGroupName}} ({{step.context.region}}) </span>
@@ -0,0 +1,235 @@
1
+ import type { IQService } from 'angular';
2
+ import { module } from 'angular';
3
+
4
+ import type {
5
+ Application,
6
+ IArtifact,
7
+ IArtifactAccountPair,
8
+ IBuildTrigger,
9
+ IExpectedArtifact,
10
+ IGitTrigger,
11
+ IPipeline,
12
+ IStage,
13
+ } from '@spinnaker/core';
14
+ import { AccountService, StorageAccountReader } from '@spinnaker/core';
15
+ import { AppengineProviderSettings } from '../../appengine.settings';
16
+ import type {
17
+ GitCredentialType,
18
+ IAppengineAccount,
19
+ IAppengineGitTrigger,
20
+ IAppengineJenkinsTrigger,
21
+ IAppengineServerGroup,
22
+ } from '../../domain';
23
+
24
+ import type { AppengineDeployDescription } from '../transformer';
25
+
26
+ export interface IAppengineServerGroupCommand {
27
+ application?: string;
28
+ stack?: string;
29
+ freeFormDetails?: string;
30
+ configFilepaths?: string[];
31
+ configFiles?: string[];
32
+ configArtifacts?: IArtifactAccountPair[];
33
+ applicationDirectoryRoot: string;
34
+ branch?: string;
35
+ repositoryUrl?: string;
36
+ credentials: string;
37
+ region: string;
38
+ selectedProvider: string;
39
+ promote?: boolean;
40
+ stopPreviousVersion?: boolean;
41
+ suppressVersionString?: boolean;
42
+ type?: string;
43
+ backingData: any;
44
+ viewState: IViewState;
45
+ strategy?: string;
46
+ strategyApplication?: string;
47
+ strategyPipeline?: string;
48
+ fromTrigger?: boolean;
49
+ trigger?: IAppengineGitTrigger | IAppengineJenkinsTrigger;
50
+ gitCredentialType?: GitCredentialType;
51
+ storageAccountName?: string; // GCS only
52
+ interestingHealthProviderNames: string[];
53
+ fromArtifact: boolean;
54
+ expectedArtifactId: string;
55
+ expectedArtifact?: IArtifact;
56
+ sourceType: string;
57
+ containerImageUrl?: string;
58
+ }
59
+
60
+ export enum AppengineSourceType {
61
+ GCS = 'gcs',
62
+ GIT = 'git',
63
+ ARTIFACT = 'artifact',
64
+ CONTAINER_IMAGE = 'containerImage',
65
+ }
66
+
67
+ export interface IViewState {
68
+ mode: string;
69
+ submitButtonLabel: string;
70
+ disableStrategySelection: boolean;
71
+ stage?: IStage;
72
+ pipeline?: IPipeline;
73
+ }
74
+
75
+ export class AppengineServerGroupCommandBuilder {
76
+ private static getTriggerOptions(pipeline: IPipeline): Array<IAppengineGitTrigger | IAppengineJenkinsTrigger> {
77
+ return (pipeline.triggers || [])
78
+ .filter((trigger) => trigger.type === 'git' || trigger.type === 'jenkins' || trigger.type === 'travis')
79
+ .map((trigger: IGitTrigger | IBuildTrigger) => {
80
+ if (trigger.type === 'git') {
81
+ return {
82
+ source: trigger.source,
83
+ project: trigger.project,
84
+ slug: trigger.slug,
85
+ branch: trigger.branch,
86
+ type: 'git',
87
+ };
88
+ } else {
89
+ return { master: trigger.master, job: trigger.job, type: trigger.type };
90
+ }
91
+ });
92
+ }
93
+
94
+ private static getExpectedArtifacts(pipeline: IPipeline): IExpectedArtifact[] {
95
+ return pipeline.expectedArtifacts || [];
96
+ }
97
+
98
+ public static $inject = ['$q'];
99
+ constructor(private $q: IQService) {}
100
+
101
+ public buildNewServerGroupCommand(
102
+ app: Application,
103
+ selectedProvider: string,
104
+ mode = 'create',
105
+ ): PromiseLike<IAppengineServerGroupCommand> {
106
+ if (selectedProvider == null) {
107
+ selectedProvider = 'appengine';
108
+ }
109
+ const dataToFetch = {
110
+ accounts: AccountService.getAllAccountDetailsForProvider('appengine'),
111
+ storageAccounts: StorageAccountReader.getStorageAccounts(),
112
+ };
113
+
114
+ const viewState: IViewState = {
115
+ mode,
116
+ submitButtonLabel: this.getSubmitButtonLabel(mode),
117
+ disableStrategySelection: mode === 'create',
118
+ };
119
+
120
+ return this.$q.all(dataToFetch).then((backingData: any) => {
121
+ const credentials = this.getCredentials(backingData.accounts);
122
+ const region = this.getRegion(backingData.accounts, credentials);
123
+
124
+ return {
125
+ application: app.name,
126
+ backingData,
127
+ viewState,
128
+ fromArtifact: false,
129
+ credentials,
130
+ region,
131
+ selectedProvider,
132
+ interestingHealthProviderNames: [],
133
+ sourceType: AppengineSourceType.GIT,
134
+ } as IAppengineServerGroupCommand;
135
+ });
136
+ }
137
+
138
+ public buildServerGroupCommandFromExisting(
139
+ app: Application,
140
+ serverGroup: IAppengineServerGroup,
141
+ ): PromiseLike<IAppengineServerGroupCommand> {
142
+ return this.buildNewServerGroupCommand(app, 'appengine', 'clone').then((command) => {
143
+ command.stack = serverGroup.stack;
144
+ command.freeFormDetails = serverGroup.detail;
145
+ return command;
146
+ });
147
+ }
148
+
149
+ public buildNewServerGroupCommandForPipeline(
150
+ _stage: IStage,
151
+ pipeline: IPipeline,
152
+ ): PromiseLike<{
153
+ viewState: {
154
+ stage: IStage;
155
+ pipeline: IPipeline;
156
+ };
157
+ backingData: {
158
+ triggerOptions: Array<IAppengineGitTrigger | IAppengineJenkinsTrigger>;
159
+ expectedArtifacts: IExpectedArtifact[];
160
+ };
161
+ }> {
162
+ // We can't copy server group configuration for App Engine, and can't build the full command here because we don't have
163
+ // access to the application.
164
+ return this.$q.when({
165
+ viewState: {
166
+ pipeline,
167
+ stage: _stage,
168
+ },
169
+ backingData: {
170
+ triggerOptions: AppengineServerGroupCommandBuilder.getTriggerOptions(pipeline),
171
+ expectedArtifacts: AppengineServerGroupCommandBuilder.getExpectedArtifacts(pipeline),
172
+ },
173
+ });
174
+ }
175
+
176
+ public buildServerGroupCommandFromPipeline(
177
+ app: Application,
178
+ cluster: AppengineDeployDescription,
179
+ _stage: IStage,
180
+ pipeline: IPipeline,
181
+ ): PromiseLike<IAppengineServerGroupCommand> {
182
+ return this.buildNewServerGroupCommand(app, 'appengine', 'editPipeline').then(
183
+ (command: IAppengineServerGroupCommand) => {
184
+ command = {
185
+ ...command,
186
+ ...cluster,
187
+ backingData: {
188
+ ...command.backingData,
189
+ triggerOptions: AppengineServerGroupCommandBuilder.getTriggerOptions(pipeline),
190
+ expectedArtifacts: AppengineServerGroupCommandBuilder.getExpectedArtifacts(pipeline),
191
+ },
192
+ credentials: cluster.account || command.credentials,
193
+ viewState: {
194
+ ...command.viewState,
195
+ stage: _stage,
196
+ pipeline,
197
+ },
198
+ } as IAppengineServerGroupCommand;
199
+ return command;
200
+ },
201
+ );
202
+ }
203
+
204
+ private getCredentials(accounts: IAppengineAccount[]): string {
205
+ const accountNames: string[] = (accounts || []).map((account) => account.name);
206
+ const defaultCredentials: string = AppengineProviderSettings.defaults.account;
207
+
208
+ return accountNames.includes(defaultCredentials) ? defaultCredentials : accountNames[0];
209
+ }
210
+
211
+ private getRegion(accounts: IAppengineAccount[], credentials: string): string {
212
+ const account = accounts.find((_account) => _account.name === credentials);
213
+ return account ? account.region : null;
214
+ }
215
+
216
+ private getSubmitButtonLabel(mode: string): string {
217
+ switch (mode) {
218
+ case 'createPipeline':
219
+ return 'Add';
220
+ case 'editPipeline':
221
+ return 'Done';
222
+ case 'clone':
223
+ return 'Clone';
224
+ default:
225
+ return 'Create';
226
+ }
227
+ }
228
+ }
229
+
230
+ export const APPENGINE_SERVER_GROUP_COMMAND_BUILDER = 'spinnaker.appengine.serverGroupCommandBuilder.service';
231
+
232
+ module(APPENGINE_SERVER_GROUP_COMMAND_BUILDER, []).service(
233
+ 'appengineServerGroupCommandBuilder',
234
+ AppengineServerGroupCommandBuilder,
235
+ );