From 8398d7706951ce567c352e5f96351366103ef2e3 Mon Sep 17 00:00:00 2001 From: Chris Berry Date: Wed, 5 Jun 2019 12:28:50 -0500 Subject: [PATCH] refactor(*): make accountExtractor return an array of strings (#7068) --- .../stages/cloneServerGroup/awsCloneServerGroupStage.js | 2 +- .../deployCloudFormation/deployCloudFormationStackStage.ts | 2 +- .../cloudfoundryCloneServerGroupStage.module.ts | 2 +- .../cloudfoundryCreateServiceKeyStage.module.ts | 2 +- .../cloudfoundryDeleteServiceKeyStage.module.ts | 2 +- .../deployService/cloudfoundryDeployServiceStage.module.ts | 2 +- .../stages/destroyAsg/cloudfoundryDestroyAsgStage.module.ts | 2 +- .../cloudfoundryDestroyServiceStage.module.ts | 2 +- .../stages/disableAsg/cloudfoundryDisableAsgStage.module.ts | 2 +- .../stages/enableAsg/cloudfoundryEnableAsgStage.module.ts | 2 +- .../cloudfoundryMapLoadBalancersStage.module.ts | 2 +- .../stages/resizeAsg/cloudfoundryResizeAsgStage.module.ts | 2 +- .../cloudfoundryRollbackClusterStage.module.ts | 2 +- .../shareService/cloudfoundryShareServiceStage.module.ts | 2 +- .../cloudfoundryUnmapLoadBalancersStage.module.ts | 2 +- .../cloudfoundryUnshareServiceStage.module.ts | 2 +- app/scripts/modules/core/src/domain/IStageTypeConfig.ts | 4 ++-- .../core/src/pipeline/filter/executionFilter.service.ts | 4 ++-- .../core/src/pipeline/service/ExecutionsTransformer.ts | 6 +++--- .../stages/cloneServerGroup/ecsCloneServerGroupStage.js | 2 +- .../pipelines/stages/deleteManifest/deleteManifestStage.ts | 2 +- .../pipelines/stages/deployManifest/deployManifestStage.ts | 2 +- .../v2/pipelines/stages/scaleManifest/scaleManifestStage.ts | 2 +- .../v2/pipelines/stages/traffic/disableManifest.stage.ts | 2 +- .../src/v2/pipelines/stages/traffic/enableManifest.stage.ts | 2 +- .../stages/undoRolloutManifest/undoRolloutManifestStage.ts | 2 +- .../titus/src/pipeline/stages/runJob/titusRunJobStage.ts | 4 +++- 27 files changed, 33 insertions(+), 31 deletions(-) diff --git a/app/scripts/modules/amazon/src/pipeline/stages/cloneServerGroup/awsCloneServerGroupStage.js b/app/scripts/modules/amazon/src/pipeline/stages/cloneServerGroup/awsCloneServerGroupStage.js index df6cae8ca13..1e45230efa9 100644 --- a/app/scripts/modules/amazon/src/pipeline/stages/cloneServerGroup/awsCloneServerGroupStage.js +++ b/app/scripts/modules/amazon/src/pipeline/stages/cloneServerGroup/awsCloneServerGroupStage.js @@ -13,7 +13,7 @@ module.exports = angular cloudProvider: 'aws', templateUrl: require('./cloneServerGroupStage.html'), executionStepLabelUrl: require('./cloneServerGroupStepLabel.html'), - accountExtractor: stage => stage.context.credentials, + accountExtractor: stage => [stage.context.credentials], validators: [ { type: 'requiredField', fieldName: 'targetCluster', fieldLabel: 'cluster' }, { type: 'requiredField', fieldName: 'target' }, diff --git a/app/scripts/modules/amazon/src/pipeline/stages/deployCloudFormation/deployCloudFormationStackStage.ts b/app/scripts/modules/amazon/src/pipeline/stages/deployCloudFormation/deployCloudFormationStackStage.ts index 1e3133eb316..18ec82bb646 100644 --- a/app/scripts/modules/amazon/src/pipeline/stages/deployCloudFormation/deployCloudFormationStackStage.ts +++ b/app/scripts/modules/amazon/src/pipeline/stages/deployCloudFormation/deployCloudFormationStackStage.ts @@ -26,7 +26,7 @@ module(DEPLOY_CLOUDFORMATION_STACK_STAGE, []) producesArtifacts: true, defaultTimeoutMs: 30 * 60 * 1000, // 30 minutes validators: [], - accountExtractor: (stage: IStage): string => (stage.account ? stage.account : ''), + accountExtractor: (stage: IStage): string[] => (stage.account ? [stage.account] : []), configAccountExtractor: (stage: any): string[] => (stage.account ? [stage.account] : []), artifactExtractor: ExpectedArtifactService.accumulateArtifacts(['stackArtifactId', 'requiredArtifactIds']), artifactRemover: ArtifactReferenceService.removeArtifactFromFields(['stackArtifactId', 'requiredArtifactIds']), diff --git a/app/scripts/modules/cloudfoundry/src/pipeline/stages/cloneServerGroup/cloudfoundryCloneServerGroupStage.module.ts b/app/scripts/modules/cloudfoundry/src/pipeline/stages/cloneServerGroup/cloudfoundryCloneServerGroupStage.module.ts index 4a377051aa4..350d8b640d8 100644 --- a/app/scripts/modules/cloudfoundry/src/pipeline/stages/cloneServerGroup/cloudfoundryCloneServerGroupStage.module.ts +++ b/app/scripts/modules/cloudfoundry/src/pipeline/stages/cloneServerGroup/cloudfoundryCloneServerGroupStage.module.ts @@ -2,7 +2,7 @@ import { CloudfoundryCloneServerGroupStageConfig } from './CloudfoundryCloneServ import { IStage, Registry } from '@spinnaker/core'; Registry.pipeline.registerStage({ - accountExtractor: (stage: IStage) => stage.context.credentials, + accountExtractor: (stage: IStage) => [stage.context.credentials], cloudProvider: 'cloudfoundry', component: CloudfoundryCloneServerGroupStageConfig, configAccountExtractor: (stage: IStage) => [stage.credentials], diff --git a/app/scripts/modules/cloudfoundry/src/pipeline/stages/createServiceKey/cloudfoundryCreateServiceKeyStage.module.ts b/app/scripts/modules/cloudfoundry/src/pipeline/stages/createServiceKey/cloudfoundryCreateServiceKeyStage.module.ts index 9f2b2e32005..f14767940f6 100644 --- a/app/scripts/modules/cloudfoundry/src/pipeline/stages/createServiceKey/cloudfoundryCreateServiceKeyStage.module.ts +++ b/app/scripts/modules/cloudfoundry/src/pipeline/stages/createServiceKey/cloudfoundryCreateServiceKeyStage.module.ts @@ -3,7 +3,7 @@ import { ExecutionDetailsTasks, IStage, Registry } from '@spinnaker/core'; import { CloudfoundryServiceKeyExecutionDetails } from 'cloudfoundry/presentation'; Registry.pipeline.registerStage({ - accountExtractor: (stage: IStage) => stage.context.credentials, + accountExtractor: (stage: IStage) => [stage.context.credentials], cloudProvider: 'cloudfoundry', component: CloudfoundryCreateServiceKeyStageConfig, description: 'Create a service key', diff --git a/app/scripts/modules/cloudfoundry/src/pipeline/stages/deleteServiceKey/cloudfoundryDeleteServiceKeyStage.module.ts b/app/scripts/modules/cloudfoundry/src/pipeline/stages/deleteServiceKey/cloudfoundryDeleteServiceKeyStage.module.ts index 685f593a5fa..ada756bc6e1 100644 --- a/app/scripts/modules/cloudfoundry/src/pipeline/stages/deleteServiceKey/cloudfoundryDeleteServiceKeyStage.module.ts +++ b/app/scripts/modules/cloudfoundry/src/pipeline/stages/deleteServiceKey/cloudfoundryDeleteServiceKeyStage.module.ts @@ -3,7 +3,7 @@ import { ExecutionDetailsTasks, IStage, Registry } from '@spinnaker/core'; import { CloudfoundryServiceKeyExecutionDetails } from 'cloudfoundry/presentation'; Registry.pipeline.registerStage({ - accountExtractor: (stage: IStage) => stage.context.credentials, + accountExtractor: (stage: IStage) => [stage.context.credentials], configAccountExtractor: (stage: IStage) => [stage.credentials], cloudProvider: 'cloudfoundry', component: CloudfoundryDeleteServiceKeyStageConfig, diff --git a/app/scripts/modules/cloudfoundry/src/pipeline/stages/deployService/cloudfoundryDeployServiceStage.module.ts b/app/scripts/modules/cloudfoundry/src/pipeline/stages/deployService/cloudfoundryDeployServiceStage.module.ts index cacd9907ba0..d475560fd2c 100644 --- a/app/scripts/modules/cloudfoundry/src/pipeline/stages/deployService/cloudfoundryDeployServiceStage.module.ts +++ b/app/scripts/modules/cloudfoundry/src/pipeline/stages/deployService/cloudfoundryDeployServiceStage.module.ts @@ -97,7 +97,7 @@ PipelineConfigValidator.registerValidator( ); Registry.pipeline.registerStage({ - accountExtractor: (stage: IStage) => stage.context.credentials, + accountExtractor: (stage: IStage) => [stage.context.credentials], cloudProvider: 'cloudfoundry', component: CloudfoundryDeployServiceStageConfig, configAccountExtractor: (stage: IStage) => [stage.credentials], diff --git a/app/scripts/modules/cloudfoundry/src/pipeline/stages/destroyAsg/cloudfoundryDestroyAsgStage.module.ts b/app/scripts/modules/cloudfoundry/src/pipeline/stages/destroyAsg/cloudfoundryDestroyAsgStage.module.ts index 81ca17946d5..6e9dd506eca 100644 --- a/app/scripts/modules/cloudfoundry/src/pipeline/stages/destroyAsg/cloudfoundryDestroyAsgStage.module.ts +++ b/app/scripts/modules/cloudfoundry/src/pipeline/stages/destroyAsg/cloudfoundryDestroyAsgStage.module.ts @@ -2,7 +2,7 @@ import { CloudfoundryAsgStageConfig } from 'cloudfoundry/presentation'; import { IStage, Registry } from '@spinnaker/core'; Registry.pipeline.registerStage({ - accountExtractor: (stage: IStage) => stage.context.credentials, + accountExtractor: (stage: IStage) => [stage.context.credentials], cloudProvider: 'cloudfoundry', component: CloudfoundryAsgStageConfig, configAccountExtractor: (stage: IStage) => [stage.credentials], diff --git a/app/scripts/modules/cloudfoundry/src/pipeline/stages/destroyService/cloudfoundryDestroyServiceStage.module.ts b/app/scripts/modules/cloudfoundry/src/pipeline/stages/destroyService/cloudfoundryDestroyServiceStage.module.ts index 1198129961d..9208ad92ae6 100644 --- a/app/scripts/modules/cloudfoundry/src/pipeline/stages/destroyService/cloudfoundryDestroyServiceStage.module.ts +++ b/app/scripts/modules/cloudfoundry/src/pipeline/stages/destroyService/cloudfoundryDestroyServiceStage.module.ts @@ -3,7 +3,7 @@ import { ExecutionDetailsTasks, IStage, Registry } from '@spinnaker/core'; import { CloudfoundryServiceExecutionDetails } from 'cloudfoundry/presentation'; Registry.pipeline.registerStage({ - accountExtractor: (stage: IStage) => stage.context.credentials, + accountExtractor: (stage: IStage) => [stage.context.credentials], configAccountExtractor: (stage: IStage) => [stage.credentials], cloudProvider: 'cloudfoundry', component: CloudfoundryDestroyServiceStageConfig, diff --git a/app/scripts/modules/cloudfoundry/src/pipeline/stages/disableAsg/cloudfoundryDisableAsgStage.module.ts b/app/scripts/modules/cloudfoundry/src/pipeline/stages/disableAsg/cloudfoundryDisableAsgStage.module.ts index a326d26acb1..45713c8d26a 100644 --- a/app/scripts/modules/cloudfoundry/src/pipeline/stages/disableAsg/cloudfoundryDisableAsgStage.module.ts +++ b/app/scripts/modules/cloudfoundry/src/pipeline/stages/disableAsg/cloudfoundryDisableAsgStage.module.ts @@ -2,7 +2,7 @@ import { CloudfoundryAsgStageConfig } from 'cloudfoundry/presentation'; import { IStage, Registry } from '@spinnaker/core'; Registry.pipeline.registerStage({ - accountExtractor: (stage: IStage) => stage.context.credentials, + accountExtractor: (stage: IStage) => [stage.context.credentials], cloudProvider: 'cloudfoundry', component: CloudfoundryAsgStageConfig, configAccountExtractor: (stage: IStage) => [stage.credentials], diff --git a/app/scripts/modules/cloudfoundry/src/pipeline/stages/enableAsg/cloudfoundryEnableAsgStage.module.ts b/app/scripts/modules/cloudfoundry/src/pipeline/stages/enableAsg/cloudfoundryEnableAsgStage.module.ts index f33429514b1..be4d8dbbd22 100644 --- a/app/scripts/modules/cloudfoundry/src/pipeline/stages/enableAsg/cloudfoundryEnableAsgStage.module.ts +++ b/app/scripts/modules/cloudfoundry/src/pipeline/stages/enableAsg/cloudfoundryEnableAsgStage.module.ts @@ -2,7 +2,7 @@ import { CloudfoundryAsgStageConfig } from 'cloudfoundry/presentation'; import { IStage, Registry } from '@spinnaker/core'; Registry.pipeline.registerStage({ - accountExtractor: (stage: IStage) => stage.context.credentials, + accountExtractor: (stage: IStage) => [stage.context.credentials], cloudProvider: 'cloudfoundry', component: CloudfoundryAsgStageConfig, configAccountExtractor: (stage: IStage) => [stage.credentials], diff --git a/app/scripts/modules/cloudfoundry/src/pipeline/stages/mapLoadBalancers/cloudfoundryMapLoadBalancersStage.module.ts b/app/scripts/modules/cloudfoundry/src/pipeline/stages/mapLoadBalancers/cloudfoundryMapLoadBalancersStage.module.ts index 8b81bcee4b6..8491447f9bb 100644 --- a/app/scripts/modules/cloudfoundry/src/pipeline/stages/mapLoadBalancers/cloudfoundryMapLoadBalancersStage.module.ts +++ b/app/scripts/modules/cloudfoundry/src/pipeline/stages/mapLoadBalancers/cloudfoundryMapLoadBalancersStage.module.ts @@ -5,7 +5,7 @@ import { import { ExecutionDetailsTasks, IStage, Registry } from '@spinnaker/core'; Registry.pipeline.registerStage({ - accountExtractor: (stage: IStage) => stage.context.credentials, + accountExtractor: (stage: IStage) => [stage.context.credentials], configAccountExtractor: (stage: IStage) => [stage.credentials], cloudProvider: 'cloudfoundry', component: CloudfoundryLoadBalancersStageConfig, diff --git a/app/scripts/modules/cloudfoundry/src/pipeline/stages/resizeAsg/cloudfoundryResizeAsgStage.module.ts b/app/scripts/modules/cloudfoundry/src/pipeline/stages/resizeAsg/cloudfoundryResizeAsgStage.module.ts index 1f7e8a36325..5d8145ea84b 100644 --- a/app/scripts/modules/cloudfoundry/src/pipeline/stages/resizeAsg/cloudfoundryResizeAsgStage.module.ts +++ b/app/scripts/modules/cloudfoundry/src/pipeline/stages/resizeAsg/cloudfoundryResizeAsgStage.module.ts @@ -27,7 +27,7 @@ const memoryValidator: IInstanceFieldSizeValidationConfig = { }; Registry.pipeline.registerStage({ - accountExtractor: (stage: IStage) => stage.context.credentials, + accountExtractor: (stage: IStage) => [stage.context.credentials], cloudProvider: 'cloudfoundry', component: CloudfoundryResizeAsgStageConfig, configAccountExtractor: (stage: IStage) => [stage.credentials], diff --git a/app/scripts/modules/cloudfoundry/src/pipeline/stages/rollbackCluster/cloudfoundryRollbackClusterStage.module.ts b/app/scripts/modules/cloudfoundry/src/pipeline/stages/rollbackCluster/cloudfoundryRollbackClusterStage.module.ts index 5187c3e6dac..598fa79b9dd 100644 --- a/app/scripts/modules/cloudfoundry/src/pipeline/stages/rollbackCluster/cloudfoundryRollbackClusterStage.module.ts +++ b/app/scripts/modules/cloudfoundry/src/pipeline/stages/rollbackCluster/cloudfoundryRollbackClusterStage.module.ts @@ -2,7 +2,7 @@ import { CloudfoundryRollbackClusterStageConfig } from './CloudfoundryRollbackCl import { IStage, Registry } from '@spinnaker/core'; Registry.pipeline.registerStage({ - accountExtractor: (stage: IStage) => stage.context.credentials, + accountExtractor: (stage: IStage) => [stage.context.credentials], configAccountExtractor: (stage: IStage) => [stage.credentials], provides: 'rollbackCluster', key: 'rollbackCluster', diff --git a/app/scripts/modules/cloudfoundry/src/pipeline/stages/shareService/cloudfoundryShareServiceStage.module.ts b/app/scripts/modules/cloudfoundry/src/pipeline/stages/shareService/cloudfoundryShareServiceStage.module.ts index 495307399e0..279a4d51843 100644 --- a/app/scripts/modules/cloudfoundry/src/pipeline/stages/shareService/cloudfoundryShareServiceStage.module.ts +++ b/app/scripts/modules/cloudfoundry/src/pipeline/stages/shareService/cloudfoundryShareServiceStage.module.ts @@ -3,7 +3,7 @@ import { ExecutionDetailsTasks, IStage, Registry } from '@spinnaker/core'; import { CloudfoundryShareServiceExecutionDetails } from './CloudfoundryShareServiceExecutionDetails'; Registry.pipeline.registerStage({ - accountExtractor: (stage: IStage) => stage.context.credentials, + accountExtractor: (stage: IStage) => [stage.context.credentials], configAccountExtractor: (stage: IStage) => [stage.credentials], provides: 'shareService', key: 'shareService', diff --git a/app/scripts/modules/cloudfoundry/src/pipeline/stages/unmapLoadBalancers/cloudfoundryUnmapLoadBalancersStage.module.ts b/app/scripts/modules/cloudfoundry/src/pipeline/stages/unmapLoadBalancers/cloudfoundryUnmapLoadBalancersStage.module.ts index a6378c9dc54..acb081fed74 100644 --- a/app/scripts/modules/cloudfoundry/src/pipeline/stages/unmapLoadBalancers/cloudfoundryUnmapLoadBalancersStage.module.ts +++ b/app/scripts/modules/cloudfoundry/src/pipeline/stages/unmapLoadBalancers/cloudfoundryUnmapLoadBalancersStage.module.ts @@ -5,7 +5,7 @@ import { import { ExecutionDetailsTasks, IStage, Registry } from '@spinnaker/core'; Registry.pipeline.registerStage({ - accountExtractor: (stage: IStage) => stage.context.credentials, + accountExtractor: (stage: IStage) => [stage.context.credentials], configAccountExtractor: (stage: IStage) => [stage.credentials], cloudProvider: 'cloudfoundry', component: CloudfoundryLoadBalancersStageConfig, diff --git a/app/scripts/modules/cloudfoundry/src/pipeline/stages/unshareService/cloudfoundryUnshareServiceStage.module.ts b/app/scripts/modules/cloudfoundry/src/pipeline/stages/unshareService/cloudfoundryUnshareServiceStage.module.ts index 779b820e367..a0b15b9c011 100644 --- a/app/scripts/modules/cloudfoundry/src/pipeline/stages/unshareService/cloudfoundryUnshareServiceStage.module.ts +++ b/app/scripts/modules/cloudfoundry/src/pipeline/stages/unshareService/cloudfoundryUnshareServiceStage.module.ts @@ -3,7 +3,7 @@ import { ExecutionDetailsTasks, IStage, Registry } from '@spinnaker/core'; import { CloudfoundryUnshareServiceExecutionDetails } from './CloudfoundryUnshareServiceExecutionDetails'; Registry.pipeline.registerStage({ - accountExtractor: (stage: IStage) => stage.context.credentials, + accountExtractor: (stage: IStage) => [stage.context.credentials], configAccountExtractor: (stage: IStage) => [stage.credentials], provides: 'unshareService', key: 'unshareService', diff --git a/app/scripts/modules/core/src/domain/IStageTypeConfig.ts b/app/scripts/modules/core/src/domain/IStageTypeConfig.ts index 5cdcaaebc24..78059397eaf 100644 --- a/app/scripts/modules/core/src/domain/IStageTypeConfig.ts +++ b/app/scripts/modules/core/src/domain/IStageTypeConfig.ts @@ -6,14 +6,14 @@ import { IStageOrTriggerTypeConfig } from './IStageOrTriggerTypeConfig'; export type IExecutionDetailsSection = React.ComponentType & { title: string }; export interface IStageTypeConfig extends IStageOrTriggerTypeConfig { - accountExtractor?: (stage: IStage) => string; + accountExtractor?: (stage: IStage) => string[]; addAliasToConfig?: boolean; alias?: string; artifactExtractor?: (stageContext: IExecutionContext) => string[]; artifactRemover?: (stage: IStage, artifactId: string) => void; cloudProvider?: string; cloudProviders?: string[]; - configAccountExtractor?: any; + configAccountExtractor?: (stage: IStage) => string[]; configuration?: any; defaults?: any; defaultTimeoutMs?: number; diff --git a/app/scripts/modules/core/src/pipeline/filter/executionFilter.service.ts b/app/scripts/modules/core/src/pipeline/filter/executionFilter.service.ts index f40ae416fec..ebc25485d22 100644 --- a/app/scripts/modules/core/src/pipeline/filter/executionFilter.service.ts +++ b/app/scripts/modules/core/src/pipeline/filter/executionFilter.service.ts @@ -1,4 +1,4 @@ -import { chain, compact, find, flattenDeep, forOwn, get, groupBy, includes, uniq } from 'lodash'; +import { chain, compact, find, forOwn, get, groupBy, includes, uniq } from 'lodash'; import { Debounce } from 'lodash-decorators'; import { Subject } from 'rxjs'; import { $log } from 'ngimport'; @@ -206,7 +206,7 @@ export class ExecutionFilterService { configAccounts.push(...stageConfig.configAccountExtractor(stage)); } }); - return uniq(compact(flattenDeep(configAccounts))).filter(a => !a.includes('${')); // exclude parameterized accounts + return uniq(compact(configAccounts)).filter(a => !a.includes('${')); // exclude parameterized accounts } private static fixName(execution: IExecution, application: Application): void { diff --git a/app/scripts/modules/core/src/pipeline/service/ExecutionsTransformer.ts b/app/scripts/modules/core/src/pipeline/service/ExecutionsTransformer.ts index 2e0796142e7..6ad642251ef 100644 --- a/app/scripts/modules/core/src/pipeline/service/ExecutionsTransformer.ts +++ b/app/scripts/modules/core/src/pipeline/service/ExecutionsTransformer.ts @@ -1,5 +1,5 @@ import { duration } from 'core/utils/timeFormatters'; -import { find, findLast, flattenDeep, get, has, maxBy, uniq, sortBy } from 'lodash'; +import { find, findLast, get, has, maxBy, uniq, sortBy } from 'lodash'; import { Application } from 'core/application'; import { ExecutionBarLabel } from 'core/pipeline/config/stages/common/ExecutionBarLabel'; @@ -21,10 +21,10 @@ export class ExecutionsTransformer { execution.stages.forEach(stage => { const stageConfig = Registry.pipeline.getStageConfig(stage); if (stageConfig && stageConfig.accountExtractor) { - targets.push(stageConfig.accountExtractor(stage)); + targets.push(...stageConfig.accountExtractor(stage)); } }); - execution.deploymentTargets = uniq(flattenDeep(targets)).sort(); + execution.deploymentTargets = uniq(targets).sort(); } private static siblingStageSorter(a: IOrchestratedItem, b: IOrchestratedItem): number { diff --git a/app/scripts/modules/ecs/src/pipeline/stages/cloneServerGroup/ecsCloneServerGroupStage.js b/app/scripts/modules/ecs/src/pipeline/stages/cloneServerGroup/ecsCloneServerGroupStage.js index 244da1ba626..4f2fbcb4e74 100644 --- a/app/scripts/modules/ecs/src/pipeline/stages/cloneServerGroup/ecsCloneServerGroupStage.js +++ b/app/scripts/modules/ecs/src/pipeline/stages/cloneServerGroup/ecsCloneServerGroupStage.js @@ -13,7 +13,7 @@ module.exports = angular cloudProvider: 'ecs', templateUrl: require('./cloneServerGroupStage.html'), executionStepLabelUrl: require('./cloneServerGroupStepLabel.html'), - accountExtractor: stage => stage.context.credentials, + accountExtractor: stage => [stage.context.credentials], validators: [ { type: 'requiredField', fieldName: 'targetCluster', fieldLabel: 'cluster' }, { type: 'requiredField', fieldName: 'target' }, diff --git a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/deleteManifest/deleteManifestStage.ts b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/deleteManifest/deleteManifestStage.ts index 4ff3d54cf0a..35519d5d368 100644 --- a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/deleteManifest/deleteManifestStage.ts +++ b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/deleteManifest/deleteManifestStage.ts @@ -20,7 +20,7 @@ module(KUBERNETES_DELETE_MANIFEST_STAGE, []).config(() => { cloudProvider: 'kubernetes', component: DeleteManifestStageConfig, executionDetailsSections: [manifestExecutionDetails(STAGE_KEY), ExecutionDetailsTasks], - accountExtractor: (stage: IStage): string => (stage.account ? stage.account : []), + accountExtractor: (stage: IStage): string[] => (stage.account ? [stage.account] : []), configAccountExtractor: (stage: any): string[] => (stage.account ? [stage.account] : []), validators: manifestSelectorValidators(STAGE_NAME), }); diff --git a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/deployManifest/deployManifestStage.ts b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/deployManifest/deployManifestStage.ts index 35c60e47f57..3cbbd552b46 100644 --- a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/deployManifest/deployManifestStage.ts +++ b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/deployManifest/deployManifestStage.ts @@ -24,7 +24,7 @@ if (SETTINGS.feature.versionedProviders) { producesArtifacts: true, defaultTimeoutMs: 30 * 60 * 1000, // 30 minutes validators: deployManifestValidators(), - accountExtractor: (stage: IStage): string => (stage.account ? stage.account : ''), + accountExtractor: (stage: IStage): string[] => (stage.account ? [stage.account] : []), configAccountExtractor: (stage: any): string[] => (stage.account ? [stage.account] : []), artifactExtractor: ExpectedArtifactService.accumulateArtifacts(['manifestArtifactId', 'requiredArtifactIds']), artifactRemover: ArtifactReferenceService.removeArtifactFromFields(['manifestArtifactId', 'requiredArtifactIds']), diff --git a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/scaleManifest/scaleManifestStage.ts b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/scaleManifest/scaleManifestStage.ts index 302fe07d651..cca3ed42838 100644 --- a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/scaleManifest/scaleManifestStage.ts +++ b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/scaleManifest/scaleManifestStage.ts @@ -21,7 +21,7 @@ module(KUBERNETES_SCALE_MANIFEST_STAGE, [KUBERNETES_SCALE_MANIFEST_SETTINGS_FORM controller: 'KubernetesV2ScaleManifestConfigCtrl', controllerAs: 'ctrl', executionDetailsSections: [manifestExecutionDetails(STAGE_KEY), ExecutionDetailsTasks], - accountExtractor: (stage: IStage): string => (stage.account ? stage.account : ''), + accountExtractor: (stage: IStage): string[] => (stage.account ? [stage.account] : []), configAccountExtractor: (stage: any): string[] => (stage.account ? [stage.account] : []), validators: [ { type: 'requiredField', fieldName: 'location', fieldLabel: 'Namespace' }, diff --git a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/traffic/disableManifest.stage.ts b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/traffic/disableManifest.stage.ts index 485152690de..4dd6e8ceadb 100644 --- a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/traffic/disableManifest.stage.ts +++ b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/traffic/disableManifest.stage.ts @@ -17,7 +17,7 @@ module(KUBERNETES_DISABLE_MANIFEST_STAGE, [EXECUTION_ARTIFACT_TAB]).config(() => component: ManifestTrafficStageConfig, executionDetailsSections: [manifestExecutionDetails(STAGE_KEY), ExecutionDetailsTasks], defaultTimeoutMs: 30 * 60 * 1000, // 30 minutes - accountExtractor: (stage: IStage): string => (stage.account ? stage.account : ''), + accountExtractor: (stage: IStage): string[] => (stage.account ? [stage.account] : []), configAccountExtractor: (stage: IStage): string[] => (stage.account ? [stage.account] : []), validators: manifestSelectorValidators(STAGE_NAME), }); diff --git a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/traffic/enableManifest.stage.ts b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/traffic/enableManifest.stage.ts index 7f20290b48d..8f59f52a4be 100644 --- a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/traffic/enableManifest.stage.ts +++ b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/traffic/enableManifest.stage.ts @@ -18,7 +18,7 @@ module(KUBERNETES_ENABLE_MANIFEST_STAGE, [EXECUTION_ARTIFACT_TAB]).config(() => component: ManifestTrafficStageConfig, executionDetailsSections: [manifestExecutionDetails(STAGE_KEY), ExecutionDetailsTasks], defaultTimeoutMs: 30 * 60 * 1000, // 30 minutes - accountExtractor: (stage: IStage): string => (stage.account ? stage.account : ''), + accountExtractor: (stage: IStage): string[] => (stage.account ? [stage.account] : []), configAccountExtractor: (stage: IStage): string[] => (stage.account ? [stage.account] : []), validators: manifestSelectorValidators(STAGE_NAME), }); diff --git a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/undoRolloutManifest/undoRolloutManifestStage.ts b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/undoRolloutManifest/undoRolloutManifestStage.ts index 0746d3a531a..f5cbd4ef7cd 100644 --- a/app/scripts/modules/kubernetes/src/v2/pipelines/stages/undoRolloutManifest/undoRolloutManifestStage.ts +++ b/app/scripts/modules/kubernetes/src/v2/pipelines/stages/undoRolloutManifest/undoRolloutManifestStage.ts @@ -17,7 +17,7 @@ module(KUBERNETES_UNDO_ROLLOUT_MANIFEST_STAGE, []) templateUrl: require('./undoRolloutManifestConfig.html'), controller: 'KubernetesV2UndoRolloutManifestConfigCtrl', controllerAs: 'ctrl', - accountExtractor: (stage: IStage): string => (stage.account ? stage.account : ''), + accountExtractor: (stage: IStage): string[] => (stage.account ? [stage.account] : []), configAccountExtractor: (stage: any): string[] => (stage.account ? [stage.account] : []), validators: [ { type: 'requiredField', fieldName: 'location', fieldLabel: 'Namespace' }, diff --git a/app/scripts/modules/titus/src/pipeline/stages/runJob/titusRunJobStage.ts b/app/scripts/modules/titus/src/pipeline/stages/runJob/titusRunJobStage.ts index 587e5ef42b0..4c461e45890 100644 --- a/app/scripts/modules/titus/src/pipeline/stages/runJob/titusRunJobStage.ts +++ b/app/scripts/modules/titus/src/pipeline/stages/runJob/titusRunJobStage.ts @@ -1,4 +1,4 @@ -import { ExecutionDetailsTasks, Registry } from '@spinnaker/core'; +import { ExecutionDetailsTasks, Registry, IStage } from '@spinnaker/core'; import { RunJobExecutionDetails } from './RunJobExecutionDetails'; import { TitusRunJobStageConfig } from './TitusRunJobStageConfig'; @@ -12,6 +12,8 @@ Registry.pipeline.registerStage({ providesFor: ['aws', 'titus'], component: TitusRunJobStageConfig, executionDetailsSections: [RunJobExecutionDetails, ExecutionDetailsTasks], + accountExtractor: (stage: IStage) => [stage.context.credentials], + configAccountExtractor: (stage: IStage) => [stage.credentials], defaultTimeoutMs: 2 * 60 * 60 * 1000, // 2 hours validators: [ { type: 'requiredField', fieldName: 'cluster.iamProfile' },