Skip to content

Comments

Improve rule KeepLatestNVersionImagesByProperty#163

Merged
allburov merged 1 commit intodevopshq:masterfrom
solactive:rule-improvement-KeepLatestNVersionImagesByProperty
Mar 20, 2025
Merged

Improve rule KeepLatestNVersionImagesByProperty#163
allburov merged 1 commit intodevopshq:masterfrom
solactive:rule-improvement-KeepLatestNVersionImagesByProperty

Conversation

@dmartin-solactive
Copy link
Contributor

Allow more custom version when used with corresponding custom regex

e.g.

  • version with prefix (uat-1.2.3)
  • any other version structure if there is at least an int for major, minor and patch in this order (see added tests)

Allow more custom version when used with corresponding custom regex
e.g.
- version with prefix (uat-1.2.3)
- any other version structure if there is at least an int for major,
  minor and patch in this order (see added tests)
@allburov allburov requested a review from Copilot March 20, 2025 11:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the Docker cleanup rules by allowing custom version formats to be parsed and filtered according to flexible regex patterns. Key changes include:

  • Addition of new tests in tests/test_rules_docker.py for versions with a prefix and custom version patterns.
  • Modification of the get_version method in artifactory_cleanup/rules/docker.py to use capturing groups from the regex.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/test_rules_docker.py Added tests to verify the new custom regex version parsing behavior.
artifactory_cleanup/rules/docker.py Updated get_version to extract version parts using regex capturing groups.
Comments suppressed due to low confidence (1)

artifactory_cleanup/rules/docker.py:266

  • This change assumes that the provided custom_regexp will always include capturing groups. Consider adding a check to confirm that match.groups() is not empty, or update the documentation to clearly state that a capturing group is required in the regex.
version_str = '.'.join(map(str, match.groups()))

@allburov allburov merged commit a907164 into devopshq:master Mar 20, 2025
2 checks passed
@allburov
Copy link
Member

allburov commented Mar 20, 2025

Thank you! We'll release a new version with the fix let's say 8 Apr!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants