Skip to content

Address first_found skip bug #15017

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

Merged
merged 2 commits into from
Mar 22, 2024
Merged

Address first_found skip bug #15017

merged 2 commits into from
Mar 22, 2024

Conversation

sivel
Copy link
Member

@sivel sivel commented Mar 21, 2024

SUMMARY

In current ansible-core versions, there is a bug where skip as a kwarg for first_found isn't working properly. This is being fixed in ansible/ansible#82836 but won't release for around 5 weeks from now.

In the meantime, the bug can be worked around by using the complex/mapping format for first_found and including skip: True there.

This PR also removes the <project_path>/requirements.yml paths from consideration as collection requirements that was incorrectly added as part of 4286d41. It's not clearly documented what the expectation of this file is, and I'm not going to address that here. However, the project root requirements.yml was originally a v1/old formatted file only including roles, and was expanded to allow collections, but this doesn't require it be v2/new formatted, and the agnostic install subcommand works with both, but the collections install subcommand does not work with both.

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • Other
AWX VERSION

ADDITIONAL INFORMATION

TASK [Fetch galaxy roles from roles/requirements.(yml/yaml)] *******************
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'req_file' failed. The error was: An unhandled exception occurred while templating '{{ lookup('ansible.builtin.first_found', req_candidates, skip=True) }}'. Error was a <class 'ansible.errors.AnsibleLookupError'>, original message: No file was found when using first_found.\\n\\nThe error appears to be in '/runner/project/project_update.yml': line 217, column 11, but may\\nbe elsewhere in the file depending on the exact syntax problem.\\n\\nThe offending line appears to be:\\n\\n    - block:\\n        - name: Fetch galaxy roles from roles/requirements.(yml/yaml)\\n          ^ here\\n"}

->

TASK [Fetch galaxy roles from roles/requirements.(yml/yaml)] *******************
skipping: [localhost] => {"changed": false, "false_condition": "req_file", "skip_reason": "Conditional result was False"}

- "{{ project_path | quote }}/collections/requirements.yml"
- "{{ project_path | quote }}/collections/requirements.yaml"
- "{{ project_path | quote }}/requirements.yml"
- "{{ project_path | quote }}/requirements.yaml"
Copy link
Member Author

Choose a reason for hiding this comment

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

The inclusion of these 2 requirements files in the project root seems to be failing some tests. These extra paths were added in 4286d41

I'm trying to look through docs now, to see what the description of a project root requirements.yml is intended to be. For the record we effectively have a v1 and v2 format for requirements.yml, where v1 is just roles, and v2 can contain collections and roles. The failures make it appear as though a project root may have just been v1.

@sivel sivel requested a review from john-westcott-iv March 21, 2024 22:02
@CFSNM CFSNM merged commit 934646a into ansible:devel Mar 22, 2024
@kurokobo
Copy link
Contributor

Related to: #14953

djyasin pushed a commit to djyasin/awx that referenced this pull request Sep 16, 2024
* Address first_found skip bug

* Don't attempt installing project root requirements.yml as v2 collection format
djyasin pushed a commit to djyasin/awx that referenced this pull request Nov 11, 2024
* Address first_found skip bug

* Don't attempt installing project root requirements.yml as v2 collection format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants