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

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

Closed
abravalheri opened this issue Jun 2, 2021 · 1 comment

Comments

@abravalheri
Copy link
Contributor

@abravalheri abravalheri commented Jun 2, 2021

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?
abravalheri added a commit to abravalheri/coveralls-python that referenced this issue Jun 3, 2021
The official docs for Coveralls define a set of generic environment
variables that once defined should support any CI environment:

https://docs.coveralls.io/supported-ci-services (bottom of the page).

The changes implemented in this PR attempt to read those variables
but allows the values to be overwritten by any CI-specific configuration
currently supported. They were also inspired by the official client
(coveralls-ruby - lib/coveralls/configuration.rb -
set_standard_service_params_for_generic_ci).
@abravalheri abravalheri changed the title Environment variables as defined in Coveralls official dogs seem to not be checked Environment variables as defined in Coveralls official docs seem to not be checked Jun 3, 2021
abravalheri added a commit to abravalheri/coveralls-python that referenced this issue Jun 14, 2021
The official docs for Coveralls define a set of generic environment
variables that once defined should support any CI environment:

https://docs.coveralls.io/supported-ci-services (bottom of the page).

The changes implemented in this PR attempt to read those variables
but allows the values to be overwritten by any CI-specific configuration
currently supported. They were also inspired by the official client
(coveralls-ruby - lib/coveralls/configuration.rb -
set_standard_service_params_for_generic_ci).
abravalheri added a commit to abravalheri/coveralls-python that referenced this issue Jul 20, 2021
The official docs for Coveralls define a set of generic environment
variables that once defined should support any CI environment:

https://docs.coveralls.io/supported-ci-services (bottom of the page).

The changes implemented in this PR attempt to read those variables
but allows the values to be overwritten by any CI-specific configuration
currently supported. They were also inspired by the official client
(coveralls-ruby - lib/coveralls/configuration.rb -
set_standard_service_params_for_generic_ci).
TheKevJames pushed a commit that referenced this issue Jul 20, 2021
…300)

The official docs for Coveralls define a set of generic environment
variables that once defined should support any CI environment:

https://docs.coveralls.io/supported-ci-services (bottom of the page).

The changes implemented in this PR attempt to read those variables
but allows the values to be overwritten by any CI-specific configuration
currently supported. They were also inspired by the official client
(coveralls-ruby - lib/coveralls/configuration.rb -
set_standard_service_params_for_generic_ci).
@TheKevJames
Copy link
Owner

@TheKevJames TheKevJames commented Jul 20, 2021

Thanks for the PR!

Loading

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

Successfully merging a pull request may close this issue.

None yet
2 participants