[JIRA] (JENKINS-50158) Git plugin class LocalBranch needs to be serializable

3 views
Skip to first unread message

o.v.nenashev@gmail.com (JIRA)

unread,
Mar 13, 2018, 10:04:02 PM3/13/18
to jenkinsc...@googlegroups.com
Oleg Nenashev moved an issue
 
Jenkins / Bug JENKINS-50158
Git plugin class LocalBranch needs to be serializable
Change By: Oleg Nenashev
Project: Infrastructure Jenkins
Key: INFRA JENKINS - 1535 50158
Workflow: classic default workflow JNJira + In-Review
Component/s: git-plugin
Component/s: ci
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

o.v.nenashev@gmail.com (JIRA)

unread,
Mar 13, 2018, 10:04:02 PM3/13/18
to jenkinsc...@googlegroups.com

o.v.nenashev@gmail.com (JIRA)

unread,
Mar 13, 2018, 10:04:03 PM3/13/18
to jenkinsc...@googlegroups.com
Oleg Nenashev commented on Bug JENKINS-50158
 
Re: Git plugin class LocalBranch needs to be serializable

I doubbt it can be triaged without version/logs though

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 13, 2018, 10:55:02 PM3/13/18
to jenkinsc...@googlegroups.com
Mark Waite assigned an issue to Unassigned
 
Change By: Mark Waite
Assignee: Mark Waite

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 13, 2018, 10:58:02 PM3/13/18
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-50158
 
Re: Git plugin class LocalBranch needs to be serializable

I have several Jenkinsfile based multi-branch pipeline jobs which use the LocalBranch extension successfully in a checkout scm step. Oleg Nenashev is correct that we'll need detailed steps describing how to duplicate the problem.

Please include the Jenkins version, the git plugin version, the git client plugin version, and the Pipeline plugin versions in the bug report. Or, upload a support bundle to the bug report since I believe that will capture plugin version numbers as well.

john.lonergan@gmail.com (JIRA)

unread,
Mar 14, 2018, 4:34:01 AM3/14/18
to jenkinsc...@googlegroups.com

Will try and provide logs.

The problem only occured when I tried to move the code below from the jenkinsfile to Jenkins library. NoTe Code below is not literally what I have as I am not at a computer right now...

def gitscm = new GitScm(... , extensions: [new LocalBranch('**')])
def scmvars = checkout gitscm

While this code was in my jenkinsfile there wasn't a problem, but move it to a Jenkins library and it then fails.

Curiously even though the build fails with serializable eror I found that when I hit replay then the build succeeds. Presumably during replay Jenkins doesn't try to serialise the Jenkins job state.

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 14, 2018, 9:29:02 AM3/14/18
to jenkinsc...@googlegroups.com

That syntax surprises me. It is quite different from the syntax provided by the "Pipeline Syntax" link that is available from PIpeline job pages.

Steps I used:

  1. create a Pipeline library that performs a checkout with local branch
  2. Reference that Pipeline library from the Jenkinsfile in the JENKINS-50158 branch in my jenkins-bugs repository
  3. Watch that job run from the multi-branch Pipeline defined in my Docker image

I'm not sure if the syntax you're using with the call to `new LocalBranch` is expected to run or not. I assume it is a surprise (to others) that it works in the Jenkinsfile and not in the library, but it is outside the expected use case.

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 14, 2018, 9:30:02 AM3/14/18
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-50158
That syntax surprises me.  It is quite different from the syntax provided by the "Pipeline Syntax" link that is available from PIpeline job pages.

Steps I used to confirm that I can perform a checkout from inside a library :
# create a [Pipeline library|https://github.com/MarkEWaite/jenkins-pipeline-utils/blob/branch-for-checkout-in-library/src/com/markwaite/Checkout.groovy] that performs a checkout with local branch
# Reference that Pipeline library from the [Jenkinsfile in the JENKINS-50158 branch|https://github.com/MarkEWaite/jenkins-bugs/blob/JENKINS-50158/Jenkinsfile] in my [jenkins-bugs repository|https://github.com/MarkEWaite/jenkins-bugs/]
# Watch that job run from the [multi-branch Pipeline|https://github.com/MarkEWaite/docker-lfs/tree/lts-with-plugins/ref/jobs/Bugs-Pipeline-Checks/jobs/jenkins-bugs-multibranch-pipeline] defined in my [Docker image|https://github.com/MarkEWaite/docker-lfs/tree/lts-with-plugins/Dockerfile]


I'm not sure if the syntax you're using with the call to `new LocalBranch` is expected to run or not.  I assume it is a surprise (to others) that it works in the Jenkinsfile and not in the library, but it is outside the expected use case.

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 14, 2018, 9:30:02 AM3/14/18
to jenkinsc...@googlegroups.com

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 15, 2018, 8:11:07 AM3/15/18
to jenkinsc...@googlegroups.com
Mark Waite resolved as Not A Defect
 
Change By: Mark Waite
Status: Open Resolved
Resolution: Not A Defect

john.lonergan@gmail.com (JIRA)

unread,
Mar 19, 2018, 8:46:03 AM3/19/18
to jenkinsc...@googlegroups.com
John Lonergan commented on Bug JENKINS-50158
 
Re: Git plugin class LocalBranch needs to be serializable

Mark thank you. Thank works for me.

I'm trying to understand what the difference is between using your approach Vs constructing the args to checkout by using the new operator as I was doing.

Clearly your approach works but what's the difference?

My approach ran ok when I hit replay on a build but produced the serialisation error if the build was triggered normally.

Thanks in advance

john.lonergan@gmail.com (JIRA)

unread,
Mar 19, 2018, 8:48:01 AM3/19/18
to jenkinsc...@googlegroups.com

PS I couldn't find any doco on the meaning of the square bracket construction approach you've used. Are you able to provide a pointer?

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 19, 2018, 9:20:01 AM3/19/18
to jenkinsc...@googlegroups.com

I consider the "Pipeline Syntax" link to be executable documentation. I configure the desired settings from the user interface, press "Generate Pipeline Script" , and use the resulting text in my Pipeline script. Unfortunately, I don't know why the form you used does not work. I'd never seen that form until you included it in this bug report.

I regularly remind myself that Jenkins Pipeline is a domain specific language based on groovy, but it is not groovy. There are several cases where pure groovy syntax (as copied from internet examples) is not allowed or accepted. This may be one of those cases, or it may be something completely different.

john.lonergan@gmail.com (JIRA)

unread,
Mar 19, 2018, 9:28:02 AM3/19/18
to jenkinsc...@googlegroups.com

Cheers

Also any pointers on the square brackets syntax?

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 19, 2018, 9:43:03 AM3/19/18
to jenkinsc...@googlegroups.com

No pointers on the square brackets syntax other than the "Pipeline Syntax" output.

I've never seen a syntax reference for Jenkins Pipeline, nor do I really ever expect to see a syntax reference.

Examples with some explanations are available at:

Arguments and the contents of the git plugin help entries are available by searching for GtiSCM in

mark.earl.waite@gmail.com (JIRA)

unread,
Jul 14, 2019, 8:03:03 AM7/14/19
to jenkinsc...@googlegroups.com
Mark Waite closed an issue as Not A Defect
 
Change By: Mark Waite
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)
Reply all
Reply to author
Forward
0 new messages