jenkinsci / jenkinsci/git-plugin

[JENKINS-71742] Git fetch when pulling pod template fails when the "Branch Specifier" is an env var

Open
#3,801 4 comments 1 reaction 0 assignees View on GitHub
component:git-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

I have a pipeline job that takes a branch as a parameter and then passes that value to the `Branch Specifier` like so: `${BRANCH}`.

The git plugin expands the value properly, but I believe that when the kubernetes plugin tries to do another checkout to read the pod template, it doesn't expand the variable and then fails.

 

 

 

Steps to reproduce:

1. Configure a pipeline job with a string parameter called `BRANCH`

2. For the pipeline definition, configure it to use "Pipeline script from SCM"

3. Use the `Git` SCM and configure it to point to your repo



4. `Branches to build` -> `Branch Specifier` - should be set to `${BRANCH}` or whatever your parameter is called



5. Specify your Jenkinsfile path

– Specify the pod template using `yamlFile`

6. `Lightweight checkout` should be unchecked



7. Attempt to build the job

 

Stripped down version of my jenkinsfile: Jenkinsfile

 

---
Originally reported by thnguyen, imported from: Git fetch when pulling pod template fails when the "Branch Specifier" is an env var


  • status: Open
  • priority: Major
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 3
  • imported: 2025-12-02

Raw content of original issue

I have a pipeline job that takes a branch as a parameter and then passes that value to the `Branch Specifier` like so: `${BRANCH}`.

The git plugin expands the value properly, but I believe that when the kubernetes plugin tries to do another checkout to read the pod template, it doesn't expand the variable and then fails.

 

 

 

Steps to reproduce:
1. Configure a pipeline job with a string parameter called `BRANCH`

2. For the pipeline definition, configure it to use "Pipeline script from SCM"
3. Use the `Git` SCM and configure it to point to your repo

4. `Branches to build` -> `Branch Specifier` - should be set to `${BRANCH}` or whatever your parameter is called

5. Specify your Jenkinsfile path
– Specify the pod template using `yamlFile`
6. `Lightweight checkout` should be unchecked

7. Attempt to build the job

 

Stripped down version of my jenkinsfile: Jenkinsfile

 

6 attachments

- [Jenkinsfile](https://issues.jenkins.io/secure/attachment/60920/Jenkinsfile)
- [Screenshot 2023-07-31 at 12.45.38 PM.png](https://issues.jenkins.io/secure/attachment/60919/Screenshot%202023-07-31%20at%2012.45.38%20PM.png)
> ![Screenshot 2023-07-31 at 12.45.38 PM.png](https://issues.jenkins.io/secure/attachment/60919/Screenshot%202023-07-31%20at%2012.45.38%20PM.png)
- [image-2023-07-31-11-33-15-822.png](https://issues.jenkins.io/secure/attachment/60918/image-2023-07-31-11-33-15-822.png)
> ![image-2023-07-31-11-33-15-822.png](https://issues.jenkins.io/secure/attachment/60918/image-2023-07-31-11-33-15-822.png)
- [image-2023-07-31-12-53-13-112.png](https://issues.jenkins.io/secure/attachment/60917/image-2023-07-31-12-53-13-112.png)
> ![image-2023-07-31-12-53-13-112.png](https://issues.jenkins.io/secure/attachment/60917/image-2023-07-31-12-53-13-112.png)
- [image-2023-07-31-12-53-40-884.png](https://issues.jenkins.io/secure/attachment/60916/image-2023-07-31-12-53-40-884.png)
> ![image-2023-07-31-12-53-40-884.png](https://issues.jenkins.io/secure/attachment/60916/image-2023-07-31-12-53-40-884.png)
- [image-2023-07-31-13-08-30-126.png](https://issues.jenkins.io/secure/attachment/60921/image-2023-07-31-13-08-30-126.png)
> ![image-2023-07-31-13-08-30-126.png](https://issues.jenkins.io/secure/attachment/60921/image-2023-07-31-13-08-30-126.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.