[英]Passing parameterized build parameter to Jython plugin in Jenkins
I need to 我需要
In a shell script build step params can easily be accessed using env variables. 在shell脚本构建步骤中,可以使用env变量轻松访问参数。 Do I have to do the same in Jython?
我在Jython是否必须做同样的事情? (can I do it at all)?
(我完全可以这样做)吗?
I'm not sure about how you can access the variable from Parameterized parameter in Execute Jython script
in Build
section but if i run the Jython script in Windows (after selecting Execute Windows batch command
option from the dropdown list in Build
section), it works fine. 我不确定如何从
Build
部分的Execute Jython script
中的Parameterized参数访问变量,但是如果我在Windows中运行Jython脚本(在Build
部分的下拉列表中选择Execute Windows batch command
选项之后),它可以工作精细。 Check the snapshots below where i have used Parameterized Trigger Plugin for creating a String Parameter and then using the same in Jython script. 检查下面的快照,在这些快照中,我使用了参数化触发器插件来创建字符串参数 ,然后在Jython脚本中使用了它们。 It works fine and displays the value of the variable in output.
它工作正常,并在输出中显示变量的值。
Here's the sample script i used for accepting parameter: 这是我用于接受参数的示例脚本:
import sys
for arg in sys.argv:
print arg
For *nix environment, you obviously have to select Execute shell
in Build
section's dropdown list and also change %var%
to $var
. 对于* nix环境,您显然必须在
Build
部分的下拉列表中选择Execute shell
,并将%var%
更改为$var
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.