简体   繁体   English

无法从jenkins作业生成器传递变量值,默认为groovy脚本

[英]Not able to pass value of variable from jenkins job builder defaults to groovy script

-defaults -defaults

gitreponame: "ipsingh" gitreponame:“ ipsingh”

Job Template 工作范本

  • job-template: 作业模板:

    name: '{name}-unit-test' 名称:“ {name} -unit-test”

    project-type: pipeline 项目类型:管道

    dsl: !include-raw-escape: share.groovy dsl:!include-raw-escape:share.groovy

share.groovy share.groovy

library 'jenkins-pipeline-library@master' 图书馆'jenkins-pipeline-library @ master'

appDeploy { appDeploy {

inder = 'testing' inder ='正在测试'

gitreponame = {gitreponame} } gitreponame = {gitreponame}}

When i check the pipeline script in the jenkins job , gitreponame is not getting replaced with the default value 当我检查jenkins作业中的管道脚本时,gitreponame未被替换为默认值

The reason variables are not being parsed in the groovy script is because of the use of !include-raw-escape . 在groovy脚本中未解析变量的原因是因为使用了!include-raw-escape The escape part tells JJB to not process any variables in the groovy script. escape部分告诉JJB不要处理Groovy脚本中的任何变量。

If you want JJB to process curly brace variables inside the groovy script then you will want to instead use !include-raw without the escape part. 如果您想让JJB在groovy脚本中处理花括号变量,那么您将想使用!include-raw而不使用转义部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM