jenkinsci / jenkinsci/git-parameter-plugin

[JENKINS-53161] useRepository its not applied

Open
#262 0 comments 0 reactions 0 assignees View on GitHub
component:git-parameter-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
131
Forks
134
Avg merge
21h 5m
Merged PRs (30d)
1

Description

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'
}

---
Originally reported by ncosta, imported from: useRepository its not applied


  • status: Open
  • priority: Minor
  • component(s): git-parameter-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 20251216-182730

Raw content of original issue

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'
}


  • environment: centos7

1 attachment

- [Screenshot_20180821_135206.png](https://issues.jenkins.io/secure/attachment/43804/Screenshot_20180821_135206.png)
> ![Screenshot_20180821_135206.png](https://issues.jenkins.io/secure/attachment/43804/Screenshot_20180821_135206.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.