Skip to content
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

[BUG] A files input with a trailing comma causes a traceback #89

Open
webknjaz opened this issue Sep 15, 2024 · 2 comments
Open

[BUG] A files input with a trailing comma causes a traceback #89

webknjaz opened this issue Sep 15, 2024 · 2 comments

Comments

@webknjaz
Copy link

Here's a concrete log: https://github.com/ansible/awx/actions/runs/10871115353/job/30164548007?pr=15527#step:6:53. This is the stack:

info - 2024-09-15 12:46:44,626 -- Found 2 test_results files to report
info - 2024-09-15 12:46:44,626 -- > /home/runner/.ansible/collections/ansible_collections/awx/awx/tests/output/junit/ansible-test-sanity-action-plugin-docs.xml
info - 2024-09-15 12:46:44,626 -- > .
Traceback (most recent call last):
  File "codecov_cli/main.py", line 85, in <module>
  File "codecov_cli/main.py", line 81, in run
  File "click/core.py", line 1157, in __call__
  File "click/core.py", line 1078, in main
  File "click/core.py", line 1688, in invoke
  File "click/core.py", line 1434, in invoke
  File "click/core.py", line 783, in invoke
  File "click/decorators.py", line 33, in new_func
  File "codecov_cli/commands/upload.py", line 259, in do_upload
  File "codecov_cli/services/upload/__init__.py", line 112, in do_upload_logic
  File "codecov_cli/services/upload/upload_sender.py", line 69, in send_upload_data
  File "codecov_cli/services/upload/upload_sender.py", line 114, in _generate_payload
  File "codecov_cli/services/upload/upload_sender.py", line 149, in _get_files
  File "codecov_cli/services/upload/upload_sender.py", line 149, in <listcomp>
  File "codecov_cli/services/upload/upload_sender.py", line 152, in _format_file
  File "codecov_cli/services/upload/upload_sender.py", line 163, in _get_format_info
  File "codecov_cli/types.py", line 14, in get_content
IsADirectoryError: [Errno 21] Is a directory: '.'
[PYI-3185:ERROR] Failed to execute script 'main' due to unhandled exception!
Error: Codecov: 
                        Failed to properly upload report: The process '/home/runner/work/_actions/codecov/test-results-action/v1/dist/codecov' failed with exit code 1

This is the input:

files: /home/runner/.ansible/collections/ansible_collections/awx/awx/tests/output/junit/ansible-test-sanity-action-plugin-docs.xml,

Obviously, this action parses the input as two file paths, the second one being an empty string which automagically notmalizes into a . which is a directory. This problem does not exist in codecov/codecov-action so the input processing probably doesn't reuse the same code.

Solution

I think that empty files should either be disregarded or output an actionable error instead of a traceback. I'd vote for disregarding since it's easier on tools that generate value for this input.

@webknjaz
Copy link
Author

It seems to me that codecov-cli is called with -f '', though it's not logged there, so I assume there might also be a bug related to printing the invoked commands too.

@webknjaz
Copy link
Author

It seems to me that codecov-cli is called with -f '', though it's not logged there, so I assume there might also be a bug related to printing the invoked commands too.

Ah, it's visible here but '' isn't rendered: https://github.com/ansible/awx/actions/runs/10874452328/job/30171744063?pr=15527#step:6:30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant