jenkinsci / templating-engine-plugin

create tool-agnostic, templated pipelines to be shared by multiple teams
https://jenkinsci.github.io/templating-engine-plugin/latest/
Apache License 2.0
171 stars 59 forks source link

[Bug]: "Branch Specifier" can not be specified by an environment variable as dokumented #314

Open brosmar opened 1 year ago

brosmar commented 1 year ago

Jenkins Version

CloudBees CI Client Controller 2.375.1.1-rolling

JTE Version

2.5.3

Bug Description

When configuring a Jenkins job to use the JTE "From SCM/Git" the "Branch Specifier" is specifying the Branch to use. In help information it says:

${ENV_VARIABLE}
It is also possible to use environment variables. In this case the variables are evaluated and the result is used as described above.
E.g. ${TREEISH}, refs/tags/${TAGNAME}, ...   

But when using as described the Variable Names are not substituted by their values.

Relevant log output

Started by user xyz
[JTE] Obtained Pipeline Configuration File (show)
[JTE] Pipeline Configuration Modifications (show)
hudson.plugins.git.GitException: Command "git fetch --tags --force --progress --prune -- origin +refs/heads/"${MY_GIT_BRANCH}":refs/remotes/origin/"${MY_GIT_BRANCH}"" returned status code 128:
stdout: 
stderr: fatal: couldn't find remote ref refs/heads/"${MY_GIT_BRANCH}"

Steps to Reproduce

Easy to reproduce. Enter an Environment Variable at the "Branch Speifier"

brosmar commented 1 year ago

I found that this "Feature" was discussed in Issue: https://github.com/jenkinsci/templating-engine-plugin/issues/165

I think there is an update for the issue: https://issues.jenkins.io/browse/JENKINS-60630

brosmar commented 1 year ago

I have installed the git-5.0.0 Plugin and the Pipeline: groovy plugin 3520.va_8fc49e2f96f. But the behaviour did not change.

What is missing?

imaldonado1 commented 1 year ago

Any new about this case? Same problem here.