在Jenkins的Promoted Build Plugin中参数化批准者详细信息 [英] Parameterize the approver detail in Promoted Build Plugin in Jenkins

查看:280
本文介绍了在Jenkins的Promoted Build Plugin中参数化批准者详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Jenkins中使用Promote Build插件. 我需要从Jenkins的用户那里获得批准者信息,并向他提供批准权. 这是我想做的事情:

I am using Promote Build plugin in Jenkins . I need to take the approver information from the user in Jenkins and provide him the approval rights . Here is what I am trying to do :

可行吗?

推荐答案

不要认为您可以在其中使用变量.但是,您可以跳过该条件,而是执行 Execute Shell 构建步骤,然后在其中检查变量$PROMOTED_USER_NAME.解析名称,并据此做出决定.

Don't think you can use variables there. However, you could skip that condition, and instead have an Execute Shell build step, and there check for variables $PROMOTED_USER_NAME. Parse the name, and make your decision based on that.

父参数不会自动传递给Promoted构建.但是,您可以将它们导出到文件,归档文件(与归档相对,而不是将其保存在工作区中很重要),在升级步骤中移入文件,然后使用

Parent parameters don't automatically get passed to Promoted builds. However, you can export them to file, archive the file (important to archive as opposed to keep it in workspace), bring the file over in the promotion step, and either load it to environment variables with EnvInject plugin, or simply use the file as is in a script

在父级上工作

  • 配置参数approverid
  • 使用以下内容进行 Execute Shell 构建步骤:
    echo approverid=$approverid > myfile
  • 最后,请确保存档 myfile
  • Configure parameter approverid
  • Have an Execute Shell build step with the following:
    echo approverid=$approverid > myfile
  • At the end, make sure to Archive myfile

关于促销配置

  • 跳过批准标准
  • 添加 从另一个项目复制工件 步骤
  • 对于项目名称,请使用$PROMOTED_JOB_NAME
  • 对于哪个版本,请使用特定版本,然后提供$PROMOTED_NUMBER
  • 要复制的工件,请使用myfile
  • 添加 注入环境变量 构建步骤
  • 对于属性文件路径,输入myfile
  • 添加执行Shell 构建步骤
  • 在该外壳中,比较$approverid$PROMOTED_USER_NAME
  • 的值
  • 如果它们匹配,请继续,否则终止/退出升级.
  • Skip the approval criteria
  • Add Copy Artifacts from another project step
  • For Project Name, use $PROMOTED_JOB_NAME
  • For Which build, use Specific Build, then provide $PROMOTED_NUMBER
  • For Artifacts to copy, use myfile
  • Add Inject Environment Variables build step
  • For Properties File Path, enter myfile
  • Add Execute Shell build step
  • In that shell, compare values of $approverid and $PROMOTED_USER_NAME
  • If they match, continue, else abort/exit promotion.

或者,当然,将记录执行(和中止)的历史记录.

Or course, the history of execution (and abort) will be noted however.

这篇关于在Jenkins的Promoted Build Plugin中参数化批准者详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