[JENKINS-71742] Git fetch when pulling pod template fails when the "Branch Specifier" is an env var
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
thnguyen:
- Original comment link
Raw content of original comment:
Hi markewaite, is there any additional information I can provide to help with this? Thanks!
Hi markewaite, is there any additional information I can provide to help with this? Thanks!
markewaite:
- Original comment link
Raw content of original comment:
thnguyen I don't plan to investigate this. I don't have easy access to a Kubernetes cluster with a YAML template. I assume the issue is in the kubernetes plugin rather than in the git plugin, but I'm not planning to investigate that in order to confirm my theory.
thnguyen I don't plan to investigate this. I don't have easy access to a Kubernetes cluster with a YAML template. I assume the issue is in the kubernetes plugin rather than in the git plugin, but I'm not planning to investigate that in order to confirm my theory.
snup67:
- Original comment link
Raw content of original comment:
This bug is not related to Kubernetes. It related to jenkins job itself that not inherit the parameter value to Branch specifier and result of that is the git fetch command that uses ${BRANCH) as string instead of the value parameter.
See the git fetch command in the Screenshot with the log snapshot that uploaded here
I'm also facing that behave.
This bug is not related to Kubernetes.
It related to jenkins job itself that not inherit the parameter value to Branch specifier and result of that is the git fetch command that uses ${BRANCH) as string instead of the value parameter.
See the git fetch command in the Screenshot with the log snapshot that uploaded here
I'm also facing that behave.




