-
Notifications
You must be signed in to change notification settings - Fork 98
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
Invalid requirements.txt leads to container built incorrectly #364
Comments
We will look into it! |
I just hit a similar problem, where the The ask would be to have ansible-builder ensure this is properly handled. |
This is still the case, I wonder if we shouldn't make the warning an error instead: diff --git a/src/ansible_builder/_target_scripts/introspect.py b/src/ansible_builder/_target_scripts/introspect.py
index 0d84e84..8f2ab43 100644
--- a/src/ansible_builder/_target_scripts/introspect.py
+++ b/src/ansible_builder/_target_scripts/introspect.py
@@ -345,7 +345,8 @@ def sanitize_requirements(collection_py_reqs):
consolidated.append(req)
seen_pkgs.add(req.name)
except Exception as e:
- logger.warning('Warning: failed to parse requirements from %s, error: %s', collection, e)
+ logger.error('failed to parse requirements from %s, error: %s', collection, e)
+ sys.exit(1)
# removal of unwanted packages
sanitized = [] |
Fixes: ansible#364 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Fixes: ansible#364 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Fixes: ansible#364 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
If you reference a requirements.txt for python modules but it has invalid syntax
ansible-builder build
will make the image but the python modules will not be installed. Even when running-v 3
you wont see any errors with the build process. After some time of digging I found the introspect command in theContainerfile
and running this likeansible-builder introspect --sanitize --user-pip=requirements.txt --user-bindep=bindep.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt
finally revealed my syntax error:In my case I did
module=version
instead ofmodule==version
but this lead to a great deal of frustration trying to figure out why my modules did not exist in the container. I realize that this particular issue was user induced is on my end, but it led me to wish for a mechanism that would allow me to see when there are warnings or errors like these instead of an incomplete container build.The text was updated successfully, but these errors were encountered: