-
Notifications
You must be signed in to change notification settings - Fork 236
Feature: Wave Config for Targets #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4e78f97
Introducing Wave Feature to Pipelines
5120173
Merge branch 'master' into feature/waves
StewartW 5a45715
Merge branch 'master' into feature/waves
StewartW 5505eb9
Merge branch 'master' into feature/waves
StewartW d664884
Merge branch 'master' into feature/waves
StewartW a0dd5cb
Removing duplicated code. Removing unused imports
StewartW 5f5c7ba
Removed redundant empty lines from tests
sbkok 2f6ecf3
Add user documentation on the wave configuration
sbkok e6d51cf
rename wave_config to just wave
StewartW 1d73083
Fix schema upper case issue of TARGET_WAVE_SCHEME
sbkok d9ba292
Fix account_id typo in tests
sbkok File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
.../bootstrap_repository/adf-build/shared/cdk/cdk_stacks/tests/test_default_pipeline_type.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| # Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| # SPDX-License-Identifier: MIT-0 | ||
|
|
||
| # pylint: skip-file | ||
|
|
||
| from aws_cdk import core | ||
| from cdk_stacks.main import PipelineStack | ||
|
|
||
|
|
||
| def test_pipeline_creation_outputs_as_expected_when_input_has_1_target_with_2_waves(): | ||
| region_name = "eu-central-1" | ||
| acount_id = "123456789012" | ||
|
|
||
| stack_input = { | ||
| "input": { | ||
| "params": {}, | ||
| "default_providers": {"deploy": {"provider": "codedeploy"}}, | ||
| "regions": {}, | ||
| }, | ||
| "ssm_params": {"fake-region": {}}, | ||
| } | ||
|
|
||
| stack_input["input"]["name"] = "test-stack" | ||
| stack_input["input"]["environments"] = { | ||
| "targets": [ | ||
| [ | ||
| [ | ||
| {"name": "account-1", "id": "001", "regions": ["eu-west-1"]}, | ||
| {"name": "account-2", "id": "002", "regions": ["eu-west-1"]}, | ||
| {"name": "account-3", "id": "003", "regions": ["eu-west-1"]}, | ||
| ], | ||
| [ | ||
| {"name": "account-4", "id": "004", "regions": ["eu-west-1"]}, | ||
| {"name": "account-5", "id": "005", "regions": ["eu-west-1"]}, | ||
| {"name": "account-6", "id": "006", "regions": ["eu-west-1"]}, | ||
| ], | ||
| ], | ||
| ] | ||
| } | ||
|
|
||
| stack_input["input"]["default_providers"]["source"] = { | ||
| "provider": "codecommit", | ||
| "properties": {"account_id": "123456789012"}, | ||
| } | ||
| stack_input["input"]["default_providers"]["build"] = { | ||
| "provider": "codebuild", | ||
| "properties": {"account_id": "123456789012"}, | ||
| } | ||
|
|
||
| stack_input["ssm_params"][region_name] = { | ||
| "modules": "fake-bucket-name", | ||
| "kms": f"arn:aws:kms:{region_name}:{acount_id}:key/my-unique-kms-key-id", | ||
sbkok marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| app = core.App() | ||
| PipelineStack(app, stack_input) | ||
|
|
||
| cloud_assembly = app.synth() | ||
| resources = { | ||
| k[0:-8]: v for k, v in cloud_assembly.stacks[0].template["Resources"].items() | ||
| } | ||
| code_pipeline = resources["codepipeline"] | ||
| assert code_pipeline["Type"] == "AWS::CodePipeline::Pipeline" | ||
| assert len(code_pipeline["Properties"]["Stages"]) == 4 | ||
|
|
||
| target_1_wave_1 = code_pipeline["Properties"]["Stages"][2] | ||
| assert target_1_wave_1["Name"] == "deployment-stage-1-wave-0" | ||
| assert len(target_1_wave_1["Actions"]) == 3 | ||
|
|
||
| target_1_wave_2 = code_pipeline["Properties"]["Stages"][3] | ||
| assert target_1_wave_2["Name"] == "deployment-stage-1-wave-1" | ||
| assert len(target_1_wave_2["Actions"]) == 3 | ||
|
|
||
|
|
||
| def test_pipeline_creation_outputs_as_expected_when_input_has_2_targets_with_2_waves_and_1_wave(): | ||
| region_name = "eu-central-1" | ||
| acount_id = "123456789012" | ||
sbkok marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| stack_input = { | ||
| "input": { | ||
| "params": {}, | ||
| "default_providers": {"deploy": {"provider": "codedeploy"}}, | ||
| "regions": {}, | ||
| }, | ||
| "ssm_params": {"fake-region": {}}, | ||
| } | ||
|
|
||
| stack_input["input"]["name"] = "test-stack" | ||
| stack_input["input"]["environments"] = { | ||
| "targets": [ | ||
| [ | ||
| [ | ||
| {"name": "account-1", "id": "001", "regions": ["eu-west-1"]}, | ||
| {"name": "account-2", "id": "002", "regions": ["eu-west-1"]}, | ||
| {"name": "account-3", "id": "003", "regions": ["eu-west-1"]}, | ||
| ], | ||
| [ | ||
| {"name": "account-4", "id": "004", "regions": ["eu-west-1"]}, | ||
| {"name": "account-5", "id": "005", "regions": ["eu-west-1"]}, | ||
| {"name": "account-6", "id": "006", "regions": ["eu-west-1"]}, | ||
| ], | ||
| ], | ||
| [[{"name": "account-7", "id": "007", "regions": ["eu-west-2"]}]], | ||
| ] | ||
| } | ||
|
|
||
| stack_input["input"]["default_providers"]["source"] = { | ||
| "provider": "codecommit", | ||
| "properties": {"account_id": "123456789012"}, | ||
| } | ||
| stack_input["input"]["default_providers"]["build"] = { | ||
| "provider": "codebuild", | ||
| "properties": {"account_id": "123456789012"}, | ||
| } | ||
|
|
||
| stack_input["ssm_params"][region_name] = { | ||
| "modules": "fake-bucket-name", | ||
| "kms": f"arn:aws:kms:{region_name}:{acount_id}:key/my-unique-kms-key-id", | ||
sbkok marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| app = core.App() | ||
| PipelineStack(app, stack_input) | ||
|
|
||
| cloud_assembly = app.synth() | ||
| resources = { | ||
| k[0:-8]: v for k, v in cloud_assembly.stacks[0].template["Resources"].items() | ||
| } | ||
| code_pipeline = resources["codepipeline"] | ||
| assert code_pipeline["Type"] == "AWS::CodePipeline::Pipeline" | ||
| assert len(code_pipeline["Properties"]["Stages"]) == 5 | ||
|
|
||
| target_1_wave_1 = code_pipeline["Properties"]["Stages"][2] | ||
| assert target_1_wave_1["Name"] == "deployment-stage-1-wave-0" | ||
| assert len(target_1_wave_1["Actions"]) == 3 | ||
|
|
||
| target_1_wave_2 = code_pipeline["Properties"]["Stages"][3] | ||
| assert target_1_wave_2["Name"] == "deployment-stage-1-wave-1" | ||
| assert len(target_1_wave_2["Actions"]) == 3 | ||
|
|
||
| target_2_wave_1 = code_pipeline["Properties"]["Stages"][4] | ||
| assert target_2_wave_1["Name"] == "deployment-stage-2-wave-0" | ||
| assert len(target_2_wave_1["Actions"]) == 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.