After updating to the latest version of the Gitlab plugin (1.4.6) (from 1.4.5), all of the jobs are failing with the following error message:
FATAL: null
java.lang.NullPointerException
at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.retrieveGitlabProjectIds(CommitStatusUpdater.java:120)
at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.updateCommitStatus(CommitStatusUpdater.java:53)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.prebuild(GitLabCommitStatusPublisher.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:789)
at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:784)
at hudson.model.Build$BuildExecution.doRun(Build.java:145)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490)
at hudson.model.Run.execute(Run.java:1735)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:405)
ERROR: Build step failed with exception
java.lang.NullPointerException
at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.retrieveGitlabProjectIds(CommitStatusUpdater.java:120)
at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.updateCommitStatus(CommitStatusUpdater.java:53)
at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.perform(GitLabCommitStatusPublisher.java:57)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:735)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:676)
at hudson.model.Build$BuildExecution.post2(Build.java:186)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:621)
at hudson.model.Run.execute(Run.java:1760)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:405)
Build step 'Publish build status to GitLab commit (GitLab 8.1+ required)' marked build as failure
Other info:
We're on Gitlab-EES 9.3.1, and Jenkins 2.60.1
+1
Jobs that are triggered on a merge request are still working, but I get the crash on jobs just checking for 'Push Events'
I've got the same problem.
Gitlab plugin (1.4.6)
Jenkins ver. 2.60.1
Can confirm this, same stack trace with Gitlab EE 9.3.1, Jenkins 1.642.3 and Gitlab Plugin 1.4.6. Only on push events, not merge requests.
reverting to 1.4.5 fixes the issue.
+1
Were all of you on version 1.4.5 before updating?
Yup, I was on 1.4.5
@sbrassely #562 introduced changes here, is it possible that this broke things?
Yes it seems posible but I can't reproduce.
Can someone share the build.xml file of a failed build so I can compare to mine?
I'll publish a fix ASAP
Here's a build.xml from one of the failed jobs:
<?xml version='1.0' encoding='UTF-8'?>
<hudson.maven.MavenModuleSetBuild plugin="[email protected]">
<actions>
<hudson.model.CauseAction>
<causeBag class="linked-hash-map">
<entry>
<hudson.model.Cause_-UserIdCause>
<userId>ffarah</userId>
</hudson.model.Cause_-UserIdCause>
<int>1</int>
</entry>
</causeBag>
</hudson.model.CauseAction>
<jenkins.metrics.impl.TimeInQueueAction plugin="[email protected]">
<queuingDurationMillis>14735</queuingDurationMillis>
</jenkins.metrics.impl.TimeInQueueAction>
<org.jenkinsci.plugins.envinject.EnvInjectPluginAction plugin="[email protected]"/>
<hudson.plugins.git.util.BuildData plugin="[email protected]">
<buildsByBranchName>
<entry>
<string>refs/remotes/origin/master</string>
<hudson.plugins.git.util.Build>
<marked plugin="[email protected]">
<sha1>4ba9f83acc9042d1ec13a5e5c974d91709e684dd</sha1>
<branches class="list">
<hudson.plugins.git.Branch>
<sha1 reference="../../../sha1"/>
<name>refs/remotes/origin/master</name>
</hudson.plugins.git.Branch>
</branches>
</marked>
<revision reference="../marked"/>
<hudsonBuildNumber>110</hudsonBuildNumber>
</hudson.plugins.git.util.Build>
</entry>
</buildsByBranchName>
<lastBuild reference="../buildsByBranchName/entry/hudson.plugins.git.util.Build"/>
<remoteUrls>
<string>[email protected]:ffadi/MavenTestProject.git</string>
</remoteUrls>
</hudson.plugins.git.util.BuildData>
<hudson.plugins.git.GitTagAction plugin="[email protected]">
<tags class="hudson.util.CopyOnWriteMap$Tree">
<entry>
<string>refs/remotes/origin/master</string>
<list/>
</entry>
</tags>
<ws>/var/lib/jenkins/workspace/Dev.eng-pst.devtools.MavenTestProject</ws>
</hudson.plugins.git.GitTagAction>
<hudson.scm.SCMRevisionState_-None/>
<hudson.plugins.sonar.action.SonarMarkerAction plugin="[email protected]"/>
<hudson.plugins.sonar.action.SonarAnalysisAction plugin="[email protected]">
<installationName>Sonar</installationName>
<url>http://sonar.company.com/dashboard/index/com.company.paas.maventestproject:MavenTestProject</url>
<isNew>false</isNew>
<isSkipped>true</isSkipped>
</hudson.plugins.sonar.action.SonarAnalysisAction>
<hudson.plugins.sonar.action.SonarCacheAction plugin="[email protected]">
<infoByTaskId/>
<infoByUrl>
<entry>
<string>http://sonar.company.com/dashboard/index/com.company.paas.maventestproject:MavenTestProject</string>
<hudson.plugins.sonar.client.ProjectInformation>
<created>1499401181127</created>
<key>com.company.paas.maventestproject:MavenTestProject</key>
<name>Maven Test Project</name>
<url>http://sonar.company.com/dashboard/index/com.company.paas.maventestproject:MavenTestProject</url>
<status>NONE</status>
</hudson.plugins.sonar.client.ProjectInformation>
</entry>
</infoByUrl>
<lastRequest>1499401181339</lastRequest>
<lastProjInfo>
<hudson.plugins.sonar.client.ProjectInformation reference="../../infoByUrl/entry/hudson.plugins.sonar.client.ProjectInformation"/>
</lastProjInfo>
</hudson.plugins.sonar.action.SonarCacheAction>
<com.nirima.jenkins.plugins.docker.action.DockerBuildAction plugin="[email protected]">
<containerHost>tcp://10.96.3.67:4243</containerHost>
<containerId>0d0f9be716dbba4a675a8f0226add363c468b88454b40378bd50f243d707e279</containerId>
<remoteFsMapping>/var/lib/jenkins/workspace</remoteFsMapping>
</com.nirima.jenkins.plugins.docker.action.DockerBuildAction>
</actions>
<queueId>4125</queueId>
<timestamp>1499401174328</timestamp>
<startTime>1499401174401</startTime>
<result>FAILURE</result>
<duration>6220</duration>
<charset>US-ASCII</charset>
<keepLog>false</keepLog>
<builtOn>Docker-0d0f9be716db</builtOn>
<workspace>/var/lib/jenkins/workspace/Dev.eng-pst.devtools.MavenTestProject</workspace>
<hudsonVersion>2.60.1</hudsonVersion>
<scm class="hudson.plugins.git.GitChangeLogParser" plugin="[email protected]">
<authorOrCommitter>false</authorOrCommitter>
</scm>
<culprits class="com.google.common.collect.EmptyImmutableSortedSet"/>
<mavenVersionUsed>3.3.9</mavenVersionUsed>
</hudson.maven.MavenModuleSetBuild>
A fix was commited. If someone please give it a try.
I'll build a snapshot release with this patch, to make it easier for folks to install and test.
Please manually install http://repo.jenkins-ci.org/snapshots/org/jenkins-ci/plugins/gitlab-plugin/1.4.7-SNAPSHOT/gitlab-plugin-1.4.7-20170710.211358-1.hpi to test this fix. You can install it by uploading it directly to Jenkins from the Advanced tab of the plugin manager.
@omehegan The snapshot seems to be working fine. Thanks!
Still broken for me on manual build, I have the same error everytime it reaches the plugin instruction:
gitlabBuilds(builds: ["build", "test"]) { // Some code }
@orevial
What's the error log ? Can you provide more elements as :
Thank you
I was hit with this as well. Downgrading to 1.4.5 from 1.4.6 fixed the problem.
@chinhodado if you can test the snapshot release of 1.4.7 which I linked to earlier in this issue, that should resolve this problem. Please let us know if it does not.
@chinhodado How I cant test snapshot release 1.4.7 of this plugin?
I'm interest on test it.
@yuniers you have to download the plugin here : http://repo.jenkins-ci.org/snapshots/org/jenkins-ci/plugins/gitlab-plugin/1.4.7-SNAPSHOT/gitlab-plugin-1.4.7-20170710.211358-1.hpi and install it manually in Jenkins plugin center (you can look at https://jenkins.io/doc/book/managing/plugins/#advanced-installation for this purpose)
@sbrassely
Sorry my message was not very "verbose".
Here is my config :
My config file is below.
<?xml version='1.0' encoding='UTF-8'?>
<flow-definition plugin="[email protected]">
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties>
<com.sonyericsson.rebuild.RebuildSettings plugin="[email protected]">
<autoRebuild>false</autoRebuild>
<rebuildDisabled>false</rebuildDisabled>
</com.sonyericsson.rebuild.RebuildSettings>
<jenkins.model.BuildDiscarderProperty>
<strategy class="hudson.tasks.LogRotator">
<daysToKeep>-1</daysToKeep>
<numToKeep>10</numToKeep>
<artifactDaysToKeep>-1</artifactDaysToKeep>
<artifactNumToKeep>-1</artifactNumToKeep>
</strategy>
</jenkins.model.BuildDiscarderProperty>
<org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
<triggers/>
</org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
</properties>
<definition class="org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition" plugin="[email protected]">
<scm class="hudson.plugins.git.GitSCM" plugin="[email protected]">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>[email protected]:myteam/myproject.git</url>
<credentialsId>ssh_key</credentialsId>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<submoduleCfg class="list"/>
<extensions>
<hudson.plugins.git.extensions.impl.SubmoduleOption>
<disableSubmodules>false</disableSubmodules>
<recursiveSubmodules>true</recursiveSubmodules>
<trackingSubmodules>true</trackingSubmodules>
<reference></reference>
<parentCredentials>true</parentCredentials>
</hudson.plugins.git.extensions.impl.SubmoduleOption>
<hudson.plugins.git.extensions.impl.RelativeTargetDirectory>
<relativeTargetDir>git-repository</relativeTargetDir>
</hudson.plugins.git.extensions.impl.RelativeTargetDirectory>
<hudson.plugins.git.extensions.impl.LocalBranch>
<localBranch>master</localBranch>
</hudson.plugins.git.extensions.impl.LocalBranch>
<hudson.plugins.git.extensions.impl.WipeWorkspace/>
</extensions>
</scm>
<scriptPath>git-repository/Jenkinsfile</scriptPath>
<lightweight>false</lightweight>
</definition>
<triggers/>
<disabled>false</disabled>
</flow-definition>
@orevial
Can you provide the flow-build XML file (of the failed build) and not the flow definition ?
Thank you
I can confirm that the snapshot release of 1.4.7 resolves the issue on my Jenkins server.
@omehegan like @movermeyer says, snapshot release 1.4.7 resolve the issue.
My intention for now is to determine if @orevial's issue is related to this bug or not. If not, I will go ahead and merge this fix. I may wait until next month to release it, along with other patches, as 1.4.7.
I'm not sure waiting until next month to release it is a good idea. This is a breaking bug.
@omehegan @sbrassely
I'm sorry but I can't publish the workflow of the failed build here, it contains too much sensitive information and it would be very long to anonymize. But I think it is really easy to reproduce the error :
gitlabBuilds(builds: ["build", "test"]) {
stage("Build") {
gitlabCommitStatus(name: "build") {
// Build code here...
}
}
stage("Unit test") {
gitlabCommitStatus(name: "test") {
// Test code here...
}
}
}
Now the result with snapshot version 1.4.7 is:
java.lang.NullPointerException
at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.retrieveGitlabProjectIds(CommitStatusUpdater.java:131)
at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.updateCommitStatus(CommitStatusUpdater.java:54)
at com.dabsquared.gitlabjenkins.workflow.GitLabBuildsStep$Execution$1.onStart(GitLabBuildsStep.java:72)
at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution.launch(CpsBodyExecution.java:124)
at org.jenkinsci.plugins.workflow.cps.CpsBodyInvoker.launch(CpsBodyInvoker.java:170)
at org.jenkinsci.plugins.workflow.cps.DSL$ThreadTaskImpl.invokeBody(DSL.java:568)
at org.jenkinsci.plugins.workflow.cps.DSL$ThreadTaskImpl.eval(DSL.java:538)
at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:184)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:330)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:82)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:242)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:230)
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
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:748)
Hope it helps.
Thank you for additional informations.
I configured a job with the information you provided, which allowed me to reproduce the problem.
But with this configuration (i.e. with Jenkins job of type Pipeline script from SCM), Jenkins doesn't provide informations about the project's commits. So there's no BuildData as SCMRevisionAction and it's not possible to update the project commit status.
For now, I don't know how to update the correct Gitlab project...
There is a need to investigate the possibilities provided by Jenkins at this level. I come back to you as soon as possible.
Some questions :
Yes I do have a scm checkout in my jenkinsfile.
About my problem, I understand that running the build manually will not allow having information usually sent by Gitlab, and it seems very normal to me that we don't update commit status upon manual launch (we probably don't want the same commit/merge request to receive status updates again as result would be strange for developers/users). However, my concern is that we get an uncatch exception (NPE above) and that the build fails. In that case, the nullity of BuildData or SCMRevisionAction should be checked so it just displays a warning in that case or something like that.
That what happened in version 1.4.5 (actually it didn't output anything but at least the build was a success) so that's the regression I have seen.
You are right, I updated accordingly
@chinhodado well, you can run the snapshot release with the fix until then.
Here is an updated snapshot with @sbrassely's latest fix. @orevial can you try this? http://repo.jenkins-ci.org/snapshots/org/jenkins-ci/plugins/gitlab-plugin/1.4.7-SNAPSHOT/gitlab-plugin-1.4.7-20170713.181757-2.hpi
@omehegan I just tried the updated snapshot and it seems to work fine
Just tested with my pipelines in both manual and automatic mode (via Gitlab webhook), seems ok !
Thanks guys for the work ☺
snapshot works for me, too
I released version 1.4.7 with just this fix. It should be available in the update center within the next few hours. Thanks everyone who helped test the fix!
Most helpful comment
I released version 1.4.7 with just this fix. It should be available in the update center within the next few hours. Thanks everyone who helped test the fix!