Build remote multibranch pipeline in Jenkins - jenkins

I would like to use the parameterized remote trigger plugin to run the remote project(all branches) and monitor only one of the branches for the status.
node(''){
triggerRemoteJob abortTriggeredJob: true, auth: CredentialsAuth(credentials: 'E2E'), job: 'http://localhost:8080/job/test-projectF', maxConn: 5, useCrumbCache: true, useJobInfoCache: true
}
This is my code to trigger the remote project. But I end up with an exception
[Pipeline] {
[Pipeline] triggerRemoteJob################################################################################################################
Parameterized Remote Trigger Configuration:
- job: http://localhost:8080/job/test-projectF
- auth: 'Credentials Authentication' as user 'admin' (Credentials ID 'E2E')
- parameters:
- blockBuildUntilComplete: true
- connectionRetryLimit: 5
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
hudson.remoting.ProxyException: net.sf.json.JSONException: JSONObject["property"] is not a JSONArray.
at net.sf.json.JSONObject.getJSONArray(JSONObject.java:1986)
at org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration.isRemoteJobParameterized(RemoteBuildConfiguration.java:1086)
at org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration.performTriggerAndGetQueueId(RemoteBuildConfiguration.java:637)
at org.jenkinsci.plugins.ParameterizedRemoteTrigger.pipeline.RemoteBuildPipelineStep$Execution.run(RemoteBuildPipelineStep.java:263)
at org.jenkinsci.plugins.ParameterizedRemoteTrigger.pipeline.RemoteBuildPipelineStep$Execution.run(RemoteBuildPipelineStep.java:239)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48)
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
However, same command with a branch name ends in SUCCESS. http://localhost:8080/job/test-projectF/job/master
What is the better way to build the dynamically created branch on the remote Jenkins and track the status?

Related

How to get the payload information from jfrog webhook trigger on jenkins

I'm setting up a jenkins job which will be triggered whenever a artifact is deployed in jfrog. I have followed the steps present in the below documentation and i was able to trigger the job.But unfortunately, I'm not able to get the variables values.I'm not sure how to see the payload which we are receiving on the jenkins side to pull the required variables.
https://www.eficode.com/blog/triggering-jenkins-pipelines-on-artifactory-events
My pipeline:
pipeline {
agent any
triggers {
GenericTrigger(
genericVariables: [
[key: 'ARTIFACT_NAME', value: '$.artifactory.webhook.data.name'],
[event: 'EVENT_NAME', value: '$.artifactory.webhook.event']
],
causeString: 'Triggered on $ARTIFACT_NAME'
)
}
stages {
stage('Hello') {
steps {
echo 'Hello World'
}
}
}
}
Jenkins job logs:
java.lang.NullPointerException: Variable name
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)
at org.jenkinsci.plugins.gwt.GenericVariable.<init>(GenericVariable.java:31)
Caused: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedConstructorAccessor6020.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:330)
Caused: java.lang.IllegalArgumentException: Could not instantiate {event=EVENT_NAME, value=$.artifactory.webhook.event} for org.jenkinsci.plugins.gwt.GenericVariable
at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:334)
at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:474)
at org.jenkinsci.plugins.structs.describable.DescribableModel.coerceList(DescribableModel.java:585)
at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:458)
at org.jenkinsci.plugins.structs.describable.DescribableModel.buildArguments(DescribableModel.java:409)
at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:329)
at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:272)
at org.jenkinsci.plugins.pipeline.modeldefinition.CommonUtils.instantiateDescribable(CommonUtils.java:131)
at org.jenkinsci.plugins.pipeline.modeldefinition.CommonUtils$instantiateDescribable.callStatic(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
at org.kohsuke.groovy.sandbox.impl.Checker$2.call(Checker.java:194)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onStaticCall(GroovyInterceptor.java:35)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onStaticCall(SandboxInterceptor.java:186)
at org.kohsuke.groovy.sandbox.impl.Checker$2.call(Checker.java:192)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedStaticCall(Checker.java:196)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:103)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
Caused: java.lang.IllegalArgumentException: Could not instantiate {genericVariables=[{key=ARTIFACT_NAME, value=$.artifactory.webhook.data.name}, {event=EVENT_NAME, value=$.artifactory.webhook.event}], causeString=Triggered on $ARTIFACT_NAME} for org.jenkinsci.plugins.gwt.GenericTrigger
I have made it. We have to enable print post contents in configure jenkins job under generic webhook trigger option. Once done it started to display json payload in console log. After that we can add variables using jsonpath filter from payload
I'd like to suggest a different approach using the Jenkins Artifactory plugin:
You can configure a build trigger in the UI:
Or you can configure the build trigger in the pipeline:
stages {
stage('Artifactory configuration') {
steps {
rtServer(
id: "ARTIFACTORY_SERVER",
url: SERVER_URL,
credentialsId: CREDENTIALS
)
}
}
stage('Add build trigger') {
steps {
rtBuildTrigger(
serverId: "ARTIFACTORY_SERVER",
spec: "*/10 * * * *",
paths: "generic-libs-local/builds/starship"
)
}
}
}
To get the path in Artifactory that caused the trigger you can do the following:
environment {
// The URL of the artifact in Artifactory, caused the job to be triggered.
// May be empty if the build isn't triggered by a change in Artifactory.
RT_TRIGGER_URL = "${currentBuild.getBuildCauses('org.jfrog.hudson.trigger.ArtifactoryCause')[0]?.url}"
}
Resources:
Triggering builds
Triggering Builds in Declarative pipeline
Example

