From eef79f93e5c4a4129b29e991232f04b70909eb04 Mon Sep 17 00:00:00 2001 From: Efe Karakus Date: Thu, 10 Jun 2021 11:18:04 -0700 Subject: [PATCH] fix(cicd): replace dash in env name for TestCommands build project Fixes #2437 --- .../stack/cc_pipeline_integration_test.go | 2 +- .../stack/testdata/pipeline/cc_template.yaml | 24 +++++++++---------- templates/cicd/pipeline_cfn.yml | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/pkg/deploy/cloudformation/stack/cc_pipeline_integration_test.go b/internal/pkg/deploy/cloudformation/stack/cc_pipeline_integration_test.go index 9408a2f7856..ea1b145e12a 100644 --- a/internal/pkg/deploy/cloudformation/stack/cc_pipeline_integration_test.go +++ b/internal/pkg/deploy/cloudformation/stack/cc_pipeline_integration_test.go @@ -32,7 +32,7 @@ func TestCC_Pipeline_Template(t *testing.T) { Stages: []deploy.PipelineStage{ { AssociatedEnvironment: &deploy.AssociatedEnvironment{ - Name: "test", + Name: "staging-test", Region: "us-west-2", AccountID: "1111", }, diff --git a/internal/pkg/deploy/cloudformation/stack/testdata/pipeline/cc_template.yaml b/internal/pkg/deploy/cloudformation/stack/testdata/pipeline/cc_template.yaml index c17735c6aa5..3c83e5ca9f6 100644 --- a/internal/pkg/deploy/cloudformation/stack/testdata/pipeline/cc_template.yaml +++ b/internal/pkg/deploy/cloudformation/stack/testdata/pipeline/cc_template.yaml @@ -25,7 +25,7 @@ Resources: Version: '2012-10-17' Statement: - Effect: Allow - Resource: 'arn:aws:iam::1111:role/phonetool-test-EnvManagerRole' + Resource: 'arn:aws:iam::1111:role/phonetool-staging-test-EnvManagerRole' Action: - sts:AssumeRole BuildProjectPolicy: @@ -190,10 +190,10 @@ Resources: Action: - sts:AssumeRole Resource: - - arn:aws:iam::1111:role/phonetool-test-EnvManagerRole + - arn:aws:iam::1111:role/phonetool-staging-test-EnvManagerRole Roles: - !Ref PipelineRole - BuildTestCommandstest: + BuildTestCommandsstagingDASHtest: Type: AWS::CodeBuild::Project Properties: EncryptionKey: !ImportValue phonetool-ArtifactKey @@ -262,9 +262,9 @@ Resources: - Name: SCCheckoutArtifact OutputArtifacts: - Name: BuildOutput - - Name: DeployTo-test + - Name: DeployTo-staging-test Actions: - - Name: CreateOrUpdate-api-test + - Name: CreateOrUpdate-api-staging-test Region: us-west-2 ActionTypeId: Category: Deploy @@ -273,23 +273,23 @@ Resources: Provider: CloudFormation Configuration: # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-action-reference.html - ChangeSetName: phonetool-test-api + ChangeSetName: phonetool-staging-test-api ActionMode: CREATE_UPDATE - StackName: phonetool-test-api + StackName: phonetool-staging-test-api Capabilities: CAPABILITY_IAM,CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND - TemplatePath: BuildOutput::infrastructure/api-test.stack.yml - TemplateConfiguration: BuildOutput::infrastructure/api-test.params.json + TemplatePath: BuildOutput::infrastructure/api-staging-test.stack.yml + TemplateConfiguration: BuildOutput::infrastructure/api-staging-test.params.json # The ARN of the IAM role (in the env account) that # AWS CloudFormation assumes when it operates on resources # in a stack in an environment account. - RoleArn: arn:aws:iam::1111:role/phonetool-test-CFNExecutionRole + RoleArn: arn:aws:iam::1111:role/phonetool-staging-test-CFNExecutionRole InputArtifacts: - Name: BuildOutput RunOrder: 2 # The ARN of the environment manager IAM role (in the env # account) that performs the declared action. This is assumed # through the roleArn for the pipeline. - RoleArn: arn:aws:iam::1111:role/phonetool-test-EnvManagerRole + RoleArn: arn:aws:iam::1111:role/phonetool-staging-test-EnvManagerRole - Name: TestCommands ActionTypeId: Category: Test @@ -297,7 +297,7 @@ Resources: Version: 1 Provider: CodeBuild Configuration: - ProjectName: !Ref BuildTestCommandstest + ProjectName: !Ref BuildTestCommandsstagingDASHtest RunOrder: 3 InputArtifacts: - Name: SCCheckoutArtifact diff --git a/templates/cicd/pipeline_cfn.yml b/templates/cicd/pipeline_cfn.yml index d6842c001e2..8d78834cd01 100644 --- a/templates/cicd/pipeline_cfn.yml +++ b/templates/cicd/pipeline_cfn.yml @@ -236,7 +236,7 @@ Resources: - !Ref PipelineRole {{- range $index, $stage := .Stages}} {{- if $stage.TestCommands}} - BuildTestCommands{{$stage.Name}}: + BuildTestCommands{{logicalIDSafe $stage.Name}}: Type: AWS::CodeBuild::Project Properties: EncryptionKey: !ImportValue {{$.AppName}}-ArtifactKey @@ -396,7 +396,7 @@ Resources: Version: 1 Provider: CodeBuild Configuration: - ProjectName: !Ref BuildTestCommands{{$stage.Name}} + ProjectName: !Ref BuildTestCommands{{logicalIDSafe $stage.Name}} RunOrder: 3 InputArtifacts: - Name: SCCheckoutArtifact{{end}}{{end}}{{end}}{{end}}