jenkinsci / jenkinsci/git-parameter-plugin

Git Parameter useRepository does not load branches for secondary repo in Pipeline (Script from SCM)

Open
#335 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
131
Forks
134
Avg merge
21h 5m
Merged PRs (30d)
1

Description

### Jenkins and plugins versions report

Environment


```
Jenkins Version: 2.541.1

Git Parameter Plugin Version: 462.vdcf3df2ed2ca_
```

When using a Pipeline job configured as “Pipeline script from SCM”, the Git Parameter plugin fails to load branches for a parameter that specifies a different repository via useRepository.

The job SCM is configured with Repository A.

Two parameters (BRANCH, ANSIBLE_BRANCH) work correctly when useRepository is empty.

A third parameter (PYLIB_BRANCH) is configured with:

type: PT_BRANCH

useRepository: ssh://git@:/.git

Result:

The dropdown shows “failed to load” (or remains empty).

No branches from Repository B are displayed.

If useRepository is cleared, the parameter works — but it loads branches from Repository A instead of Repository B.

### What Operating System are you using (both controller, and any agents involved in the problem)?

AWS EC2 Instance Jenkins master + slave
Amazon Linux 2023 Type t2

### Reproduction steps

1. Create a pipeline having 2+ git params
2. Say param BRANCH_A points to auto-skoda repo specify useRepository auto-skoda
3. Say param BRANCH_B points to auto-toyota repo specify useRepository auto-toyota
4. Use Jenkinsfile from repo auto-skoda
5. See the params loaded in BRANCH_B

### Expected Results

When useRepository is set to a valid Git repository URL, the plugin should fetch and display branches from that repository, even if the job’s primary SCM is configured with a different repository.

### Actual Results

It's failed to load list of branches present in repo auto-toyota, shows only default passed branch
Error in redcolour on console

The default value has been returned
No Git repository configured in SCM configuration or plugin is configured wrong
Option 'Use repository' is set as: 'ssh://git@stash.abcde.com:099/london/auto-toyota.git'
Please check the configuration

### Anything else?

_No response_

### Are you interested in contributing a fix?

_No response_

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.