docker push to artifactory gives error : "Target host is not specified "

I am trying to push docker image to artifactory using jenkins declarative pipeline. Below is my code-
stage('Push Image to Artifactory') {
steps {
script{
def buildInfo = Artifactory.newBuildInfo()
def server = Artifactory.newServer url: 'artifactory.org', credentialsId: 'artifactsId'
def rtDocker = Artifactory.docker server: server
def tagDockerApp = "artifactory.org/docker-repository/venus:1.0.3"
docker.build(tagDockerApp)
buildInfo = rtDocker.push(tagDockerApp,'docker-repository',buildInfo)
// Publish build info.
buildInfo.env.capture = true
buildInfo.env.collect()
server.publishBuildInfo buildInfo
}
}
}
I am getting below error after rtDocker.push command :
org.apache.http.ProtocolException: Target host is not specified
at org.apache.http.impl.conn.DefaultRoutePlanner.determineRoute(DefaultRoutePlanner.java:71)
at org.apache.http.impl.client.InternalHttpClient.determineRoute(InternalHttpClient.java:125)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
Caused: org.apache.http.client.ClientProtocolException
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.jfrog.build.client.PreemptiveHttpClient.execute(PreemptiveHttpClient.java:102)
at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryDependenciesClient.execute(ArtifactoryDependenciesClient.java:200)
at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryDependenciesClient.downloadArtifact(ArtifactoryDependenciesClient.java:170)
at org.jfrog.hudson.pipeline.docker.DockerImage.findAndSetManifestFromArtifactory(DockerImage.java:162)
at org.jfrog.hudson.pipeline.docker.DockerImage.generateBuildInfoModule(DockerImage.java:146)
at org.jfrog.hudson.pipeline.steps.DockerPushStep$Execution.run(DockerPushStep.java:135)
at org.jfrog.hudson.pipeline.steps.DockerPushStep$Execution.run(DockerPushStep.java:86)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:367)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
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)
Although i can see the image pushed on to the artifactory , but due to the exception i am not able publish build info and execute other stages
Try providing a full url including protocol (http/https) such as https://artifactory.org in line:
def server = Artifactory.newServer url: 'artifactory.org', credentialsId: 'artifactsId'

Jenkins pipeline not creating workspace folders when other pipelines are

I am creating a new Pipeline on an existing, functioning Jenkins server.
At the moment it is a simple multibranch pipeline with the Jenkinsfile, and a deploy.yml
The issue is that the workspace folder is not being generated.
When I do ls /var/lib/jenkins/workspace I get a list of all the other deploy jobs that have created workspaces, and a workspace.txt file where I can see the names of the workspaces that SHOULD have been created, but there is no folder for that workspace.
If I do mkdir /var/lib/jenkins/workspace/expectedname and touch /var/lib/jenkins/workspace/expectedname/deploy.yml and run it, it creates a workspace called /var/lib/jenkins/workspace/expectedname#tmp which is empty, and puts the retreived files in the one i created. If I delete the #tmp folder, it works. but it breaks again without advance notice, and it isn't feasible to keep having to create the fodler manually.
Jenkinsfile
#!groovy
node {
currentBuild.displayName = "${env.BRANCH_NAME}-${env.BUILD_NUMBER}"
config = readYaml file: "${WORKSPACE}/deploy.yml"
}
pipeline {
agent any
stages {
stage ('Fiddling'){
steps {
echo "***************** TAG: ${config.scm.tag} *****************"
}
}
}
}
deploy.yml
env:
wwwroot: "/var/www/siteroot"
type: "test"
ssh:
servername: "mysecretserver.url"
username: "jenkins"
conf:
siteTitle: "Site Title"
siteFQDN: "site.subdomain.domain.tld"
defaultFromEmail: "test#domain.tld"
sessionname: "SessionName"
mysql:
host: "localhost"
database: "mycooldb"
username: "dbuser"
password: "s3cret"
scm:
tag: "v.1.2"
jenkins log
15:28:41 Started by user JoSSte
15:28:41 > git rev-parse --is-inside-work-tree # timeout=10
15:28:41 Setting origin to git#bitbucket.org:t******/****.git
15:28:41 > git config remote.origin.url git#bitbucket.org:t******/****.git # timeout=10
15:28:41 Fetching origin...
15:28:41 Fetching upstream changes from origin
15:28:41 > git --version # timeout=10
15:28:41 > git --version # 'git version 2.17.1'
15:28:41 > git config --get remote.origin.url # timeout=10
15:28:41 using GIT_SSH to set credentials YYYYYY
15:28:41 > git fetch --tags --progress -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10
15:28:42 Seen branch in repository origin/master
15:28:42 Seen branch in repository origin/noscm
15:28:42 Seen branch in repository origin/stable
15:28:42 Seen branch in repository origin/working
15:28:42 Seen 4 remote branches
15:28:44 Obtained Jenkinsfile from 5374b39f33bf6ye904134e845d60fae76a97bb09
15:28:44 Running in Durability level: MAX_SURVIVABILITY
15:28:44 [Pipeline] Start of Pipeline
15:28:44 [Pipeline] node
15:28:44 Running on Jenkins in /var/lib/jenkins/workspace/tc-d-tr_noscm
15:28:44 [Pipeline] {
15:28:44 [Pipeline] readYaml
15:28:44 [Pipeline] }
15:28:44 [Pipeline] // node
15:28:44 [Pipeline] End of Pipeline
15:28:44 java.io.FileNotFoundException: /var/lib/jenkins/workspace/tc-d-tr_noscm/deploy.yml does not exist.
15:28:44 at org.jenkinsci.plugins.pipeline.utility.steps.conf.ReadYamlStep$Execution.doRun(ReadYamlStep.java:113)
15:28:44 at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepExecution.run(AbstractFileOrTextStepExecution.java:32)
15:28:44 at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
15:28:44 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
15:28:44 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
15:28:44 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
15:28:44 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
15:28:44 at java.lang.Thread.run(Thread.java:748)
15:28:44 Finished: FAILURE
Why is this job failing when all the others are not? - the only thing I can see different is that the other jobs I have don't use readYaml
Update
I made a new repo, with basically the same structure, without readYaml, on the same jenkins server - this hasn't failed in the same way - I will try to ad that to it, and see if it breaks...

Unable to push Docker image to Artifactory

I am running a Jenkins Pipeline and trying to upload a docker image but it is failing using the Artifactory command.
This is a snippet of my Jenkinsfile stage:
stage("Build docker image") {
steps {
container('docker') {
sh 'docker -v'
script {
def rtServer = Artifactory.server "artifactory"
def rtDocker = Artifactory.docker server: rtServer
docker.build("app", "--build-arg JAR_FILE=app.jar -f Dockerfile .")
def buildInfo = rtDocker.push '<companyname>.jfrog.io/app','docker-snapshot-local'
}
}
}
}
This fails after the docker.build with the following message:
[Pipeline] newBuildInfo
[Pipeline] dockerPushStep
expected to call org.jfrog.hudson.pipeline.common.types.Docker.push but wound up catching dockerPushStep; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/
[Pipeline] }
Jenkins EOF log:
Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from ip-XX-XX-XX-XX.ec2.internal/XX.XX.XX.XX:42790
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
at hudson.remoting.Channel.call(Channel.java:957)
at org.jfrog.hudson.pipeline.common.docker.utils.DockerAgentUtils.getImageIdFromAgent(DockerAgentUtils.java:291)
at org.jfrog.hudson.pipeline.common.executors.DockerExecutor.execute(DockerExecutor.java:59)
at org.jfrog.hudson.pipeline.scripted.steps.DockerPushStep$Execution.run(DockerPushStep.java:104)
at org.jfrog.hudson.pipeline.scripted.steps.DockerPushStep$Execution.run(DockerPushStep.java:71)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at ...io.netty.channel.epoll.AbstractEpollChannel.doConnect(AbstractEpollChannel.java:713)
at io.netty.channel.epoll.EpollDomainSocketChannel.doConnect(EpollDomainSocketChannel.java:87)
at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.connect(AbstractEpollChannel.java:555)
at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1366)
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:545)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:530)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.connect(CombinedChannelDuplexHandler.java:497)
at io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboundHandlerAdapter.java:47)
at io.netty.channel.CombinedChannelDuplexHandler.connect(CombinedChannelDuplexHandler.java:298)
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:545)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:530)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:512)
at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:1024)
at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:259)
at io.netty.bootstrap.Bootstrap$3.run(Bootstrap.java:252)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:335)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
The expected to call... is just a warning message and you can ignore it. This may disappear in the next version of workflow-cps-plugin. More information about it can be found here.
About the error - Try first to follow the instructions here HAP-1241.

Printing code coverage status on pull request for Bitbucket stash based repository using JenkinsFile

I currently have a private Bitbucket stash repository e.g. https://xyzgit.company.com/stash/scm/proj1/subproj2.
This is a gradle based project which uses JenkinsFile to manage different stages for Jenkins Job (including setup, build, publish etc). Whenever a new change is committed to a branch, it automatically triggers a build or provide an option to trigger a build. To analyse code coverage, we use Jcoco Plugin which analyzes all subfolders to get the coverage.
My current requirement is to print code coverage status on the pull request after the build is successful over jenkins using JenkinsFile.
I came across a plugin i.e. Bit Bucket Code Coverage Plugin but I did not find any such plugin available to be installed in my Jenkins Environment. I tried to do it manually but it redirects me to plugin available for Github.
I anyway installed that and tried what is suggested in the document i.e. adding these two lines in my Jenkins File :
step([$class: 'MasterCoverageAction', scmVars: [GIT_URL: "https://xyzgit.company.com/stash/scm/proj1/subproj2"]])
step([$class: 'CompareCoverageAction', scmVars: [GIT_URL: "https://xyzgit.company.com/stash/scm/proj1/subproj2"]])
It did not work. I got the following Error :
[GitHub PR Status] Attempt to discover PR for null # null
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // wrap
[Pipeline] }
[Pipeline] // wrap
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.io.FileNotFoundException: https://api.github.com/repos/stash/scm
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0
(HttpURLConnection.java:1872) at sun.net.www.protocol.http.
HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.
getResponseCode(HttpsURLConnectionImpl.java:338)
at org.kohsuke.github.Requester.parse(Requester.java:602)
Caused: java.io.FileNotFoundException:
https://api.github.com/repos/stash/scm
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.
newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.
newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at sun.net.www.protocol.http.HttpURLConnection$10.
run(HttpURLConnection.java:1926)
at sun.net.www.protocol.http.HttpURLConnection$10.
run(HttpURLConnection.java:1921)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.
getChainedException(HttpURLConnection.java:1920)
at sun.net.www.protocol.http.HttpURLConnection.
getInputStream0(HttpURLConnection.java:1490)
at sun.net.www.protocol.http.HttpURLConnection.
getInputStream(HttpURLConnection.java:1474)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.
getInputStream(HttpsURLConnectionImpl.java:254)
at org.kohsuke.github.Requester.parse(Requester.java:612)
at org.kohsuke.github.Requester.parse(Requester.java:594)
at org.kohsuke.github.Requester._to(Requester.java:272)
Caused: org.kohsuke.github.GHFileNotFoundException: {"message":"Not
Found","documentation_url":"https://developer.github.com/v3"}
at org.kohsuke.github.Requester.handleApiError(Requester.java:686)
at org.kohsuke.github.Requester._to(Requester.java:293)
at org.kohsuke.github.Requester.to(Requester.java:234)
at org.kohsuke.github.GitHub.getRepository(GitHub.java:443)
at com.github.terma.jenkins.githubprcoveragestatus.
GitHubPullRequestRepository.getGitHubRepository
(GitHubPullRequestRepository.java:57)
Caused: java.io.IOException: Could not retrieve GitHub repository named
stash/scm (Do you have properly set 'GitHub project' field in job
configuration?) at com.github.terma.jenkins.githubprcoveragestatus.
GitHubPullRequestRepository.getGitHubRepository
(GitHubPullRequestRepository.java:59) at
com.github.terma.jenkins.githubprcoveragestatus.
GitHubPullRequestRepository.getPullRequestFor
(GitHubPullRequestRepository.java:32)
at com.github.terma.jenkins.githubprcoveragestatus.
PrIdAndUrlUtils.getMultiBranch(PrIdAndUrlUtils.java:63)
at com.github.terma.jenkins.githubprcoveragestatus.
PrIdAndUrlUtils.getPrId(PrIdAndUrlUtils.java:72)
at com.github.terma.jenkins.githubprcoveragestatus.
CompareCoverageAction.perform(CompareCoverageAction.java:93)
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:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.
run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Finished: FAILURE
Can anybody help me if any additional setting is there? or How to inject env CHANGE_URL and CHANGE_ID in JenkinsFile ?
Take a look at Code Coverage Plugin for Bitbucket Server. In it's repo you could find maven-based client which supports JACOCO and could be easily called from gradle.

Resources