检索属性文件参数 [英] Retrieve parameters from properties file

查看:135
本文介绍了检索属性文件参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用相同的参数和参数值几个詹金斯参数化的工作。
当我不得不改变这些参数之一的默认值,我需要去在所有这些工作,并对其进行重新配置。

I have several Jenkins parameterized jobs that uses the same parameters and parameters values. When I have to change the default value of one of those parameters, I need to go over all of those jobs and reconfigure them.

有一个简单的解决这个问题将是一个选项,以检索配置文件中的所有参数(在主/工作区),但我无法找到足够的执行这一点。

A simple solution to this problem would be an option to retrieve all parameters from config file (in the master/ in the workspace) but I could not find a sufficient implementation for that.

我希望能够养活建立与标准的Java配置文件 (格式为钥匙=值),然后是指那些参数就像在生成过程中每一个其他参数。

你知道一个合适的解决方案?

Do you know of an appropriate solution?

推荐答案

使用 EnvInject插件读取一个文件作为环境变量您的参数在注入环境变量的生成步骤。该故障是,那么你就不能轻易覆盖它们。一个解决办法是在结合条件BuildStep插件的使用它。然后,您可以可以定义一个布尔参数的覆盖的,这将是的的默认。然后,您可以有条件地运行您的注入的生成步骤,只有当覆盖的是的。当你需要使用手动提供的值来覆盖你的参数(在自定义调用运行作业)指定覆盖值和设定的覆盖的到的真正的。

Use EnvInject Plugin to read your parameters from a file as environment variables in an Inject Environment Variables build step. The glitch is that then you can't override them easily. One solution would be to use it in conjunction with the Conditional BuildStep Plugin. You can then can define a boolean parameter OVERRIDE that would be false by default. You can then run your Inject build step conditionally only when OVERRIDE is false. When you need to override your parameters with values provided by hand (on in a custom call to run the job) specify the override values and set OVERRIDE to true.

这篇关于检索属性文件参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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