[JIRA] (JENKINS-61732) additional refspecs at the organisational level is unworkable

14 views
Skip to first unread message

brian.murrell@intel.com (JIRA)

unread,
Mar 29, 2020, 10:34:02 AM3/29/20
to jenkinsc...@googlegroups.com
Brian J Murrell created an issue
 
Jenkins / Bug JENKINS-61732
additional refspecs at the organisational level is unworkable
Issue Type: Bug Bug
Assignee: Mark Waite
Components: git-plugin
Created: 2020-03-29 14:33
Priority: Critical Critical
Reporter: Brian J Murrell

I'm using a github organization with declarative pipeline to build many projects in our organisation.  I need some (one currently) project to fetch additional refspecs so that a job can do git operations on them.

This however breaks for any projects that don't have all of the additional refspecs in them.

It seems unrealistic to expect every project within an organisation to have all of the additional refspecs.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

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

unread,
Mar 29, 2020, 12:23:03 PM3/29/20
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-61732
 
Re: additional refspecs at the organisational level is unworkable

Brian J Murrell you can use a unique refspec in the declarative pipeline checkout of a specific branch by using the skipDefaultCheckout directive in the declarative pipeline of that branch. After the skipDefaultCheckout, then you place a checkout step inside the declarative pipeline which uses the exact refspec that you want.

Refer to my repository for a Jenkinsfile that defines a refspec with declarative pipeline.

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

unread,
Mar 29, 2020, 12:25:02 PM3/29/20
to jenkinsc...@googlegroups.com
Mark Waite updated Bug JENKINS-61732
 

The skipDefaultCheckout technique may need to be described more visibly in advanced tutorials or in an intermediate declarative pipeline segment.

It is intentional that a declarative pipeline includes an implicit checkout. That makes sense for the vast majority of cases. In those cases where it does not make sense (like this one described by Brian), skipDefaultCheckout allows full control of the checkout step.

Change By: Mark Waite
Status: Open Fixed but Unreleased
Resolution: Not A Defect

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

unread,
Mar 29, 2020, 12:25:03 PM3/29/20
to jenkinsc...@googlegroups.com

brian.murrell@intel.com (JIRA)

unread,
Apr 1, 2020, 12:45:02 PM4/1/20
to jenkinsc...@googlegroups.com
Brian J Murrell commented on Bug JENKINS-61732
 
Re: additional refspecs at the organisational level is unworkable

Fair enough.  How can one find out what the parameters to  the default checkout are being used?  IOW, if I wanted to start with replicating exactly what the default checkout does and then alter it to my needs, how would I know what that default checkout looks like?

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

unread,
Apr 1, 2020, 1:18:07 PM4/1/20
to jenkinsc...@googlegroups.com

Brian J Murrell There are several sample jobs like this one, this one, and this one which show techniques like echoing the values of parts of the scm object to see them.

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

unread,
Apr 1, 2020, 1:31:03 PM4/1/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-61732
[~brianjmurrell] There are several sample jobs like [this one|https://github.com/MarkEWaite/jenkins-bugs/blob/JENKINS-42860/Jenkinsfile], [this one|https://github.com/MarkEWaite/jenkins-bugs/blob/master/Jenkinsfile], and [this one|https://github.com/MarkEWaite/jenkins-bugs/blob/JENKINS-52844/Jenkinsfile] which show techniques like echoing the values of parts of the scm object to see them.

Since the default checkout settings are defined in the multibranch pipeline job itself, the {{scm}} object is the best way to find them.  Many of my multibranch pipeline jobs define a reference repository and declare that the checkout should honor the refsepec in checkout.  Others do not.

brian.murrell@intel.com (JIRA)

unread,
Apr 1, 2020, 1:46:03 PM4/1/20
to jenkinsc...@googlegroups.com

OK.  So then, is using a "bare" checkout command effectively do the same thing as not specifying skipDefaultCheckout?

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

unread,
Apr 1, 2020, 1:51:02 PM4/1/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-61732
A declarative pipeline with {{skipDefaultCheckout} } and the first step as {{checkout scm}} is the same as not declaring {{skipDefaultCheckout}} and not specifying {{checkout scm}} as the first step.

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

unread,
Apr 1, 2020, 1:51:02 PM4/1/20
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages