美文网首页
jenkins实现tag构建传入变量不生效的情况解决

jenkins实现tag构建传入变量不生效的情况解决

作者: 蓝猫大哥丶 | 来源:发表于2021-01-18 14:50 被阅读0次

下面是设置了之后及报错的信息的截图:


参数化构建传入变量.png
git插件引用变量.png
报错信息.png

报错信息:

hudson.plugins.git.GitException: Command "git fetch --tags --progress --prune -- origin +refs/heads/${Build_on_tag}:refs/remotes/origin/${Build_on_tag}" returned status code 128:
stdout: 
stderr: fatal: Couldn't find remote ref refs/heads/${Build_on_tag}

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2430)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2044)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:81)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:569)
    at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:361)
    at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:197)
    at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:173)
    at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:115)
    at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:69)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:309)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:427)
Finished: FAILURE

原因是在checkout代码的时候根本没有解析变量,解决办法:


解决办法.png

轻量级检出 取消勾选后成功!!

参考链接:https://www.codeleading.com/article/6691734836/
这篇文章太给力了!

相关文章

网友评论

      本文标题:jenkins实现tag构建传入变量不生效的情况解决

      本文链接:https://www.haomeiwen.com/subject/rzcxzktx.html