Jenkins计划的构建触发器是否具有环境变量? [英] Jenkins scheduled build Triggers with environment variable?
问题描述
我想用jenkins中的环境变量定期构建:
I want to build periodically with environment variable in jenkins:
#pseudo setting
H 17 * * * BUILD_FOR=gist-mail TOKEN_GIST_MAIL=some_token
H 17 * * * BUILD_FOR=pollyanna TOKEN_POLLYANNA=anothor_token
H 17 * * * BUILD_FOR=fenix-knight TOKEN_FENIX_KNIGHT=alternative_token
这些变量不会动态更改(预先给定).
These variables do not change dynamically, given in advance.
我在下面看到一个错误:
I got a error below:
Invalid input: "10 17 * * * BUILD_FOR=fenix-knight": line 1:12: expecting EOF, found ' '
如何将不同的环境变量传递给每个构建触发器?我的解决方法是创建每个职位.
How do I pass different environment variable to each build trigger? My work around is create each jobs.
我正在执行的外壳程序如下:
My executing shell below:
gem install bundler
ruby -i -pe '$_.gsub! /^ruby/, "#ruby"' Gemfile
bundle
BUILD_FOR=fenix-knight bundle exec rake tachikoma:load tachikoma:fetch tachikoma:bundle tachikoma:pull_request
推荐答案
There is a parameterized build plugin for your situation Jenkins - triggering a parameterized build has a good demonstration of how to use it and also another plugin to show the parameters which went into it.
您还可以查看multijob插件 https://wiki.jenkins -ci.org/display/JENKINS/Multijob+Plugin 使用单独的参数运行一个基础作业
You could also look at the multijob plugin https://wiki.jenkins-ci.org/display/JENKINS/Multijob+Plugin to run one underlying job with separate parameters
这篇关于Jenkins计划的构建触发器是否具有环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!