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

useRepository its not applied

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-parameter-plugin
    • None
    • centos7

      useRepository does not seem to applied. Every time I set it, it will display No GIT repository configured in SCM configuration. Tried use https protocol, adding ^.*ubuntu16-cmake as regex as well but same message is shown.

      My initial use case was to show the branches from the repository that is selected in choices but that seems not to be possible without a build. So I tried to use a fixed repository (for testing) and noticed that useRepository makes the msg to appear.

      Additional notes:

      • Running without useRepository, only the branches from the default value are shown (ubuntu16-cmake) even if i choose ubuntu16-maven. Both builds finish ok since it's only checkout the repo.
      • Running the jenkinsfile from SCM, only shows branches from repo where jenkinsfile is located. My use case has 3 repos (jenkinsfile only, ubuntu16-cmake and ubuntu16-maven)
      • Is it possible to pass a variable to useRepository field?

       

      Tested with jenkins (2.138) and its plugins fully updated as of 20180821.

       

      Example:

      properties(
          [parameters(
              [choice(
                  choices: ['ubuntu16-cmake', 'ubuntu16-maven'], description: '', name: 'my_choice'), 
                  [$class: 'GitParameterDefinition', branch: '', 
                      branchFilter: '.*', 
                      defaultValue: '', 
                      description: '', 
                      name: 'my_branch', 
                      quickFilterEnabled: false, 
                      selectedValue: 'NONE', 
                      sortMode: 'NONE', 
                      tagFilter: '*', 
                      type: 'PT_BRANCH', 
                      useRepository: "ssh://git@the-repo/ubuntu16-cmake.git"]]), 
          [$class: 'ThrottleJobProperty', 
          categories: [], 
          limitOneJobWithMatchingParams: false, 
          maxConcurrentPerNode: 0, 
          maxConcurrentTotal: 0, 
          paramsToUseForLimit: '', 
          throttleEnabled: false, 
          throttleOption: 'project']])
      
      node('master'){
          deleteDir()
          checkout(
          [$class: 'GitSCM', branches: [[name: '*/latest']], 
              doGenerateSubmoduleConfigurations: false, 
              extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: '$my_choice']], 
              submoduleCfg: [], 
              userRemoteConfigs: [[credentialsId: 'my-creds', 
              url: 'ssh://git@the-repo/$my_choice.git']]])
          sh 'ls -l'
      }
      
      

            klimas7 Boguslaw Klimas
            ncosta Nuno Costa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: