Skip to content

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

@webknjaz

Description

@webknjaz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions