codecov-python
codecov-python copied to clipboard
Crash in local CircleCI 2 run
The codecov
Python client crashes in a local CircleCI run (using the CircleCI 2 CLI), since not all of the environment variables it expects to be available are (even if the build is technically a CircleCI run).
This is admittedly a bit of a fringe use case, but it makes testing CircleCI flows locally harder.
====>> ~/.local/bin/codecov
#!/bin/bash -eo pipefail
~/.local/bin/codecov
==> Detecting CI provider
Traceback (most recent call last):
File "/home/circleci/.local/bin/codecov", line 11, in <module>
sys.exit(main())
File "/home/circleci/.local/lib/python3.6/site-packages/codecov/__init__.py", line 354, in main
slug=os.getenv('CIRCLE_PROJECT_USERNAME') + "/" + os.getenv('CIRCLE_PROJECT_REPONAME'),
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
Error: Exited with code 1
Printenv output, to make fixing this easier:
_=/usr/bin/printenv
BASH_ENV=/tmp/.bash_env-localbuild-1537512065
CI=true
CIRCLE_BRANCH=master
CIRCLE_BUILD_NUM=
CIRCLE_INTERNAL_CONFIG=/.circleci-runner-config.json
CIRCLE_INTERNAL_SCRATCH=/tmp/circleci-489557082
CIRCLE_INTERNAL_TASK_DATA=/.circleci-task-data
CIRCLE_JOB=build
CIRCLE_NODE_INDEX=0
CIRCLE_NODE_TOTAL=1
[email protected]:valohai/art.git
CIRCLE_SHA1=9d500adc3b5d9302717760d7973b6bb1f9093ff3
CIRCLE_SHELL_ENV=/tmp/.bash_env-localbuild-1537512065
CIRCLE_WORKING_DIRECTORY=~/project
CIRCLECI=true
DEBIAN_FRONTEND=noninteractive
GPG_KEY=0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
HOME=/home/circleci
HOSTNAME=82bb4e60c240
LANG=C.UTF-8
PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/home/circleci/project
PYTHON_PIP_VERSION=18.0
PYTHON_VERSION=3.6.6
SHLVL=1
SSH_AUTH_SOCK=/tmp/circleci-489557082/ssh_auth_sock
I am seeing the same issue when executing circle ci locally.
Traceback (most recent call last):
File "/home/circleci/repo/venv/bin/codecov", line 11, in <module>
sys.exit(main())
File "/home/circleci/repo/venv/lib/python3.7/site-packages/codecov/__init__.py", line 354, in main
slug=os.getenv('CIRCLE_PROJECT_USERNAME') + "/" + os.getenv('CIRCLE_PROJECT_REPONAME'),
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
Here is my relevant circle config:
environment:
CODECOV_TOKEN: 18a8804c-xxxx...
...
- run:
name: upload coverage report
command: |
. venv/bin/activate
pip install codecov
codecov -t "$CODECOV_TOKEN"
Running it locally using circleci local execute
It runs fine on circleci
I am experiencing the same issue running it locally. I tried to pass in the env variable CIRCLE_PROJECT_REPONAME
and able to reproduce the same error.
==> Detecting CI provider
Traceback (most recent call last):
File "/home/circleci/repo/venv/bin/codecov", line 8, in <module>
sys.exit(main())
File "/home/circleci/repo/venv/lib/python3.7/site-packages/codecov/__init__.py", line 405, in main
"/" + os.getenv('CIRCLE_PROJECT_REPONAME'),
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'