Skip to content
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

Azure container registry tags #830

Merged
merged 31 commits into from
Jun 7, 2022
Merged

Conversation

l3ender
Copy link
Contributor

@l3ender l3ender commented Apr 20, 2022

SUMMARY

This PR:

  • updates container registry management dependency to the latest.
  • adds support for working with container registry tags (importing or deleting).
  • fixes an existing issue where idempotency is not handled correctly when deleting a container registry.
ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

azure_rm_containerregistrytag
azure_rm_containerregistrytag_info

ADDITIONAL INFORMATION

Example usage:

- name: Import a tag to a different name
  azure_rm_containerregistrytag:
    registry: myRegistry
    repository_name: app1
    name: v1
    source_image:
      registry_uri: docker.io
      repository: library/hello-world
      name: latest

- name: Delete a tag
  azure_rm_containerregistrytag:
    registry: myRegistry
    repository_name: app1
    name: v1
    state: absent

The test suite can be run with the following playbook:

---
- name: "Playbook for testing."
  hosts: "localhost"
  connection: "local"
  gather_facts: false
  collections:
    - azure.azcollection

  tasks:
    - name: "Include tests"
      include_tasks: "tests/integration/targets/azure_rm_containerregistrytag/tasks/main.yml"

@l3ender
Copy link
Contributor Author

l3ender commented Apr 20, 2022

@Fred-sun Please take a look. Thank you!

@Fred-sun
Copy link
Collaborator

@l3ender Please change the module name to azure_rm_containerregistrytag. Be consistent with other module development. Thank you very much!


ERROR: plugins/modules/azure_rm_containerregistry_tag.py:0:0: undocumented-parameter: Argument 'source_image' is listed in the argument_spec, but not documented in the module documentation
ERROR: plugins/modules/azure_rm_containerregistry_tag.py:0:0: undocumented-parameter: Argument 'username' found in source_image -> credentials is listed in the argument_spec, but not documented in the module documentation
ERROR: plugins/modules/azure_rm_containerregistry_tag_info.py:0:0: nonexistent-parameter-documented: Argument 'append_tags' is listed in DOCUMENTATION.options, but not accepted by the module argument_spec
ERROR: plugins/modules/azure_rm_containerregistry_tag_info.py:0:0: nonexistent-parameter-documented: Argument 'tags' is listed in DOCUMENTATION.options, but not accepted by the module argument_spec
ERROR: plugins/modules/azure_rm_containerregistry_tag_info.py:0:0: return-syntax-error: RETURN.repositories.contains.tags.suboptions: extra keys not allowed @ data['repositories']['contains']['tags']['suboptions']. Got {'name': {'description': ['Name of the tag.'], 'type': 'str', 'sample': 'my-tag'}, 'digest': {'description': ['Digest of the tag.'], 'type': 'str', 'sample': 'sha256:7bd8fcb425afc34a7865f85868126e9c4fef5b2d6291986524687d289ab3a64a'}, 'created_on': {'description': ['Datetime of when the tag was created.'], 'type': 'datetime', 'sample': datetime.datetime(2022, 2, 2, 18, 18, 57, 145778, tzinfo=datetime.timezone.utc)}, 'last_updated_on': {'description': ['Datetime of when the tag was last updated...
See documentation for help: https://docs.ansible.com/ansible-core/devel/dev_guide/testing/sanity/validate-modules.html

plugins/modules/azure_rm_containerregistry_tag.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistry_tag.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistry_tag.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistry_tag.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistry_tag.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistry_tag_info.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistry_tag_info.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistry_tag.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistry_tag.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistry_tag_info.py Outdated Show resolved Hide resolved
@Fred-sun Fred-sun added new_module_pr Add new modules medium_priority Medium priority work in In trying to solve, or in working with contributors labels Apr 21, 2022
@l3ender
Copy link
Contributor Author

l3ender commented Apr 21, 2022

@Fred-sun PR is updated with review suggestions and sanity fixes. Please take another look...thank you!

@Fred-sun
Copy link
Collaborator

tests/integration/targets/azure_rm_containerregistry_tag/tasks/main.yml ---> tests/integration/targets/azure_rm_containerregistrytag/tasks/main.yml

@Fred-sun
Copy link
Collaborator

@l3ender If you upgrade azure-mgmt-containerregistry, please change the relevant modules that depend on this module as track1 and Track2 are incompatible. The modules that synchronize changes are as follows:

azure_rm_containerregistrywebhook.py
azure_rm_containerregistrywebhook_info.py
azure_rm_containerregistryreplication.py
azure_rm_containerregistryreplication_info.py

@l3ender
Copy link
Contributor Author

l3ender commented Apr 25, 2022

@Fred-sun I have updated the other modules you mentioned (any that use azure.mgmt.containerregistry). I am not sure how I missed it...thank you!

plugins/modules/azure_rm_containerregistrytag_info.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistrywebhook.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistrywebhook.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistrywebhook.py Outdated Show resolved Hide resolved
plugins/module_utils/azure_rm_common.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistryreplication.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistryreplication.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_containerregistryreplication.py Outdated Show resolved Hide resolved
@Fred-sun
Copy link
Collaborator

@l3ender n addition, can you authorize me to make some changes to this PR? Since some of the changes are not easy to describe, I will move forward with this PR merger as soon as possible. Thank you very much!

@l3ender
Copy link
Contributor Author

l3ender commented Apr 26, 2022

Thanks for the review, @Fred-sun! I apologize for missing the updates to use begin_xxx variants; I am working on multiple features in this repo and when I switched to this branch I neglected to install the correct dependencies...so I didn't see those methods!

You should have access to push changes to this PR/branch. Please let me know if you face any issue.

Thank you!

@l3ender
Copy link
Contributor Author

l3ender commented May 9, 2022

Hello @Fred-sun, anything else I can provide for this PR? Thank you!

@Fred-sun Fred-sun added ready_for_review The PR has been modified and can be reviewed and merged and removed work in In trying to solve, or in working with contributors labels May 25, 2022
@xuzhang3
Copy link
Collaborator

xuzhang3 commented Jun 7, 2022

LGTM

@xuzhang3 xuzhang3 merged commit b3ff4af into ansible-collections:dev Jun 7, 2022
@xuzhang3 xuzhang3 deleted the acr-tags branch June 7, 2022 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium_priority Medium priority new_module_pr Add new modules ready_for_review The PR has been modified and can be reviewed and merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants