forked from ansible/ansible
-
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.
Always allow "no-other-choice" pre-release dependencies when resolvin…
…g collection dependency tree PR ansible#81606. Prior to this patch, when `--pre` CLI flag was not passed, the dependency resolver would treat concrete collection dependency candidates (Git repositories, subdirs, tarball URLs, or local dirs or files etc) as not meeting the requirements. This patch makes it so pre-releases in any concrete artifact references, and the ones being specifically pinned dependencies or user requests, met anywhere in the dependency tree, are allowed unconditionally. This is achieved by moving the pre-release check from `is_satisfied_by()` to the `find_matches()` hook, following the Pip's example. As a bonus, this change also fixes the situation when a collection pre-releases weren't considered if it didn't have any stable releases. This now works even if `--pre` wasn't requested explicitly. Finally, this patch partially reverts commit 6f4b4c3, except for the tests. And it also improves the `--pre` hint warning to explain that it mostly affects Galaxy/Automation Hub-hosted collection releases. Ref ansible#73416 Ref ansible#79112 Fixes ansible#79168 Fixes ansible#80048 Resolves ansible#81605 Co-authored-by: Sloane Hertel <[email protected]>
- Loading branch information
Showing
9 changed files
with
309 additions
and
80 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
changelogs/fragments/81606-ansible-galaxy-collection-pre-releases.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,16 @@ | ||
--- | ||
|
||
bugfixes: | ||
- >- | ||
ansible-galaxy - started allowing the use of pre-releases | ||
for dependencies on any level of the dependency tree that | ||
specifically demand exact pre-release versions of | ||
collections and not version ranges. | ||
(https://github.com/ansible/ansible/pull/81606) | ||
- >- | ||
ansible-galaxy - started allowing the use of pre-releases | ||
for collections that do not have any stable versions | ||
published. | ||
(https://github.com/ansible/ansible/pull/81606) | ||
... |
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
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
79 changes: 79 additions & 0 deletions
79
test/integration/targets/ansible-galaxy-collection/tasks/pinned_pre_releases_in_deptree.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,79 @@ | ||
--- | ||
|
||
- name: >- | ||
test that the dependency resolver chooses pre-releases if they are pinned | ||
environment: | ||
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}' | ||
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg' | ||
block: | ||
- name: reset installation directory | ||
file: | ||
state: "{{ item }}" | ||
path: "{{ galaxy_dir }}/ansible_collections" | ||
loop: | ||
- absent | ||
- directory | ||
|
||
- name: >- | ||
install collections with pre-release versions in the dependency tree | ||
command: >- | ||
ansible-galaxy collection install | ||
meta_ns_with_transitive_wildcard_dep.meta_name_with_transitive_wildcard_dep | ||
rc_meta_ns_with_transitive_dev_dep.rc_meta_name_with_transitive_dev_dep:=2.4.5-rc5 | ||
{{ galaxy_verbosity }} | ||
register: prioritize_direct_req | ||
- assert: | ||
that: | ||
- >- | ||
"rc_meta_ns_with_transitive_dev_dep.rc_meta_name_with_transitive_dev_dep:2.4.5-rc5 was installed successfully" | ||
in prioritize_direct_req.stdout | ||
- >- | ||
"meta_ns_with_transitive_wildcard_dep.meta_name_with_transitive_wildcard_dep:4.5.6 was installed successfully" | ||
in prioritize_direct_req.stdout | ||
- >- | ||
"ns_with_dev_dep.name_with_dev_dep:6.7.8 was installed successfully" | ||
in prioritize_direct_req.stdout | ||
- >- | ||
"ns_with_wildcard_dep.name_with_wildcard_dep:5.6.7-beta.3 was installed successfully" | ||
in prioritize_direct_req.stdout | ||
- >- | ||
"dev_and_stables_ns.dev_and_stables_name:1.2.3-dev0 was installed successfully" | ||
in prioritize_direct_req.stdout | ||
- name: cleanup | ||
file: | ||
state: "{{ item }}" | ||
path: "{{ galaxy_dir }}/ansible_collections" | ||
loop: | ||
- absent | ||
- directory | ||
|
||
- name: >- | ||
install collection that only has pre-release versions published | ||
to the index | ||
command: >- | ||
ansible-galaxy collection install | ||
rc_meta_ns_with_transitive_dev_dep.rc_meta_name_with_transitive_dev_dep:* | ||
{{ galaxy_verbosity }} | ||
register: select_pre_release_if_no_stable | ||
- assert: | ||
that: | ||
- >- | ||
"rc_meta_ns_with_transitive_dev_dep.rc_meta_name_with_transitive_dev_dep:2.4.5-rc5 was installed successfully" | ||
in select_pre_release_if_no_stable.stdout | ||
- >- | ||
"ns_with_dev_dep.name_with_dev_dep:6.7.8 was installed successfully" | ||
in select_pre_release_if_no_stable.stdout | ||
- >- | ||
"dev_and_stables_ns.dev_and_stables_name:1.2.3-dev0 was installed successfully" | ||
in select_pre_release_if_no_stable.stdout | ||
always: | ||
- name: cleanup | ||
file: | ||
state: "{{ item }}" | ||
path: "{{ galaxy_dir }}/ansible_collections" | ||
loop: | ||
- absent | ||
- directory | ||
|
||
... |
Oops, something went wrong.