Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39709

Use SCM extension [$class: 'ScmName'] in Pipeline step

XMLWordPrintable

      Given the following code

      lock('checkout') {
          stage('checkout') {
              checkout([$class: 'GitSCM',
                      branches: [[name: branch]],
                      doGenerateSubmoduleConfigurations: false,
                      extensions: [[$class: 'CleanCheckout'], [$class: 'ScmName', name: 'super']],
                      submoduleCfg: [],
                      userRemoteConfigs: [[url: "${gitBaseUrl}/${superRepo}"]]])
      
              def repos = readFile('.gitslave')
              def reposLines = repos.readLines()
              for (line in reposLines) {
                  def repoInfo = line.split(' ')
                  def repoUrl = repoInfo[0]
                  def repoPath = repoInfo[1]
                  def curatedRepoUrl = repoUrl.substring(4, repoUrl.length()-1)
                  def curatedRepoPath = repoPath.substring(1, repoPath.length()-1)
      
                  checkout([$class: 'GitSCM',
                          branches: [[name: branch]],
                          doGenerateSubmoduleConfigurations: false,
                          extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: curatedRepoPath], [$class: 'CleanCheckout'], [$class: 'ScmName', name: curatedRepoPath]],
                          submoduleCfg: [],
                          userRemoteConfigs: [[url: "${gitBaseUrl}/${curatedRepoUrl}"]]])
              }
          }
      }
      
      

      We use $class: 'ScmName', name: curatedRepoPath].

      That is reflected in the SCM list, but not in Pipeline Step. See attached screenshots.

      Would be great if that value was used in the SCM pipeline step.

        1. scm2.png
          scm2.png
          22 kB
        2. scm.png
          scm.png
          47 kB

            Unassigned Unassigned
            roidelapluie Julien Pivotto
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: