-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate the auto_prune_method and auto_prune_value parameters in favor of the new quay_organization_prune and quay_repository_prune modules. --------- Co-authored-by: Hervé Quatremain <[email protected]>
- Loading branch information
Showing
31 changed files
with
1,430 additions
and
71 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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
namespace: infra | ||
name: quay_configuration | ||
version: 2.2.0 | ||
version: 2.4.0 | ||
readme: README.md | ||
authors: | ||
- Hervé Quatremain <[email protected]> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright: (c) 2024 Hervé Quatremain <[email protected]> | ||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
__metaclass__ = type | ||
|
||
|
||
class ModuleDocFragment(object): | ||
# Ansible Galaxy documentation fragment | ||
DOCUMENTATION = r""" | ||
options: | ||
auto_prune_method: | ||
description: | ||
- The O(auto_prune_method) parameter is deprecated and will be removed in | ||
future versions of the collection. | ||
Use the M(infra.quay_configuration.quay_organization_prune) and the | ||
M(infra.quay_configuration.quay_repository_prune) modules instead. | ||
- Method to use for the auto-pruning tags policy. | ||
- If V(none), then the module ensures that no policy is in place. The | ||
tags are not pruned. | ||
If several policies are available, then the module removes them all. | ||
- If V(tags), then the policy keeps only the number of tags that you | ||
specify in O(auto_prune_value). | ||
- If V(date), then the policy deletes the tags older than the time period | ||
that you specify in O(auto_prune_value). | ||
- O(auto_prune_value) is required when O(auto_prune_method) is V(tags) or | ||
V(date). | ||
type: str | ||
choices: [none, tags, date] | ||
auto_prune_value: | ||
description: | ||
- The O(auto_prune_value) parameter is deprecated and will be removed in | ||
future versions of the collection. | ||
Use the M(infra.quay_configuration.quay_organization_prune) and the | ||
M(infra.quay_configuration.quay_repository_prune) modules instead. | ||
- Number of tags to keep when O(auto_prune_method) is V(tags). | ||
The value must be 1 or more. | ||
- Period of time when O(auto_prune_method) is V(date). The value must be 1 | ||
or more, and must be followed by a suffix; s (for second), m (for | ||
minute), h (for hour), d (for day), or w (for week). | ||
- O(auto_prune_method) is required when O(auto_prune_value) is set. | ||
type: str | ||
notes: | ||
- The O(auto_prune_method) and O(auto_prune_value) parameters are deprecated | ||
and will be removed in future versions of the collection. | ||
Use the M(infra.quay_configuration.quay_organization_prune) and the | ||
M(infra.quay_configuration.quay_repository_prune) modules instead. | ||
- Your Quay administrator must enable the auto-prune capability of your Quay | ||
installation (C(FEATURE_AUTO_PRUNE) in C(config.yaml)) to use the | ||
O(auto_prune_method) and O(auto_prune_value) parameters. | ||
- Using O(auto_prune_method) and O(auto_prune_value) requires Quay version | ||
3.11 or later. | ||
""" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,11 +72,6 @@ | |
default: present | ||
choices: [absent, present] | ||
notes: | ||
- Your Quay administrator must enable the auto-prune capability of your Quay | ||
installation (C(FEATURE_AUTO_PRUNE) in C(config.yaml)) to use the | ||
O(auto_prune_method) and O(auto_prune_value) parameters. | ||
- Using O(auto_prune_method) and O(auto_prune_value) requires Quay version | ||
3.11 or later. | ||
- The token that you provide in O(quay_token) must have the "Administer | ||
Organization" and "Administer User" permissions. | ||
- To rename organizations, the token must also have the "Super User Access" | ||
|
@@ -93,7 +88,7 @@ | |
- ansible.builtin.action_common_attributes | ||
- infra.quay_configuration.auth | ||
- infra.quay_configuration.auth.login | ||
- infra.quay_configuration.autoprune | ||
- infra.quay_configuration.autoprune_deprecated | ||
""" | ||
|
||
EXAMPLES = r""" | ||
|
@@ -102,8 +97,6 @@ | |
name: production | ||
email: [email protected] | ||
time_machine_expiration: "7d" | ||
auto_prune_method: tags | ||
auto_prune_value: 20 | ||
state: present | ||
quay_host: https://quay.example.com | ||
quay_token: vgfH9zH5q6eV16Con7SvDQYSr0KPYQimMHVehZv7 | ||
|
@@ -144,8 +137,14 @@ def main(): | |
new_name=dict(), | ||
email=dict(), | ||
time_machine_expiration=dict(choices=list(tm_allowed_values.keys())), | ||
auto_prune_method=dict(choices=["none", "tags", "date"]), | ||
auto_prune_value=dict(), | ||
auto_prune_method=dict( | ||
choices=["none", "tags", "date"], | ||
removed_at_date="2025-12-01", | ||
removed_from_collection="infra.quay_configuration", | ||
), | ||
auto_prune_value=dict( | ||
removed_at_date="2025-12-01", removed_from_collection="infra.quay_configuration" | ||
), | ||
state=dict(choices=["present", "absent"], default="present"), | ||
) | ||
|
||
|
@@ -330,15 +329,14 @@ def main(): | |
except (TypeError, IndexError): | ||
policies = [] | ||
|
||
# Removing the auto-prune policies (the UI only manages one policy, but | ||
# the backend seems to allow several policies) | ||
# Removing all the auto-pruning policies | ||
if auto_prune_method == "none": | ||
deleted = False | ||
for policy in policies: | ||
uuid = policy.get("uuid") | ||
if module.delete( | ||
uuid, | ||
"organization auto-prune policy", | ||
"organization auto-pruning policy", | ||
name, | ||
"organization/{orgname}/autoprunepolicy/{uuid}", | ||
auto_exit=False, | ||
|
@@ -366,7 +364,7 @@ def main(): | |
# then create the policy | ||
if len(policies) == 0 or policies[0].get("uuid") is None: | ||
module.create( | ||
"organization auto-prune policy", | ||
"organization auto-pruning policy", | ||
name, | ||
"organization/{orgname}/autoprunepolicy/", | ||
new_policy, | ||
|
@@ -379,7 +377,7 @@ def main(): | |
uuid = policies[0]["uuid"] | ||
new_policy["uuid"] = uuid | ||
module.unconditional_update( | ||
"organization auto-prune policy", | ||
"organization auto-pruning policy", | ||
name, | ||
"organization/{orgname}/autoprunepolicy/{uuid}", | ||
new_policy, | ||
|
Oops, something went wrong.