Skip to content

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

@bshiwanand

Description

@bshiwanand

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions