Skip to content

Commit

Permalink
Adjusting params for AccountExecution Tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPates committed Mar 8, 2024
1 parent 27254c2 commit 4567f3d
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 24 deletions.
6 changes: 3 additions & 3 deletions cicd/account_execution/staging/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ phases:
jq -n \
--argjson Parameters "{\"AppArn\": \"$AppArn\", \"AppVersion\": \"$AppVersion\", \"GoogleAdminEmailArn\": \"$SecretGoogleAdminEmail\", \"GoogleCredentialsArn\": \"$SecretGoogleCredentials\", \"SCIMEndpointUrlArn\": \"$SecretSCIMEndpoint\", \"SCIMAccessTokenArn\": \"$SecretSCIMAccessToken\", \"RegionArn\": \"$SecretRegion\", \"IdentityStoreIdArn\": \"$SecretIdentityStoreID\", \"GroupMatch\": \"name:Man*\"}" \
--argjson StackPolicy "{\"Statement\":[{\"Effect\": \"Allow\", \"NotAction\": \"Update:Delete\", \"Principal\": \"*\", \"Resource\": \"*\"}]}" \
'$ARGS.named' > ./deploy/management.json
'$ARGS.named' > ./deploy/cli.json
- cat ./deploy/management.json

# Update params with the values for this run for the delegated account
- |
jq -n \
--argjson Parameters "{\"AppArn\": \"$AppArn\", \"AppVersion\": \"$AppVersion\", \"GoogleAdminEmailArn\": \"$SecretGoogleAdminEmail\", \"GoogleCredentialsArn\": \"$SecretGoogleCredentials\", \"SCIMEndpointUrlArn\": \"$SecretSCIMEndpoint\", \"SCIMAccessTokenArn\": \"$SecretSCIMAccessToken\", \"RegionArn\": \"$SecretRegion\", \"IdentityStoreIdArn\": \"$SecretIdentityStoreID\", \"GroupMatch\": \"name:Del*\"}" \
--argjson StackPolicy "{\"Statement\":[{\"Effect\": \"Allow\", \"NotAction\": \"Update:Delete\", \"Principal\": \"*\", \"Resource\": \"*\"}]}" \
'$ARGS.named' > ./deploy/delegated.json
'$ARGS.named' > ./deploy/lambda.json
- cat ./deploy/delegated.json

# Update params with the values for this run for non-delegated account
- |
jq -n \
--argjson Parameters "{\"AppArn\": \"$AppArn\", \"AppVersion\": \"$AppVersion\", \"GoogleAdminEmailArn\": \"$SecretGoogleAdminEmail\", \"GoogleCredentialsArn\": \"$SecretGoogleCredentials\", \"SCIMEndpointUrlArn\": \"$SecretSCIMEndpoint\", \"SCIMAccessTokenArn\": \"$SecretSCIMAccessToken\", \"RegionArn\": \"$SecretRegion\", \"IdentityStoreIdArn\": \"$SecretIdentityStoreID\", \"GroupMatch\": \"name:Non*\"}" \
--argjson StackPolicy "{\"Statement\":[{\"Effect\": \"Allow\", \"NotAction\": \"Update:Delete\", \"Principal\": \"*\", \"Resource\": \"*\"}]}" \
'$ARGS.named' > ./deploy/nondelegated.json
'$ARGS.named' > ./deploy/codepipeline.json
- cat ./deploy/nondelegated.json


Expand Down
76 changes: 55 additions & 21 deletions cicd/cloudformation/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Resources:
S3Bucket: !Ref StagingBucket
S3ObjectKey: tests.zip
PollForSourceChanges: false
- Name: Deploy
- Name: TestsLambda
Actions:
- Name: Deploy
ActionTypeId:
Expand All @@ -200,27 +200,43 @@ Resources:
Capabilities: CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND,CAPABILITY_NAMED_IAM
StackName: TestAccountExecution
RoleArn: !GetAtt [CloudFormationDeployerRole, Arn]
TemplateConfiguration: !If [DeployManagement, 'Tests::deploy/management.json', !If [DeployDelegated, 'Tests::deploy/delegated.json', 'Tests::deploy/nondelegated.json']]
TemplateConfiguration: 'Tests::deploy/lambda.json'
TemplatePath: !Sub 'Tests::deploy/stack.yml'
InputArtifacts:
- Name: Tests
RunOrder: 1
- Name: SmokeTests
Actions:
- Name: Lambda
ActionTypeId:
Category: Test
Owner: AWS
Version: 1
Provider: CodeBuild
RunOrder: 1
RunOrder: 2
Configuration:
ProjectName: !Ref CodeBuildSmokeLambda
PrimarySource: Tests
OutputArtifacts:
- Name: AccountExecutionLambda
InputArtifacts:
- Name: Tests
- Name: TestsCLI
Actions:
- Name: Deploy
ActionTypeId:
Category: Deploy
Owner: AWS
Version: '1'
Provider: CloudFormation
Configuration:
ActionMode: CREATE_UPDATE
Capabilities: CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND,CAPABILITY_NAMED_IAM
StackName: TestAccountExecution
RoleArn: !GetAtt [CloudFormationDeployerRole, Arn]
TemplateConfiguration: 'Tests::deploy/cli.json'
TemplatePath: !Sub 'Tests::deploy/stack.yml'
InputArtifacts:
- Name: Tests
RunOrder: 1
- Name: CLI
ActionTypeId:
Category: Test
Expand All @@ -235,22 +251,40 @@ Resources:
- Name: SmokeCLI
InputArtifacts:
- Name: Tests
- !If
- DeployDelegated
- Name: CodePipeline
ActionTypeId:
Category: Invoke
Owner: AWS
Version: 1
Provider: Lambda
RunOrder: 3
Configuration:
FunctionName: SSOSyncFunction
OutputArtifacts:
- Name: AccountExecutionCodePipeline
InputArtifacts:
- Name: Tests
- !Ref AWS::NoValue
- !If
- DeployDelegated
- Name: TestsCodePipeline
Actions:
- Name: Deploy
ActionTypeId:
Category: Deploy
Owner: AWS
Version: '1'
Provider: CloudFormation
Configuration:
ActionMode: CREATE_UPDATE
Capabilities: CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND,CAPABILITY_NAMED_IAM
StackName: TestAccountExecution
RoleArn: !GetAtt [CloudFormationDeployerRole, Arn]
TemplateConfiguration: 'Tests::deploy/codepipeline.json'
TemplatePath: !Sub 'Tests::deploy/stack.yml'
InputArtifacts:
- Name: Tests
RunOrder: 1
- Name: CodePipeline
ActionTypeId:
Category: Invoke
Owner: AWS
Version: 1
Provider: Lambda
RunOrder: 2
Configuration:
FunctionName: SSOSyncFunction
OutputArtifacts:
- Name: AccountExecutionCodePipeline
InputArtifacts:
- Name: Tests
- !Ref AWS::NoValue
- Name: CleanUp
Actions:
- Name: RemoveStack
Expand Down

0 comments on commit 4567f3d

Please sign in to comment.