forked from awslabs/aws-deployment-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix usage of source artifacts in deploy stages when build stage is di…
…sabled (awslabs#334) **Why?** When the build stage is disabled, the deploy stages incorrectly tried to use the build output artifact. These should use the source artifact instead. **Linked issues** * awslabs#236 * awslabs#318
- Loading branch information
Showing
7 changed files
with
474 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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 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 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
19 changes: 19 additions & 0 deletions
19
...p_repository/adf-build/shared/cdk/cdk_constructs/tests/adf_codepipeline_test_constants.py
This file contains 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,19 @@ | ||
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: MIT-0 | ||
|
||
# pylint: skip-file | ||
|
||
BASE_MAP_PARAMS = { | ||
'default_providers': { | ||
'source': { | ||
'properties': { | ||
'account_id': 123456123456, | ||
} | ||
}, | ||
'build': {}, | ||
'deploy': {}, | ||
}, | ||
'name': 'name', | ||
} | ||
|
||
|
42 changes: 42 additions & 0 deletions
42
...ap_repository/adf-build/shared/cdk/cdk_constructs/tests/test_adf_codepipeline_generate.py
This file contains 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,42 @@ | ||
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: MIT-0 | ||
|
||
# pylint: skip-file | ||
|
||
from mock import patch | ||
from cdk_constructs.adf_codepipeline import Action | ||
from adf_codepipeline_test_constants import BASE_MAP_PARAMS | ||
|
||
@patch('cdk_constructs.adf_codepipeline._codepipeline.CfnPipeline.ActionDeclarationProperty') | ||
@patch('cdk_constructs.adf_codepipeline.Action._get_output_artifacts') | ||
@patch('cdk_constructs.adf_codepipeline.Action._get_input_artifacts') | ||
def test_generates_with_input_and_output_artifacts_when_given(input_mock, output_mock, action_decl_mock): | ||
action_decl_mock.side_effect = lambda **x: x | ||
mocked_input_value = 'InputArtifacts' | ||
mocked_output_value = 'OutputArtifacts' | ||
input_mock.return_value = mocked_input_value | ||
output_mock.return_value = mocked_output_value | ||
action = Action( | ||
map_params=BASE_MAP_PARAMS, | ||
category='Build', | ||
provider='CodeBuild', | ||
) | ||
assert action.config['input_artifacts'] == mocked_input_value | ||
assert action.config['output_artifacts'] == mocked_output_value | ||
|
||
|
||
@patch('cdk_constructs.adf_codepipeline._codepipeline.CfnPipeline.ActionDeclarationProperty') | ||
@patch('cdk_constructs.adf_codepipeline.Action._get_output_artifacts') | ||
@patch('cdk_constructs.adf_codepipeline.Action._get_input_artifacts') | ||
def test_generates_without_input_and_output_artifacts(input_mock, output_mock, action_decl_mock): | ||
action_decl_mock.side_effect = lambda **x: x | ||
mocked_value = None | ||
input_mock.return_value = mocked_value | ||
output_mock.return_value = mocked_value | ||
action = Action( | ||
map_params=BASE_MAP_PARAMS, | ||
category='Build', | ||
provider='CodeBuild', | ||
) | ||
assert not 'input_artifacts' in action.config | ||
assert not 'output_artifacts' in action.config |
Oops, something went wrong.