pivotal / LicenseFinder

Find licenses for your project's dependencies.
MIT License
1.73k stars 340 forks source link

license_finder should exit non-zero on errors #930

Open DavidS-cloud opened 2 years ago

DavidS-cloud commented 2 years ago

Related to #910 , but more generally phrased: when license_finder is not able to successfully run its checks, it currently can exit with code zero, which would indicate to any CI system that it ran successfully, when in actuality it didn't even start checking. For example, this has been going on for a while in our CI system:

root@f7e766e48f2b:/src# /usr/local/bundle/bin/license_finder version
7.0.1
root@f7e766e48f2b:/src# /usr/local/bundle/bin/license_finder action_items --prepare --enabled-package-managers=pip
LicenseFinder::Pip: is active
pip3 install: did not succeed.
pip3 install: LicenseFinder command 'python3 /usr/local/bundle/gems/license_finder-7.0.1/bin/license_finder_pip.py /src/requirements_dev.txt' failed:
    Traceback (most recent call last):
  File "/usr/local/bundle/gems/license_finder-7.0.1/bin/license_finder_pip.py", line 42, in <module>
    packages = [transform(dist) for dist in pkg_resources.working_set.resolve(reqs)]
  File "/usr/local/lib/python3.9/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pip._vendor.pkg_resources.DistributionNotFound: The 'ruamel-yaml-clib==0.2.6' distribution was not found and is required by the application

No dependencies recognized!
root@f7e766e48f2b:/src# echo $?
0
root@f7e766e48f2b:/src# 

It would be great if license_finder did report such setup errors also by setting its exit code non-zero.

cf-gitbot commented 2 years ago

We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story.

The labels on this github issue will be updated when the story is started.

createchange commented 1 year ago

This is impacting me on Gitlab pipelines using their native tooling. My CI jobs are showing as succeeding, but are most definitely not. It subsequently outputs an artifact that contains no entries.