1、如果是jenkins初始时应用,也就是未装置对应的参数化插件,能够设置公共变量
2、装置好插件Active Choices当前,此插件就是用来配置job内变量用的
如果是在window上来援用变量则用%%,在linux上就用${}
%merchant%
liniux:
${merchant}
在执行Python脚本或其余脚本中援用即可
在执行Python脚本援用前,首先要在代码中引入argparse
import argparse
用来传参数用的
parser = argparse.ArgumentParser(description='manual to this script')
parser.add_argument("--merchant", type=str, default="0")
args = parser.parse_args()
--merchant就是
python Data.py --merchant 10,31
来援用参数,我此处是默认如果没有传参数应用一个列表,传参数的时候,更换列表的值,因为我这边要传一个列表,参数只会认为其是一个字符串,所以我在此处进行字符串宰割,在传入列表中,进行应用: