-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bake/manifest): bake manifest stage config (#5128)
- Loading branch information
Showing
5 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...pts/modules/core/src/pipeline/config/stages/bakeManifest/bakeManifestConfig.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { IController, IScope } from 'angular'; | ||
|
||
import { AccountService, ExpectedArtifactService, IAccount, IExpectedArtifact } from 'core'; | ||
|
||
export class BakeManifestConfigCtrl implements IController { | ||
public expectedArtifacts: IExpectedArtifact[]; | ||
public artifactAccounts: IAccount[]; | ||
public templateRenderers = ['HELM2']; | ||
|
||
constructor(public $scope: IScope, | ||
accountService: AccountService, | ||
expectedArtifactService: ExpectedArtifactService ) { | ||
'ngInject'; | ||
if (this.$scope.stage.isNew) { | ||
const defaultSelection = { | ||
templateRenderer: 'HELM2', | ||
expectedArtifacts: [{ | ||
matchArtifact: { | ||
type: 'embedded/base64', | ||
name: '' | ||
} | ||
}] | ||
}; | ||
|
||
Object.assign(this.$scope.stage, defaultSelection); | ||
} | ||
|
||
accountService.getArtifactAccounts().then(accounts => { | ||
this.artifactAccounts = accounts; | ||
}); | ||
|
||
this.expectedArtifacts = expectedArtifactService.getExpectedArtifactsAvailableToStage(this.$scope.stage, this.$scope.$parent.pipeline); | ||
} | ||
|
||
public outputNameChange() { | ||
const expectedArtifacts = this.$scope.stage.expectedArtifacts; | ||
if (expectedArtifacts | ||
&& expectedArtifacts.length === 1 | ||
&& expectedArtifacts[0].matchArtifact | ||
&& expectedArtifacts[0].matchArtifact.type === 'embedded/base64') { | ||
expectedArtifacts[0].matchArtifact.name = this.$scope.stage.outputName; | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
app/scripts/modules/core/src/pipeline/config/stages/bakeManifest/bakeManifestConfig.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<div class="form-horizontal" xmlns="http://www.w3.org/1999/html"> | ||
<div class="alert alert-warning"> | ||
<strong>Warning!</strong> This stage is under active development and is subject to change. | ||
</div> | ||
<h4>Template Renderer</h4> | ||
<div class="form-group"> | ||
<div class="col-md-3 sm-label-right"> | ||
Render Engine | ||
<help-field key="pipeline.config.bake.manifest.templateRenderer"></help-field> | ||
</div> | ||
<div class="col-md-3"> | ||
<select class="form-control input-sm" | ||
ng-model="ctrl.$scope.stage.templateRenderer"> | ||
<option ng-repeat="renderer in ctrl.templateRenderers" | ||
value="{{renderer}}" | ||
ng-selected="ctrl.$scope.stage.templateRenderer === renderer">{{renderer}}</option> | ||
</select> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<div class="col-md-3 sm-label-right"> | ||
Name | ||
</div> | ||
<div class="col-md-3"> | ||
<input type="text" class="form-control input-sm" | ||
ng-model="ctrl.$scope.stage.outputName" | ||
ng-change="ctrl.outputNameChange()"> | ||
</input> | ||
</div> | ||
</div> | ||
|
||
<h4>Template Artifact</h4> | ||
<expected-artifact-selector command="ctrl.$scope.stage" | ||
id-field="expectedArtifactId" | ||
account-field="expectedArtifactAccount" | ||
accounts="ctrl.artifactAccounts" | ||
expected-artifacts="ctrl.expectedArtifacts" | ||
help-field-key="pipeline.config.bake.manifest.expectedArtifact"> | ||
</expected-artifact-selector> | ||
</div> |
33 changes: 33 additions & 0 deletions
33
app/scripts/modules/core/src/pipeline/config/stages/bakeManifest/bakeManifestStage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { module } from 'angular'; | ||
|
||
import { | ||
ArtifactReferenceServiceProvider, | ||
PIPELINE_CONFIG_PROVIDER, | ||
PipelineConfigProvider, | ||
SETTINGS | ||
} from 'core'; | ||
|
||
import { BakeManifestConfigCtrl } from './bakeManifestConfig.controller'; | ||
|
||
export const BAKE_MANIFEST_STAGE = 'spinnaker.core.pipeline.stage.bakeManifestStage'; | ||
|
||
module(BAKE_MANIFEST_STAGE, [ | ||
PIPELINE_CONFIG_PROVIDER, | ||
]).config((pipelineConfigProvider: PipelineConfigProvider, artifactReferenceServiceProvider: ArtifactReferenceServiceProvider) => { | ||
if (SETTINGS.feature.versionedProviders) { | ||
pipelineConfigProvider.registerStage({ | ||
label: 'Bake (Manifest)', | ||
description: 'Bake a manifest (or multi-doc manifest set) using a template renderer such as Helm.', | ||
key: 'bakeManifest', | ||
templateUrl: require('./bakeManifestConfig.html'), | ||
controller: 'BakeManifestConfigCtrl', | ||
producesArtifacts: true, | ||
cloudProvider: 'kubernetes', | ||
controllerAs: 'ctrl', | ||
}); | ||
|
||
artifactReferenceServiceProvider.registerReference('stage', () => [ | ||
['expectedArtifactId'], | ||
]); | ||
} | ||
}).controller('BakeManifestConfigCtrl', BakeManifestConfigCtrl); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters