| Thanks for offering! I'm happy to consider a pull request that adds symbols for the Pipeline checkout step and the Pipeline syntax section. I'm not willing to consider additions to the git step unless they are also available in the checkout step. The syntax you used in your example with a git step nested inside a checkout step is not a syntax I recognize. I'm accustomed to the syntax generated by the Snippet Generator inside Jenkins. Today it creates a snippet that looks like this:
checkout(
[$class: 'GitSCM',
branches: [[name: 'stable-2.176']],
extensions: [
[$class: 'CloneOption', depth: 1, honorRefspec: true, noTags: true, reference: '/var/lib/git/jenkinsci/jenkins.git', shallow: true],
[$class: 'LocalBranch', localBranch: 'stable-2.176'],
[$class: 'ChangelogToBranch', options: [compareRemote: 'origin', compareTarget: 'stable-2.164']
]
],
gitTool: 'Default',
userRemoteConfigs: [
[refspec: '+refs/heads/stable-2.176:refs/remotes/origin/stable-2.176 +refs/heads/stable-2.164:refs/remotes/origin/stable-2.164',
url: 'https://github.com/jenkinsci/jenkins.git'
]
]
]
)
I'd be interested in a pull request that would make it look something more like this:
checkout(
[$class: 'GitSCM',
branches: [[name: 'stable-2.176']],
extensions: [
cloneOption(depth: 1, honorRefspec: true, noTags: true, reference: '/var/lib/git/jenkinsci/jenkins.git', shallow: true),
localBranch('stable-2.176'),
changelogToBranch('origin', 'stable-2.164')
],
gitTool: 'Default',
userRemoteConfigs: [
[refspec: '+refs/heads/stable-2.176:refs/remotes/origin/stable-2.176 +refs/heads/stable-2.164:refs/remotes/origin/stable-2.164',
url: 'https://github.com/jenkinsci/jenkins.git'
]
]
]
)
Also, the specific example of relativeTargetDir should not be added as a symbol. The dir and ws steps in Pipeline are the preferred way to perform a checkout to a subdirectory of a workspace in a Pipeline. I don't think we should add convenience symbols for extensions that are not intended to be used in Pipeline. The extensions continue to exist and continue to behave as they did before, but we should not encourage further use in Pipelines when there are more general purpose ways to do the same thing. Reviewing such a pull request would likely need help from Jesse Glick or Andrew Bayer since I'm not deeply experienced in the coding patterns for Pipeline support. |