Skip to content

Commit 79a0700

Browse files
feat(kubernetes): add dynamic target selection to patch manifest stage
1 parent 0abce66 commit 79a0700

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestConfig.controller.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ export class KubernetesV2PatchManifestConfigCtrl implements IController {
4545
this.$scope.stage.options = defaultOptions;
4646
}
4747

48+
if (!this.$scope.stage.app) {
49+
this.$scope.stage.app = this.$scope.application.name;
50+
}
51+
4852
this.setRawPatchBody(this.getMergeStrategy());
4953

5054
this.manifestArtifactDelegate = new NgGenericArtifactDelegate($scope, 'manifest');

‎app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestConfig.html‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<h4>Resource to Patch</h4>
44
<div class="horizontal-rule"></div>
55
<kubernetes-manifest-selector
6+
application="ctrl.$scope.application"
7+
modes='["static", "dynamic"]'
68
on-change="ctrl.handleManifestSelectorChange"
79
selector="ctrl.$scope.stage"
810
></kubernetes-manifest-selector>

‎app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestStage.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { KubernetesV2PatchManifestConfigCtrl } from '../patchManifest/patchManif
1212
import { KUBERNETES_PATCH_MANIFEST_OPTIONS_FORM } from './patchOptionsForm.component';
1313
import { KUBERNETES_MANIFEST_SELECTOR } from 'kubernetes/v2/manifest/selector/selector.component';
1414
import { DeployStatus } from '../deployManifest/react/DeployStatus';
15+
import { trafficValidators } from '../traffic/validators';
1516

1617
export const KUBERNETES_PATCH_MANIFEST_STAGE = 'spinnaker.kubernetes.v2.pipeline.stage.patchManifestStage';
1718

@@ -33,11 +34,7 @@ module(KUBERNETES_PATCH_MANIFEST_STAGE, [KUBERNETES_PATCH_MANIFEST_OPTIONS_FORM,
3334
executionDetailsSections: [PatchStatus, ExecutionDetailsTasks, ExecutionArtifactTab],
3435
producesArtifacts: true,
3536
defaultTimeoutMs: 30 * 60 * 1000, // 30 minutes
36-
validators: [
37-
{ type: 'requiredField', fieldName: 'location', fieldLabel: 'Namespace' },
38-
{ type: 'requiredField', fieldName: 'account', fieldLabel: 'Account' },
39-
{ type: 'manifestSelector' },
40-
],
37+
validators: trafficValidators(KUBERNETES_PATCH_MANIFEST_STAGE),
4138
artifactExtractor: ExpectedArtifactService.accumulateArtifacts(['manifestArtifactId', 'requiredArtifactIds']),
4239
artifactRemover: ArtifactReferenceService.removeArtifactFromFields([
4340
'manifestArtifactId',

0 commit comments

Comments
 (0)