How do I trigger another job from hudson as a pre-build step?
我如何从hudson中触发另一个任务,作为一个预构建步骤?
4 个解决方案
#1
74
There is a Parameterized Trigger Plugin, which enables "Trigger/call builds on other projects" in "Add build step" menu.
有一个参数化的触发器插件,可以在“添加构建步骤”菜单中启用“触发器/调用构建其他项目”。
#2
10
You can use the plugin at http://wiki.jenkins-ci.org/display/JENKINS/Join+Plugin
你可以在http://wiki.jenkins-ci.org/display/JENKINS/Join+插件中使用这个插件。
Basically you create 3 jobs:
基本上你创造了3个工作:
A = your prebuild ste
A =你的预建ste。
B = your main job
B =你的主要工作。
C = your trigger.
C =你的触发器。
You 'build' C. It calls A, and once A is successful, it calls B. The plugin page gives you more information. The good thing about this plugin is that you can have any number of pre-build jobs.
你“构建”c,它调用A,一旦A成功,它就调用b。插件页面提供更多信息。这个插件的好处是你可以有任何数量的预构建工作。
We actually have a set of 5 pre-build jobs before our main is run.
在我们的main运行之前,我们实际上有一组5个预构建的作业。
================================================
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
If you don't want to try that:
如果你不想尝试:
If you are using Linux, you can do the following from within your "shell" script:
如果您正在使用Linux,您可以从您的“shell”脚本中执行以下操作:
wget http://yourserver/hudson/job/MyJob/build?delay=0sec
This will trigger the job. The bad part about this is that it will not wait for the job to finish.
这将触发工作。最糟糕的是,它不会等待工作完成。
#3
0
I have the same issue and I found a way to do:
我有同样的问题,我找到了一种方法:
I am using jenkins version jenkins-1.452-1.1.
我正在使用jenkins版本的jenkin -1.452-1.1。
Say I have job A and B, and Job A is depending on job B. When building job B, I want A triggered automatically, and B is blocked until A build successfully.
假设我有工作A和B,而工作A依赖于工作B。当构建工作B时,我想要自动触发,B被阻塞,直到成功构建。
When define build configuration in build section, I add 'trigger build on other projects'. then fill the form.
在构建部分中定义构建配置时,我将“触发构建在其他项目上”。然后填充表单。
#4
0
Actually I know how to answer to your question: This is the plug-in that you need:
实际上,我知道如何回答您的问题:这是您需要的插件:
PreBuild
It is not widely famous, but it does what you want.
它不是很出名,但它做你想做的。
It basically runs a Build before your chosen one. For example: You want A to run before B. You click on "run B" it will execute A before running B.
它基本上是在你的选择之前运行一个构建。例如:你想要A在B之前运行。你点击“run B”,它会在运行B之前执行A。
Pro: -> Very versatile -> Easy to use
Pro: ->多功能->易于使用。
Cons: -> No support / Option in case the pre-build fails (e.g. do not build if pre-build fails) -> The development seems not being that active at all.
缺点:->没有支持/选项,以防预构建失败(例如,如果预构建失败,请不要构建)->开发似乎没有那么活跃。
Here you can see how it looks like
在这里你可以看到它是怎样的。
EDIT
编辑
This answer is back from '12, I know you are down-voting it, but back then this was a reliable solution, now I am sure there are other plug-ins that do the job.
这个答案从“12”开始,我知道你在下调它的投票,但在那时这是一个可靠的解决方案,现在我确定还有其他的插件可以完成这项工作。
#1
74
There is a Parameterized Trigger Plugin, which enables "Trigger/call builds on other projects" in "Add build step" menu.
有一个参数化的触发器插件,可以在“添加构建步骤”菜单中启用“触发器/调用构建其他项目”。
#2
10
You can use the plugin at http://wiki.jenkins-ci.org/display/JENKINS/Join+Plugin
你可以在http://wiki.jenkins-ci.org/display/JENKINS/Join+插件中使用这个插件。
Basically you create 3 jobs:
基本上你创造了3个工作:
A = your prebuild ste
A =你的预建ste。
B = your main job
B =你的主要工作。
C = your trigger.
C =你的触发器。
You 'build' C. It calls A, and once A is successful, it calls B. The plugin page gives you more information. The good thing about this plugin is that you can have any number of pre-build jobs.
你“构建”c,它调用A,一旦A成功,它就调用b。插件页面提供更多信息。这个插件的好处是你可以有任何数量的预构建工作。
We actually have a set of 5 pre-build jobs before our main is run.
在我们的main运行之前,我们实际上有一组5个预构建的作业。
================================================
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
If you don't want to try that:
如果你不想尝试:
If you are using Linux, you can do the following from within your "shell" script:
如果您正在使用Linux,您可以从您的“shell”脚本中执行以下操作:
wget http://yourserver/hudson/job/MyJob/build?delay=0sec
This will trigger the job. The bad part about this is that it will not wait for the job to finish.
这将触发工作。最糟糕的是,它不会等待工作完成。
#3
0
I have the same issue and I found a way to do:
我有同样的问题,我找到了一种方法:
I am using jenkins version jenkins-1.452-1.1.
我正在使用jenkins版本的jenkin -1.452-1.1。
Say I have job A and B, and Job A is depending on job B. When building job B, I want A triggered automatically, and B is blocked until A build successfully.
假设我有工作A和B,而工作A依赖于工作B。当构建工作B时,我想要自动触发,B被阻塞,直到成功构建。
When define build configuration in build section, I add 'trigger build on other projects'. then fill the form.
在构建部分中定义构建配置时,我将“触发构建在其他项目上”。然后填充表单。
#4
0
Actually I know how to answer to your question: This is the plug-in that you need:
实际上,我知道如何回答您的问题:这是您需要的插件:
PreBuild
It is not widely famous, but it does what you want.
它不是很出名,但它做你想做的。
It basically runs a Build before your chosen one. For example: You want A to run before B. You click on "run B" it will execute A before running B.
它基本上是在你的选择之前运行一个构建。例如:你想要A在B之前运行。你点击“run B”,它会在运行B之前执行A。
Pro: -> Very versatile -> Easy to use
Pro: ->多功能->易于使用。
Cons: -> No support / Option in case the pre-build fails (e.g. do not build if pre-build fails) -> The development seems not being that active at all.
缺点:->没有支持/选项,以防预构建失败(例如,如果预构建失败,请不要构建)->开发似乎没有那么活跃。
Here you can see how it looks like
在这里你可以看到它是怎样的。
EDIT
编辑
This answer is back from '12, I know you are down-voting it, but back then this was a reliable solution, now I am sure there are other plug-ins that do the job.
这个答案从“12”开始,我知道你在下调它的投票,但在那时这是一个可靠的解决方案,现在我确定还有其他的插件可以完成这项工作。