[JIRA] (JENKINS-43052) Disallow "Additional Behaviors > Check out to a sub-directory" for Pipeline projects

9 views
Skip to first unread message

jenkins@johnnado.com (JIRA)

unread,
Mar 22, 2017, 6:22:01 PM3/22/17
to jenkinsc...@googlegroups.com
John McGehee updated an issue
 
Jenkins / Bug JENKINS-43052
Disallow "Additional Behaviors > Check out to a sub-directory" for Pipeline projects
Change By: John McGehee
Summary: Disallow * " Additional Behaviors > Check out to a sub-directory * " for Pipeline projects
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

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

unread,
Mar 22, 2017, 6:22:02 PM3/22/17
to jenkinsc...@googlegroups.com

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

unread,
Mar 22, 2017, 7:02:01 PM3/22/17
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-43052
 
Re: Disallow "Additional Behaviors > Check out to a sub-directory" for Pipeline projects

I believe your concern is that when using the UI to define the top level pipeline project (in a pipeline project that gets its Jenkinsfile from a git repository, or in a multi-branch pipeline), there are options displayed which will prevent the pipeline code from finding Jenkinsfile in the ...@script directory. I think you're right that we should disable presenting those options to the user when they are defining the top level pipeline project.

I think your statement:

As far as I can see, Additional Behaviors > Check out to a sub-directory is never appropriate with Pipeline.

is too broad, at least for my use case. I use checkout to a subdirectory to allow me to bring multiple repositories into a single workspace with simple calls to checkout. I could certainly replace those calls to checkout by nesting them inside a dir(), but I don't see why we should disallow my use of checkout to a subdirectory from inside a Jenkinsfile. I don't see how that would help users who (like me) can use "Pipeline Syntax" to show the options in that context, and use them.

Refer to the 35475 verification check Jenkinsfile for an example of how I use checkout to a subdirectory inside a Jenkinsfile.

However, I'm certainly open to further knowledge from @jglick. I would rather not break compatibility with existing uses of the checkout command, unless there is a compelling reason to do so.

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

unread,
Mar 22, 2017, 7:15:01 PM3/22/17
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-43052
I believe your concern is that when using the UI to define the top level pipeline project (in a pipeline project that gets its Jenkinsfile from a git repository, or in a multi-branch pipeline), there are options displayed which will prevent the pipeline code from finding Jenkinsfile in the {{...@script}} directory.  I think you're right that we should disable presenting those options to the user when they are defining the top level pipeline project.

I think your statement:

bq. As far as I can see, Additional Behaviors > Check out to a sub-directory is never appropriate with Pipeline.


is too broad, at least for my use case.  I use checkout to a subdirectory to allow me to bring multiple repositories into a single workspace with simple calls to checkout.  I could certainly replace those calls to checkout by nesting them inside a dir(), but I don't see why we should disallow my use of checkout to a subdirectory from inside a Jenkinsfile.  I don't see how that would help users who (like me) can use "Pipeline Syntax" to show the options in that context, and use them.

Refer to the [35475 verification check Jenkinsfile|https://github.com/MarkEWaite/jenkins-bugs/blob/JENKINS-35475/Jenkinsfile] for an example of how I use checkout to a subdirectory inside a Jenkinsfile.

However, I'm certainly open to further knowledge from
@ [~ jglick ] .  I would rather not break compatibility with existing uses of the checkout command, unless there is a compelling reason to do so.

jglick@cloudbees.com (JIRA)

unread,
Mar 24, 2017, 2:56:03 PM3/24/17
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Mar 24, 2017, 2:58:01 PM3/24/17
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-43052
 
Re: Disallow "Additional Behaviors > Check out to a sub-directory" for Pipeline projects

Since there is a generic way to select the base directory in Pipeline—dir—any historical SCM plugin options created for the benefit of freestyle projects and obsolete and should be considered deprecated in the context of Pipeline.

jenkins@johnnado.com (JIRA)

unread,
Mar 24, 2017, 3:50:02 PM3/24/17
to jenkinsc...@googlegroups.com

Maybe some more–or all–of these options should be removed when the project type is Pipeline.

Jesse Glick, perhaps you meant, "...are obsolete and should be considered..."

jglick@cloudbees.com (JIRA)

unread,
Mar 24, 2017, 4:53:03 PM3/24/17
to jenkinsc...@googlegroups.com
Jesse Glick edited a comment on Bug JENKINS-43052
Since there is a generic way to select the base directory in Pipeline—{{dir}}—any historical SCM plugin options created for the benefit of freestyle projects and are  obsolete and should be considered deprecated in the context of Pipeline.

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

unread,
Mar 24, 2017, 10:28:01 PM3/24/17
to jenkinsc...@googlegroups.com

Thanks Jesse Glick, I've removed the remoteTargetDir setting from my pipeline test jobs. It will take a while before I have time to take any more active measures to hide that option from a pipeline user.

fabian.holler@simplesurance.de (JIRA)

unread,
Aug 16, 2018, 8:46:02 AM8/16/18
to jenkinsc...@googlegroups.com

I stumpled upon the same issue.
We specified to checkout the git repository that contains the Jenkinsfile in a subdirectory.
All jobs failed because Jenkins failed to find the Jenkinsfile in the wrong directory.
Either:

  • it must be ensured that 'Script Path' is relative to the specified checkout subdirectory or
  • the option should be removed
This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

fabian.holler@simplesurance.de (JIRA)

unread,
Aug 16, 2018, 8:51:35 AM8/16/18
to jenkinsc...@googlegroups.com
Fabian Holler edited a comment on Bug JENKINS-43052
I stumpled upon the same issue.
We specified to checkout the git repository that contains the Jenkinsfile in a subdirectory.
All jobs failed because Jenkins failed to find the Jenkinsfile in the wrong directory.
Either:
- it must be ensured that 'Script Path' is relative to the specified checkout subdirectory or
- the option should be removed
for specifying the repository for the Jenkinsfile

fabian.holler@simplesurance.de (JIRA)

unread,
Aug 16, 2018, 8:52:02 AM8/16/18
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Aug 27, 2018, 11:41:02 AM8/27/18
to jenkinsc...@googlegroups.com

I would suggest making the behavior runtime print a warning to the build log if it is working on a non-AbstractBuild noting that it should not be used.

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

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

unread,
Jan 25, 2020, 9:31:06 PM1/25/20
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
 
Change By: Mark Waite
_Additional Behaviors > Check out to a sub-directory_ clones Jenkinsfile in the specified directory. Meanwhile, Jenkins itself continues to look for Jenkinsfile at the top of the workspace.  This is very confusing.

As far as I can see, _Additional Behaviors > Check out to a sub-directory_ is never appropriate with Pipeline.  This should be handled in Jenkinsfile using dir():
{code:java}
dir('subDir') {
    checkout scm
}{code}
In JENKINS-40267, [~jglick] suggested that {{git-plugin}} should conditionally display the _Additional Behaviors > Check out to a sub-directory_ option only if the {{AncestorInPath}} is an {{AbstractProject}}.

  Removing the option might break compatibility but we could print an explanatory warning into the build log.  The warning would say that {{Check out to a sub-directory}} is not intended for use with Pipeline jobs.  The message should describe the preferred declarative technique of using the the {{dir}} step to provide a subdirectory which contains the checkout or using
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

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

unread,
Jan 25, 2020, 9:31:07 PM1/25/20
to jenkinsc...@googlegroups.com
Removing the option might break compatibility but we could print an explanatory warning into the build log.  The warning would say that {{Check out to a sub-directory}} is not intended for use with Pipeline jobs.  The message should describe the preferred declarative technique of using the the {{dir}} step to provide a subdirectory which contains the checkout or using the checkoutToSubdirectory option.

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

unread,
Jan 25, 2020, 9:32:03 PM1/25/20
to jenkinsc...@googlegroups.com

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

unread,
Feb 8, 2020, 5:31:03 PM2/8/20
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-43052
 
Re: Disallow "Additional Behaviors > Check out to a sub-directory" for Pipeline projects

I agree that we should print a runtime warning. It would also be nice to add telemetry for some limited time (a month?) that would report when such a call was made. I believe the Jenkins project has the ability to define telemetry and this might be a good place to use that telemetry to decide if we can do more than warn users that they are using a deprecated feature in their PIpeline.

Reply all
Reply to author
Forward
0 new messages