Comments (8)
@jaredj can you try to use the following params in your pipeline and check if you achieve the expected result?
scmVars: [GIT_URL: fullBranchUrl(env.BRANCH_NAME)]])
- for MasterCoverageAction
scmVars: [GIT_URL: fullBranchUrl(env.CHANGE_TARGET)]])
- for CompareCoverageAction
def fullBranchUrl(branchName) { return "${scm.getUserRemoteConfigs()[0].getUrl()}/tree/$branchName" }
from github-pr-coverage-status-plugin.
I think that smt what we can do, do you know how to get base branch info from github pr?
from github-pr-coverage-status-plugin.
@terma I don't know offhand but I can research it next week. if I have the time and can get with the program maybe I can make a PR too but no promises :)
from github-pr-coverage-status-plugin.
@jaredj, thx, any info about that will be appreciated.
from github-pr-coverage-status-plugin.
the base branch can be retrieved with the github API:
https://developer.github.com/v3/pulls/#get-a-single-pull-request
in the bit of example response they give the base branch happens to be master
:
"base": {
"label": "master",
"ref": "master",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
I think ref
is what we want.
I'm not sure I'm reading it right but it seems like you're using GHPullRequest.java from the github java API in which case it's maybe as simple as just doing something like:
pr.getHead().getRef()
from github-pr-coverage-status-plugin.
@dmotpan, works as expected.
Result:
Pipeline:
def fullBranchUrl(branchName) { return "${scm.getUserRemoteConfigs()[0].getUrl()}/tree/$branchName" }
pipeline {
agent none
stages {
stage('Code Coverage') {
agent {node 'nodejs'}
steps {
sh 'npm run coverage'
}
post {
success {
script {
// commit: record code coverage
if (env.CHANGE_ID == null) {
currentBuild.result = 'SUCCESS'
step([$class: 'MasterCoverageAction', scmVars: [GIT_URL: fullBranchUrl(env.BRANCH_NAME)]])
}
// pull request: compare code coverage
else if (env.CHANGE_ID != null) {
currentBuild.result = 'SUCCESS'
step([$class: 'CompareCoverageAction', publishResultAs: 'statusCheck', scmVars: [GIT_URL: fullBranchUrl(env.CHANGE_TARGET)]])
}
}
}
cleanup {
cleanWs()
}
}
}
}
}
from github-pr-coverage-status-plugin.
Yes, it works for me too! Sorry for the late reply.
Note that (not a big deal) it still calls the comparison branch "master" in the status check even though it's not
from github-pr-coverage-status-plugin.
Hi @terma
Thanks for your support,
How about the progress of this issue?
from github-pr-coverage-status-plugin.
Related Issues (20)
- Please improve the documentation on usage of this plugin HOT 1
- Tokens and password stored in plaintext!
- WARNING: failed to uncoerce com.github.terma.jenkins.githubprcoveragestatus.CompareCoverageAction@47dba41 HOT 2
- Remove jdk-tool implicit plugin dependency
- status check reporting success on coverage drop HOT 3
- Feature: Make commit status context configurable HOT 2
- MasterCoverageAction gets confused by node_modules/**/coverage.json HOT 3
- Add documentation for options including `publishResultAs`, `scmVars`, etc HOT 1
- Support Configuration as code plugin HOT 2
- Unknown parameter(s) found for class type 'com.github.terma.jenkins.githubprcoveragestatus.CompareCoverageAction': jacocoCounterType
- Same Coverage for Pull Request and Master Build HOT 1
- Feature: make configurable status check on coverage drop or add a kind of "tollerance" HOT 1
- Support rate_limit endpoint bypass
- Merge some fixes please HOT 1
- no public field ‘sonarLogin’ found in class com.github.terma.jenkins.githubprcoveragestatus.CompareCoverageAction
- Fail build if coverage not good enough
- GitHub Personal Access token getting invalidated HOT 14
- Coverage is not collecting from my branch
- Plugin incompatibility with newer Sonar versions HOT 3
- java.io.IOException: Error while accessing rate limit API HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from github-pr-coverage-status-plugin.