From 79a0700b02edc8f939d5a31d97648865071cf542 Mon Sep 17 00:00:00 2001 From: maggieneterval Date: Fri, 1 Mar 2019 12:48:27 -0500 Subject: [PATCH] feat(kubernetes): add dynamic target selection to patch manifest stage --- .../stages/patchManifest/patchManifestConfig.controller.ts | 4 ++++ .../stages/patchManifest/patchManifestConfig.html | 2 ++ .../pipelines/stages/patchManifest/patchManifestStage.ts | 7 ++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestConfig.controller.ts b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestConfig.controller.ts index 23da95df93e..17803a2a7a0 100644 --- a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestConfig.controller.ts +++ b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestConfig.controller.ts @@ -45,6 +45,10 @@ export class KubernetesV2PatchManifestConfigCtrl implements IController { this.$scope.stage.options = defaultOptions; } + if (!this.$scope.stage.app) { + this.$scope.stage.app = this.$scope.application.name; + } + this.setRawPatchBody(this.getMergeStrategy()); this.manifestArtifactDelegate = new NgGenericArtifactDelegate($scope, 'manifest'); diff --git a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestConfig.html b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestConfig.html index 155eab19bf7..069170b8fae 100644 --- a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestConfig.html +++ b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestConfig.html @@ -3,6 +3,8 @@

Resource to Patch

diff --git a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestStage.ts b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestStage.ts index 8079998f761..e67773db53d 100644 --- a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestStage.ts +++ b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/patchManifest/patchManifestStage.ts @@ -12,6 +12,7 @@ import { KubernetesV2PatchManifestConfigCtrl } from '../patchManifest/patchManif import { KUBERNETES_PATCH_MANIFEST_OPTIONS_FORM } from './patchOptionsForm.component'; import { KUBERNETES_MANIFEST_SELECTOR } from 'kubernetes/v2/manifest/selector/selector.component'; import { DeployStatus } from '../deployManifest/react/DeployStatus'; +import { trafficValidators } from '../traffic/validators'; export const KUBERNETES_PATCH_MANIFEST_STAGE = 'spinnaker.kubernetes.v2.pipeline.stage.patchManifestStage'; @@ -33,11 +34,7 @@ module(KUBERNETES_PATCH_MANIFEST_STAGE, [KUBERNETES_PATCH_MANIFEST_OPTIONS_FORM, executionDetailsSections: [PatchStatus, ExecutionDetailsTasks, ExecutionArtifactTab], producesArtifacts: true, defaultTimeoutMs: 30 * 60 * 1000, // 30 minutes - validators: [ - { type: 'requiredField', fieldName: 'location', fieldLabel: 'Namespace' }, - { type: 'requiredField', fieldName: 'account', fieldLabel: 'Account' }, - { type: 'manifestSelector' }, - ], + validators: trafficValidators(KUBERNETES_PATCH_MANIFEST_STAGE), artifactExtractor: ExpectedArtifactService.accumulateArtifacts(['manifestArtifactId', 'requiredArtifactIds']), artifactRemover: ArtifactReferenceService.removeArtifactFromFields([ 'manifestArtifactId',