-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aws_codebuild - Add resource_tags parameter and deprecate tags (#1221)
aws_codebuild - Add resource_tags parameter and deprecate tags SUMMARY aws_codebuild currently uses the boto3 style 'list of dictionaries' format rather than the usual dictionary format. Add a resource_tags parameter that accepts the usual dictionary format Add the purge_tags parameter deprecate the tags parameter in preparation for switching it to the usual dict format expand integration tests for tags and description make source and artifacts optional unless creating a new project fix bug with inconsistent "changed" state due to tag order not being guaranteed ISSUE TYPE Bugfix Pull Request Feature Pull Request COMPONENT NAME aws_codebuild ADDITIONAL INFORMATION The (boto3) tags format in the return value when describing a project makes no guarantees about the order it'll return the key/value pairs. As such, when multiple tags were set the naïve original == new comparison would sporadically return "changed" when no change had occurred. Reviewed-by: Joseph Torcasso <None> Reviewed-by: Mark Chappell <None> (cherry picked from commit 20f2afd)
- Loading branch information
1 parent
c444062
commit 1e048f1
Showing
6 changed files
with
495 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
minor_changes: | ||
- aws_codebuild - add support for ``purge_tags`` parameter | ||
(https://github.com/ansible-collections/community.aws/pull/1221). | ||
- aws_codebuild - the ``source`` and ``artifacts`` parameters are now optional unless creating a new project | ||
(https://github.com/ansible-collections/community.aws/pull/1221). | ||
- aws_codebuild - add the ``resource_tags`` parameter which takes the dictionary format for tags instead of the list of dictionaries format | ||
(https://github.com/ansible-collections/community.aws/pull/1221). | ||
- aws_codebuild - add the ``resource_tags`` return value which returns the standard dictionary format for tags instead of the list of | ||
dictionaries format | ||
(https://github.com/ansible-collections/community.aws/pull/1221). | ||
|
||
bugfixes: | ||
- aws_codebuild - fix bug where the result may be spuriously flagged as ``changed`` when multiple tags were set on the project | ||
(https://github.com/ansible-collections/community.aws/pull/1221). | ||
|
||
deprecated_features: | ||
- aws_codebuild - The ``tags`` parameter currently uses a non-standard format and has been deprecated. In release 6.0.0 this parameter will | ||
accept a simple key/value pair dictionary instead of the current list of dictionaries. It is recommended to migrate to using the | ||
resource_tags parameter which already accepts the simple dictionary format | ||
(https://github.com/ansible-collections/community.aws/pull/1221). |
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
125 changes: 125 additions & 0 deletions
125
tests/integration/targets/aws_codebuild/tasks/description.yml
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,125 @@ | ||
- name: Tests relating to setting description on aws_codebuild | ||
vars: | ||
description_one: 'a Description - {{ resource_prefix }}' | ||
description_two: 'Another_Description - {{ resource_prefix }}' | ||
# Mandatory settings | ||
module_defaults: | ||
community.aws.aws_codebuild: | ||
name: '{{ project_name }}' | ||
# community.aws.aws_codebuild_info: | ||
# name: '{{ project_name }}' | ||
block: | ||
|
||
# - name: test setting description aws_codebuild (check mode) | ||
# aws_codebuild: | ||
# description: '{{ description_one }}' | ||
# register: update_result | ||
# check_mode: yes | ||
# - name: assert that update succeeded | ||
# assert: | ||
# that: | ||
# - update_result is changed | ||
|
||
- name: test setting description aws_codebuild | ||
aws_codebuild: | ||
description: '{{ description_one }}' | ||
register: update_result | ||
- name: assert that update succeeded | ||
assert: | ||
that: | ||
- update_result is changed | ||
- update_result.project.description == description_one | ||
|
||
# - name: test setting description aws_codebuild - idempotency (check mode) | ||
# aws_codebuild: | ||
# description: '{{ description_one }}' | ||
# register: update_result | ||
# check_mode: yes | ||
# - name: assert that update succeeded | ||
# assert: | ||
# that: | ||
# - update_result is not changed | ||
|
||
- name: test setting description aws_codebuild - idempotency | ||
aws_codebuild: | ||
description: '{{ description_one }}' | ||
register: update_result | ||
- name: assert that update succeeded | ||
assert: | ||
that: | ||
- update_result is not changed | ||
- update_result.project.description == description_one | ||
|
||
### | ||
|
||
# - name: test updating description on aws_codebuild (check mode) | ||
# aws_codebuild: | ||
# description: '{{ description_two }}' | ||
# register: update_result | ||
# check_mode: yes | ||
# - name: assert that update succeeded | ||
# assert: | ||
# that: | ||
# - update_result is changed | ||
|
||
- name: test updating description on aws_codebuild | ||
aws_codebuild: | ||
description: '{{ description_two }}' | ||
register: update_result | ||
- name: assert that update succeeded | ||
assert: | ||
that: | ||
- update_result is changed | ||
- update_result.project.description == description_two | ||
|
||
# - name: test updating description on aws_codebuild - idempotency (check mode) | ||
# aws_codebuild: | ||
# description: '{{ description_two }}' | ||
# register: update_result | ||
# check_mode: yes | ||
# - name: assert that update succeeded | ||
# assert: | ||
# that: | ||
# - update_result is not changed | ||
|
||
- name: test updating description on aws_codebuild - idempotency | ||
aws_codebuild: | ||
description: '{{ description_two }}' | ||
register: update_result | ||
- name: assert that update succeeded | ||
assert: | ||
that: | ||
- update_result is not changed | ||
- update_result.project.description == description_two | ||
|
||
# ### | ||
# | ||
# - name: test that aws_codebuild_info returns the description | ||
# aws_codebuild_info: | ||
# register: tag_info | ||
# - name: assert description present | ||
# assert: | ||
# that: | ||
# - tag_info.project.description == description_two | ||
# | ||
# ### | ||
|
||
# - name: test no description param aws_codebuild (check mode) | ||
# aws_codebuild: {} | ||
# register: update_result | ||
# check_mode: yes | ||
# - name: assert no change | ||
# assert: | ||
# that: | ||
# - update_result is not changed | ||
# - update_result.project.description == description_two | ||
|
||
|
||
- name: test no description param aws_codebuild | ||
aws_codebuild: {} | ||
register: update_result | ||
- name: assert no change | ||
assert: | ||
that: | ||
- update_result is not changed | ||
- update_result.project.description == description_two |
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
Oops, something went wrong.