Use base stack name as the environment within aws cloud formations
							parent
							
								
									52ef99fb78
								
							
						
					
					
						commit
						29442b7508
					
				|  | @ -450,7 +450,7 @@ class AWSBuildEnvironment { | ||||||
|                     taskDefCloudFormation = this.insertAtTemplate(taskDefCloudFormation, 'p2 - secret', this.getSecretTemplate(secret.ParameterKey.replace(/[^\dA-Za-z]/g, ''))); |                     taskDefCloudFormation = this.insertAtTemplate(taskDefCloudFormation, 'p2 - secret', this.getSecretTemplate(secret.ParameterKey.replace(/[^\dA-Za-z]/g, ''))); | ||||||
|                     taskDefCloudFormation = this.insertAtTemplate(taskDefCloudFormation, 'p3 - container def', this.getSecretDefinitionTemplate(secret.EnvironmentVariable, secret.ParameterKey.replace(/[^\dA-Za-z]/g, ''))); |                     taskDefCloudFormation = this.insertAtTemplate(taskDefCloudFormation, 'p3 - container def', this.getSecretDefinitionTemplate(secret.EnvironmentVariable, secret.ParameterKey.replace(/[^\dA-Za-z]/g, ''))); | ||||||
|                 } |                 } | ||||||
|                 const mappedSecrets = secrets.map((x) => { |                 const secretsMappedToCloudFormationParameters = secrets.map((x) => { | ||||||
|                     return { ParameterKey: x.ParameterKey.replace(/[^\dA-Za-z]/g, ''), ParameterValue: x.ParameterValue }; |                     return { ParameterKey: x.ParameterKey.replace(/[^\dA-Za-z]/g, ''), ParameterValue: x.ParameterValue }; | ||||||
|                 }); |                 }); | ||||||
|                 yield CF.createStack({ |                 yield CF.createStack({ | ||||||
|  | @ -458,6 +458,10 @@ class AWSBuildEnvironment { | ||||||
|                     TemplateBody: taskDefCloudFormation, |                     TemplateBody: taskDefCloudFormation, | ||||||
|                     Capabilities: ['CAPABILITY_IAM'], |                     Capabilities: ['CAPABILITY_IAM'], | ||||||
|                     Parameters: [ |                     Parameters: [ | ||||||
|  |                         { | ||||||
|  |                             ParameterKey: 'Environment', | ||||||
|  |                             ParameterValue: this.baseStackName, | ||||||
|  |                         }, | ||||||
|                         { |                         { | ||||||
|                             ParameterKey: 'ImageUrl', |                             ParameterKey: 'ImageUrl', | ||||||
|                             ParameterValue: image, |                             ParameterValue: image, | ||||||
|  | @ -486,7 +490,7 @@ class AWSBuildEnvironment { | ||||||
|                             ParameterKey: 'BUILDID', |                             ParameterKey: 'BUILDID', | ||||||
|                             ParameterValue: buildGuid, |                             ParameterValue: buildGuid, | ||||||
|                         }, |                         }, | ||||||
|                         ...mappedSecrets, |                         ...secretsMappedToCloudFormationParameters, | ||||||
|                     ], |                     ], | ||||||
|                 }).promise(); |                 }).promise(); | ||||||
|                 core.info('Creating cloud runner job'); |                 core.info('Creating cloud runner job'); | ||||||
|  | @ -547,7 +551,7 @@ class AWSBuildEnvironment { | ||||||
|                 StackName: baseStackName, |                 StackName: baseStackName, | ||||||
|             }; |             }; | ||||||
|             const parameters = [ |             const parameters = [ | ||||||
|                 { ParameterKey: 'EnvironmentName', ParameterValue: 'development' }, |                 { ParameterKey: 'EnvironmentName', ParameterValue: baseStackName }, | ||||||
|                 { ParameterKey: 'Storage', ParameterValue: `${baseStackName}-storage` }, |                 { ParameterKey: 'Storage', ParameterValue: `${baseStackName}-storage` }, | ||||||
|                 { ParameterKey: 'Version', ParameterValue: hash }, |                 { ParameterKey: 'Version', ParameterValue: hash }, | ||||||
|             ]; |             ]; | ||||||
|  |  | ||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -152,7 +152,7 @@ class AWSBuildEnvironment implements CloudRunnerProviderInterface { | ||||||
|           this.getSecretDefinitionTemplate(secret.EnvironmentVariable, secret.ParameterKey.replace(/[^\dA-Za-z]/g, '')), |           this.getSecretDefinitionTemplate(secret.EnvironmentVariable, secret.ParameterKey.replace(/[^\dA-Za-z]/g, '')), | ||||||
|         ); |         ); | ||||||
|       } |       } | ||||||
|       const mappedSecrets = secrets.map((x) => { |       const secretsMappedToCloudFormationParameters = secrets.map((x) => { | ||||||
|         return { ParameterKey: x.ParameterKey.replace(/[^\dA-Za-z]/g, ''), ParameterValue: x.ParameterValue }; |         return { ParameterKey: x.ParameterKey.replace(/[^\dA-Za-z]/g, ''), ParameterValue: x.ParameterValue }; | ||||||
|       }); |       }); | ||||||
| 
 | 
 | ||||||
|  | @ -161,6 +161,10 @@ class AWSBuildEnvironment implements CloudRunnerProviderInterface { | ||||||
|         TemplateBody: taskDefCloudFormation, |         TemplateBody: taskDefCloudFormation, | ||||||
|         Capabilities: ['CAPABILITY_IAM'], |         Capabilities: ['CAPABILITY_IAM'], | ||||||
|         Parameters: [ |         Parameters: [ | ||||||
|  |           { | ||||||
|  |             ParameterKey: 'Environment', | ||||||
|  |             ParameterValue: this.baseStackName, | ||||||
|  |           }, | ||||||
|           { |           { | ||||||
|             ParameterKey: 'ImageUrl', |             ParameterKey: 'ImageUrl', | ||||||
|             ParameterValue: image, |             ParameterValue: image, | ||||||
|  | @ -189,7 +193,7 @@ class AWSBuildEnvironment implements CloudRunnerProviderInterface { | ||||||
|             ParameterKey: 'BUILDID', |             ParameterKey: 'BUILDID', | ||||||
|             ParameterValue: buildGuid, |             ParameterValue: buildGuid, | ||||||
|           }, |           }, | ||||||
|           ...mappedSecrets, |           ...secretsMappedToCloudFormationParameters, | ||||||
|         ], |         ], | ||||||
|       }).promise(); |       }).promise(); | ||||||
|       core.info('Creating cloud runner job'); |       core.info('Creating cloud runner job'); | ||||||
|  | @ -256,7 +260,7 @@ class AWSBuildEnvironment implements CloudRunnerProviderInterface { | ||||||
|       StackName: baseStackName, |       StackName: baseStackName, | ||||||
|     }; |     }; | ||||||
|     const parameters: SDK.CloudFormation.Parameter[] = [ |     const parameters: SDK.CloudFormation.Parameter[] = [ | ||||||
|       { ParameterKey: 'EnvironmentName', ParameterValue: 'development' }, |       { ParameterKey: 'EnvironmentName', ParameterValue: baseStackName }, | ||||||
|       { ParameterKey: 'Storage', ParameterValue: `${baseStackName}-storage` }, |       { ParameterKey: 'Storage', ParameterValue: `${baseStackName}-storage` }, | ||||||
|       { ParameterKey: 'Version', ParameterValue: hash }, |       { ParameterKey: 'Version', ParameterValue: hash }, | ||||||
|     ]; |     ]; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue