Skip to content

Environment variables as defined in Coveralls official docs seem to not be checked #299

@abravalheri

Description

@abravalheri

Hello, first of all, thank you very much for the package, it really helps a lot.

After the changes in the policy of TravisCI for opensource projects, I have been trying to move all the open source projects I participate to CirrusCI, since it have good, "unlimited", support for opensource.

In general using coveralls works perfectly, not many changes required. There is one thing, though, that seems very difficult to understand, and it is caused by the following factors:

  • I need to specify COVERALLS_REPO_TOKEN, otherwise the error Not on TravisCI. You have to provide either repo_token in .coveralls.yml or set the COVERALLS_REPO_TOKEN env var. happens.
  • When adding the token, coveralls docs seem to recommend keeping the token secret.
  • This works fine for owners and maintainers of the repository, however PR from regular contributors cannot access secrets, and therefore coveralls fails to run... The sad part is that having statics about how much PRs impact on the coverage is very handy...

When searching for a solution, I could find on coveralls docs, that any CI (not only travis) could be supported if the following environment variables are available:

CI_NAME
CI_BUILD_NUMBER
CI_BUILD_URL
CI_BRANCH
CI_PULL_REQUEST (optional)

However it does not seem to solve the problem, as you can see in the following example (pyscaffold/pyscaffold#450):

# Coveralls config
COVERALLS_SERVICE_NAME: cirrus-ci
COVERALLS_SERVICE_JOB_NUMBER: ${CIRRUS_BUILD_ID}
CI_NAME: cirrus-ci
CI_BUILD_NUMBER: ${CIRRUS_BUILD_ID}
CI_BUILD_URL: https://cirrus-ci.com/build/${CIRRUS_BUILD_ID}
CI_JOB_ID: ${CIRRUS_TASK_ID}
CI_BRANCH: ${CIRRUS_BRANCH}
CI_PULL_REQUEST: ${CIRRUS_PR}

Relevant output of coveralls debug:

{ ...
"git": {
  "branch": "issue-449",
  "head": {
    "id": "cbd286fa33a38d00ce8a53d13053ca8b50b7445e",
    "author_name": "Anderson Bravalheri",
    "author_email": "...",
    "committer_name": "Anderson Bravalheri",
    "committer_email": "...",
    "message": "Add debug instructions to coveralls"
  },
  "remotes": [{"name": "origin", "url": "https://x-access-token:@github.com/pyscaffold/pyscaffold.git"}]},
  "service_name": "cirrus-ci",
  "service_number": "5002671179431936",
  "config_file": ".coveragerc",
  "base_dir": ""
}

So I was wondering:

  • Is there any good practice/workaround associated with the problem of the secret COVERALLS_REPO_TOKEN that still allows submitting PR coverages by regular contributors?
  • Is the Python coveralls CLI actually reading the environment variables as documented at the bottom of the official docs page?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions