I think you can assign the original to a new variable, then modify only the
precise portions that need to be changed.
Like this:
// Narrow the respec to only this branch
def branch = 'JENKINS-59016'
def myRemoteConfigs = scm.userRemoteConfigs
myRemoteConfigs[0].refspec =
"+refs/heads/${branch}:refs/remotes/origin/${branch}"
Then use the new variable as the value as in:
userRemoteConfigs: myRemoteConfigs
Mark Waite
On Wed, Aug 21, 2019 at 2:56 PM red 888 <[email protected]> wrote:
> in my jenkins pipeline i have this:
>
>
> checkout([$class: 'GitSCM',
> branches: [[name: "${env.BRANCH_NAME}"]],
> doGenerateSubmoduleConfigurations: false,
> extensions: [
> [$class: 'SubmoduleOption',
> disableSubmodules: false,
> parentCredentials: true,
> recursiveSubmodules: true,
> reference: '',
> trackingSubmodules: true],
> [$class: 'CloneOption', timeout: config.timeout],
> [$class: 'CheckoutOption', timeout: config.timeout],
> [$class: 'GitLFSPull']
> ],
> submoduleCfg : [],
> userRemoteConfigs: [[
> //scm.userRemoteConfigs,
> refspec: '+refs/tags/*:refs/remotes/origin/tags/*'
> ]]
> ])
>
>
> I just want to modify the refspec and use the rest of the defaults in
> scm.userRemoteConfigs. How can I do that without having to manually set all
> of them because Im no longer just passing in scm.userRemoteConfigs
>
>
> Im trying to get jenkins to trigger a build when it sees a new tag (like
> it does with new branches) right now it indexes and gets the new tag but
> doesn't run a build
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/7e5c1679-a40c-4364-b149-282008953df5%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/7e5c1679-a40c-4364-b149-282008953df5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
Thanks!
Mark Waite
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtHDWP490_1YbKVUgX0ZkYxOV60A9SCQPkdgioitn70k3w%40mail.gmail.com.