Jenkins Git分支变量未正确替换为值

Jenkins Git分支变量未正确替换为值,git,jenkins,Git,Jenkins,我目前在Jenkins上的构建方面遇到了麻烦,更具体地说是Git插件与参数的结合,但只是在特定的工作上 我有一份Jenkins的工作,负责构建我们软件的发布版本。该软件位于Git中一个名为“release/”的分支上,例如release/06.03。因为可以有多个版本,所以我有一个属性文件,其中定义了可能的发布git分支,并使用Extented Choice参数创建了single select下拉框 用户选择一个发布分支选项并输入修补程序版本号,然后可以生成作业。这个完全相同的设置适用于我们的其

我目前在Jenkins上的构建方面遇到了麻烦,更具体地说是Git插件与参数的结合,但只是在特定的工作上

我有一份Jenkins的工作,负责构建我们软件的发布版本。该软件位于Git中一个名为“release/”的分支上,例如release/06.03。因为可以有多个版本,所以我有一个属性文件,其中定义了可能的发布git分支,并使用Extented Choice参数创建了single select下拉框

用户选择一个发布分支选项并输入修补程序版本号,然后可以生成作业。这个完全相同的设置适用于我们的其他发布作业,我使用完全相同的设置和相同的属性文件。除了一份工作

调试过程中的第一步是Windows批处理命令,我在其中回显%release\u branch%变量

然后我使用$release\u branch变量从Git中签出代码。我已从下面的屏幕截图中删除了敏感信息,并填写了正确的存储库和凭据

签出存储库后,将启动groovy脚本,其中其他参数将根据签出的软件确定

现在,当我执行此任务并检查日志时,发生了一些奇怪的事情,我再次替换了一些敏感信息:

客户名称已替换为 代理URL已替换为 git URL已替换为.git 敏感信息已得到确认,并且肯定有效:

以下詹金斯日志来自出错的工作 然后在groovy脚本中,第一个$release_分支再次被值替换,因此它两次显示release/06.03

-- Branch: refs/heads/release/06.03/release/06.03
我不知道为什么参数没有正确替换,为什么我没有看到其他日志中的术语“origin”,因为我只定义了一个远程git服务器,我希望如下所示

以下Jenkins日志来自其他一个正常工作的作业 有人知道到底出了什么问题以及如何解决问题吗

亲切问候,, 瑞克

我正在运行以下最新版本:

詹金斯:1.597 Git插件:2.3.4 Git参数插件:0.4.0' 扩展选择参数插件:0.34
在Branchs to build字段中,用大括号括住参数,使其看起来像'refs/heads/${release_branch}。这也包括Windows。

我的设置不如OP复杂,但我在Windows上使用一个build参数来捕获用户想要构建的分支,并将其传递给要构建的分支。控制台输出显示传递给git rev parse的环境变量名的文本值,而不是用户提供的值。
D:\Program Files (x86)\Git\bin\git.exe rev-parse "refs/remotes/refs/heads/$release_branch/release/06.03^{commit}" #timeout=10
D:\Program Files (x86)\Git\bin\git.exe rev-parse "refs/remotes/refs/heads/$release_branch/refs/heads/release/06.03^{commit}"
# timeout=10 Checking out Revision 64e002379c30c545cbf05e6c062df2a78990cb1e
(refs/remotes/refs/heads/$release_branch/release/06.03)
-- Branch: refs/heads/release/06.03/release/06.03
[EnvInject] - Loading node environment variables.
Building in workspace D:/Jenkins/builds/git/repositories/<customer 2>
Wiping out workspace first.
Cloning the remote Git repository
Cloning repository <git repository url 2>.git
 > D:\Program Files (x86)\Git\bin\git.exe init D:\Jenkins\builds\git\repositories\<customer 2># timeout=10
Fetching upstream changes from <git repository url 2>.git
 > D:\Program Files (x86)\Git\bin\git.exe --version # timeout=10
using .gitcredentials to set credentials
 > D:\Program Files (x86)\Git\bin\git.exe config --local credential.helper store --file=\"C:\Windows\TEMP\git6918391337668560662.credentials\" # timeout=10
Setting http proxy: 10.30.60.218:8080
 > D:\Program Files (x86)\Git\bin\git.exe fetch --tags --progress <git repository url 2>.git +refs/heads/*:refs/remotes/origin/*
 > D:\Program Files (x86)\Git\bin\git.exe config --local --remove-section credential # timeout=10
 > D:\Program Files (x86)\Git\bin\git.exe config remote.origin.url <git repository url 2>.git # timeout=10
 > D:\Program Files (x86)\Git\bin\git.exe config remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
 > D:\Program Files (x86)\Git\bin\git.exe config remote.origin.url <git repository url 2>.git # timeout=10
Fetching upstream changes from <git repository url 2>.git
using .gitcredentials to set credentials
 > D:\Program Files (x86)\Git\bin\git.exe config --local credential.helper store --file=\"C:\Windows\TEMP\git6568474183277604659.credentials\" # timeout=10
Setting http proxy: 10.30.60.218:8080
 > D:\Program Files (x86)\Git\bin\git.exe fetch --tags --progress <git repository url 2>.git +refs/heads/*:refs/remotes/origin/*
 > D:\Program Files (x86)\Git\bin\git.exe config --local --remove-section credential # timeout=10
 > D:\Program Files (x86)\Git\bin\git.exe rev-parse "refs/remotes/origin/release/06.03^{commit}" # timeout=10
 > D:\Program Files (x86)\Git\bin\git.exe rev-parse "refs/remotes/origin/refs/heads/release/06.03^{commit}" # timeout=10
Checking out Revision ed0da50edd4e55e8ea1f5fc3c711d191ad217534 (refs/remotes/origin/release/06.03)
 > D:\Program Files (x86)\Git\bin\git.exe config core.sparsecheckout # timeout=10
 > D:\Program Files (x86)\Git\bin\git.exe checkout -f ed0da50edd4e55e8ea1f5fc3c711d191ad217534
 > D:\Program Files (x86)\Git\bin\git.exe rev-list 6d3be94009a76663e3efec2daa72dff2754ccab6 # timeout=10
Notified Stash for commit with id ed0da50edd4e55e8ea1f5fc3c711d191ad217534
==============================
[-- STARTING GROOVY SCRIPT --]
==============================
Based on the git branch and client the Jenkins parameters will be determined and set.
-- Branch: origin/release/06.03