jenkinsci / jenkinsci/github-pr-coverage-status-plugin
Injecting GIT_URL and CHANGE_URL
- Dominant language
- Java
- Stars
- 97
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
Trying to make use of the hint you gave in README, I am still getting an error:
```
java.lang.UnsupportedOperationException: Can't find GIT_URL or CHANGE_URL in envs: {BRANCH_NAME=master, BUILD_DISPLAY_NAME=#31, BUILD_ID=31, BUILD_NUMBER=31, BUILD_TAG=jenkins-testci-master-31, BUILD_URL=https://jnkns-ci.tmh.cloud/job/testci/job/master/31/, CLASSPATH=, HUDSON_HOME=/var/jenkins_home, HUDSON_SERVER_COOKIE=01f6aedeea333d1f, HUDSON_URL=https://jnkns-ci.tmh.cloud/, JENKINS_HOME=/var/jenkins_home, JENKINS_SERVER_COOKIE=01f6aedeea333d1f, JENKINS_URL=https://jnkns-ci.tmh.cloud/, JOB_BASE_NAME=master, JOB_DISPLAY_URL=https://jnkns-ci.tmh.cloud/job/testci/job/master/display/redirect, JOB_NAME=testci/master, JOB_URL=https://jnkns-ci.tmh.cloud/job/testci/job/master/, RUN_CHANGES_DISPLAY_URL=https://jnkns-ci.tmh.cloud/job/testci/job/master/31/display/redirect?page=changes, RUN_DISPLAY_URL=https://jnkns-ci.tmh.cloud/job/testci/job/master/31/display/redirect}
at com.github.terma.jenkins.githubprcoveragestatus.PrIdAndUrlUtils.getGitUrl(PrIdAndUrlUtils.java:85)
at com.github.terma.jenkins.githubprcoveragestatus.MasterCoverageAction.perform(MasterCoverageAction.java:71)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
at hudson.security.ACL.impersonate(ACL.java:260)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
```
This is my pipeline:
```
pipeline {
agent any
options {
skipDefaultCheckout()
}
environment {
// calling credentials() actually sets 3 environment variables
// GIT_HUB with :
// GIT_HUB_USER with
// GIT_HUB_PSW with
GIT_HUB = credentials('xxxx')
DOCKER_REPO = 'mobilityhouse'
DOCKER_HUB = credentials('xxxx')
CHANGE_URL = "https://$GIT_HUB@github.com/mobilityhouse/testci.git"
}
stages{
stage('Checkout') {
steps {
script {
checkout scm
result = sh (script: "git log -1 | grep '.*\\[ci skip\\].*\\|.*\\[skip ci\\].*'", returnStatus: true)
if (result == 0) {
currentBuild.result = 'NOT_BUILT'
error("SKIPPING BUILD ...")
}
}
}
}
// slaves are built on top of Debian ... or at least I thought so ...
stage('Prepare Environment') {
steps {
sh 'pip3 install -r requirements_dev.txt'
script {
currentBuild.result = 'SUCCESS'
}
}
}
/* currently it's not possible to run the tests in a docker
and get the xml results ...*/
stage('Coverage & Tests') {
steps {
sh 'pip3 install -e .'
sh 'make coverage-xml'
script {
currentBuild.result = 'SUCCESS'
// sh(script: 'export GIT_URL="https://$GIT_HUB@github.com/mobilityhouse/testci.git"')
env.CHANGE_URL = "https://$GIT_HUB@github.com/mobilityhouse/testci.git"
}
}
}
/* stage('Test') {
steps {
echo 'hl'
}
post {
success {
echo 'This works!'
}
}
}
stage('Fail') {
steps {
sh 'ls -l /jkk'
}
post {
success {
echo 'does will never work'
}
failure {
echo 'sigh!'
}
}
} */
}
post {
success {
step([$class: 'MasterCoverageAction'])
step([$class: 'CompareCoverageAction'])
}
}
}
```
Can you explain how to inject the variables?
Contributor guide
Assessment
This issue has not been assessed yet.