Closed kentcdodds closed 9 years ago
77.65%
Merging #17 into master will change coverage by +1.70% by
3f5ffe3
@@ master #17 diff @@
======================================
Files 14 15 +1
Stmts 79 85 +6
Branches 32 34 +2
Methods 23 25 +2
======================================
+ Hit 60 66 +6
Partial 1 1
Missed 18 18
Powered by Codecov
Just forced pushed an update because I forgot to add this to getConfiguration
(and it broke my build)
Thanks @kentcdodds. Does SnapCI work with open source too? If they have an builds endpoint I can update our server to not require the token for public repos.
I hooked them up using GitHub on my open source project, so yeah, they do.
Can you send me a link to their api endpoint to get builds/jobs. Thanks!
Updated the PR to use the SNAP_COMMIT
environment variable. I've asked someone from snap to help with the api endpoint. Thanks!
Hey guys, dev from snap-ci here. You can get the latest build using -
GET /project/:owner/:repository/branch/:branch_name/pipelines/{latest,newest}
you can find more info and examples in our docs. Right now all our API endpoints require authentication including the public builds. You can supply the username and api token in the url for now. We will look into the possibility of removing the authentication for public builds soon. Let me know if you have any problems integrating.
@akshaykarle thank you for the reply! Does a single uses api key work for all public repos? I ask because I'd like to hookup snap-ci into Codecov backend so that customers will no longer need repo tokens making the installation more seamless. I can use "my personal" access token to request public repos if necessary until you remove the requirement. Thanks!
@stevepeak unfortunately no. You can use the API token only to access the builds that you collaborate on. So you may have to ask users to enter their API token and username. Can they supply this as arguments to codecov.io?
@akshaykarle unfortunately it wont work in that case. Until snap-ci can allow access to public builds with no token customers will need to provide the repo token.
Is there a way to get notified if this changes in the future?
@stevepeak, any way I can be notified when I can start using snap-ci to report coverage even with a work-around?
I'll publish this to npm now. Thanks!
It's definitely published and the library works, but codecov throws up when I try to make the request: https://snap-ci.com/kentcdodds/ng-stats/branch/master/logs/defaultPipeline/16/Coverage?back_to=build_history
$ cat ./coverage/lcov.info | codecov
configuration: { service: 'snapci',
build: '16',
commit: '6a60680fac80b5cf2c491e9a6bba42b20f81e14a',
branch: 'master',
pull_request: undefined,
token: '********',
package: 'node' }
error sending to codecov.io: { [Error: non-success response]
detail:
{ statusCode: 400,
body: '{"message": "Invalid value \'snapci\' (str): must be ci-provider (at service)", "uploaded": false, "meta": {"status": 400, "request": "2476771e-db9a-4f9d-a395-4d1704ece149"}}',
request:
{ url: 'https://codecov.io/upload/v2?service=snapci&build=16&commit=6a60680fac80b5cf2c491e9a6bba42b20f81e14a&branch=master&pull_request=&token=********&package=node',
body: 'TN:\nSF:/var/snap-ci/repo/src/index.js\nFN:8,_interopRequireDefault\nFN:28,(anonymous_2)\nFN:30,(anonymous_3)\nFN:49,hijackDigest\nFN:56,$digest\nFN:65,isChromeApp\nFN:75,autoload\nFN:80,(anonymous_8)\nFN:86,showAngularStats\nFN:169,(anonymous_10)\nFN:173,(anonymous_11)\nFN:183,track\nFN:187,(anonymou ........................ etc...
Fixed the issue with snapci
, I should have caught this before, sorry for that: d61345c9bff7204a969d6352e0bc8c986589f681 (published version that fixes it)
Verified. Thanks!
Well... It worked on one project and failed on another. Any ideas?
Was the token included on the failed build? That is odd indeed. Perhaps you can transition to the bash uploader.
- cat ./coverage/lcov.info | ./node_modules/.bin/codecov
+ bash <(curl -s https://codecov.io/bash) -f ./coverage/lcov.info
Well I feel dumb... I didn't have the token :-( 100% coverage :-) https://codecov.io/github/kentcdodds/api-check
Hey no problem! It happens to the best of us. Nice job with 100% coverage!
heh, really helps when you have a githook that doesn't allow you to commit anything less than 100% code coverage :-) https://github.com/kentcdodds/api-check/blob/master/package.json#L46
-Kent C. Dodds
On Mon, Jun 22, 2015 at 11:56 AM, Steve Peak notifications@github.com wrote:
Hey no problem! It happens to the best of us. Nice job with 100% coverage!
— Reply to this email directly or view it on GitHub https://github.com/cainus/codecov.io/pull/17#issuecomment-114199197.
I'm going to patch the server to chop off the var/snap-ci/repo
automatically. So the files line up correctly.
Perfect. Thanks!
-Kent C. Dodds
On Mon, Jun 22, 2015 at 11:57 AM, Steve Peak notifications@github.com wrote:
I'm going to patch the server to chop off the var/snap-ci/repo automatically. So the files line up correctly.
— Reply to this email directly or view it on GitHub https://github.com/cainus/codecov.io/pull/17#issuecomment-114199532.
@stevepeak I've already spoken to our product owner about using the API without auth for public builds and we've put the feature in our backlog. We don't have a public listing of the backlog yet, but you can usually keep track of what is new on snap from our docs, blogs and what's new. I can get back to you once this is available so that we can make the codecov experience better.
@akshaykarle thank you for doing this! I look forward to this change of API. Cheers!
@akshaykarle, looks like there is no SNAP_BRANCH
environment variable available for pull request builds :-( This breaks codecov... Here's some useful output from my private build:
All of the environment variables available from snap
$ export SNAP_CI=true
$ export CI=true
$ export SNAP_CACHE_DIR=/var/go
$ export LANG=en_US.UTF-8
$ export LC_ALL=en_US.UTF-8
$ export SNAP_WORKING_DIR=/var/snap-ci/repo
$ export SNAP_PIPELINE_COUNTER=1
$ export SNAP_STAGE_NAME=Test
$ export SNAP_PULL_REQUEST_NUMBER=1
$ export SNAP_UPSTREAM_BRANCH=master
$ export SNAP_COMMIT=fb4aec4b75e8c8efe732ae421b0f4e2a06b7214d
$ export SNAP_COMMIT_SHORT=fb4aec4
$ export SNAP_TRACKING_PIPELINE=true
$ export SNAP_INTEGRATION_PIPELINE=false
The attempt to send coverage stats to codecov:
configuration: { service: 'snap',
build: '1',
commit: 'fb4aec4b75e8c8efe732ae421b0f4e2a06b7214d',
branch: undefined,
pull_request: '1',
token: '********',
package: 'node' }
error sending to codecov.io: { [Error: non-success response]
detail:
{ statusCode: 400,
body: '{"uploaded": false, "meta": {"status": 400, "request": "1b1d451e-055a-46f5-9e06-698feb2ac8a8"}, "message": "Invalid value {\'package\': \'node\', \'build\': \'1\', \'pull_request\': \'1\', \'service\': \'snap\', \'commit\': \'fb4aec4b75e8c8efe732ae421b0f4e2a06b7214d\', \'token\': \'********\'} (dict): missing required properties: [\'branch\']"}',
request:
{ url: 'https://codecov.io/upload/v2?service=snap&build=1&commit=fb4aec4b75e8c8efe732ae421b0f4e2a06b7214d&branch=&pull_request=1&token=********&package=node',
body: 'TN:\nSF:/var/snap-ci/repo/app/index.common.js\nFNF:0\
... etc
So it's missing branch
because SNAP_BRANCH
is not available in the PR build... Why is that? Is it a bug? Can it be fixed? Are we going to have to figure out the branch ourselves via git?
Uh oh... Using snap-shell
if I execute $ git rev-parse --abbrev-ref HEAD
I get: master
even on the PR build... If I execute $ git branch
, I get:
* master
pull-1
This tells me that snap-ci has no concept of pull request branches... What do you think a timeline would be to make it possible for me to send what branch this PR is for to codecov @akshaykarle? This basically makes codecov not work with PRs when building with snap. A real downer :-(
@stevepeak, what does snap need to do for this?
@kentcdodds @stevepeak I've just sent PR #18 to resolve the issue with pull request builds.
We don't set the $SNAP_COMMIT
environment variable purposely because for pull request builds your build is really running on an unmerged upstream branch from the pull request changes. The absence of $SNAP_COMMIT environment variable is also used to identify that it is a pull request build. The branch you are integrating with is identified in the build using the $SNAP_UPSTREAM_COMMIT
environment variable hence I decided to use that if the SNAP_COMMIT environment variable was not preset.
Closes #16
I couldn't find a way to get
owner
orrepo
from snap's environment variables :-(