我想要完成的是从 develop
分支签出代码,将其合并到 master
分支,构建 app.war
,运行测试如果测试成功,则推送到 master
分支.
测试应该在需要 app.war
的单独作业中运行.
我目前的设置如下:
Main
从 develop
签出,合并到 master
并构建 app.war
Main
在Post build step 中触发job Test
(Test
需要app.war
以前构建的)Test
成功,Main
推送到 Post build actionmaster
分支我尝试使用 Copy Artifact Plugin,但问题是使用它时,我只能在触发 Test<时在 Post build action 中存档工件/code> 在构建后步骤.
如何将 app.war
传递给 Test
作业?是否可以使用 Copy Artifact Plugin?
您可以在其周围放置一个包装作业,并通过在其他项目上使用触发/调用构建,将构建作业和测试作业称为构建步骤.由于构建现在被封装在自己的作业中,您可以归档其工件并将它们复制到 Test
作业.
另一种方法是在构建和测试之间共享一个工作区.
将文件传递给下游作业的一种巧妙方法是,在
注意:您的下游作业确实不需要需要设置选项This build is parameterized,文件将被复制.这可能不再有效,请参阅评论.
What I want to accomplish is to checkout code from develop
branch, merge it to master
branch, build app.war
, run tests and if tests succeed push to master
branch.
Tests should be run in separate job which needs app.war
.
My current setup is as follows:
Main
checks out from develop
, merges it to master
and builds app.war
Main
triggers job Test
in Post build step (Test
needs app.war
previously built)Test
succeeds, Main
pushes to master
branch in Post build actionI tried to use Copy Artifact Plugin but the problem is that with it, I can only archive artifact in Post build action while I am triggering Test
in Post build step.
How to pass app.war
to Test
job? Is it possible to do with Copy Artifact Plugin?
You can put a wrapper job around it and have the Build job and the Test job called as build step by using Trigger/call builds on other projects. Since the build is encapsuled in its own job now, you can archive its artifacts and copy them over to the Test
job.
Another way would be to just share a workspace between build and test.
A neat way to pass a file to a downstream job is, to pass it as parameter with the help of the Parameterized Trigger Plugin.
You push a file into your downstream job's workspace simply by selecting the parameter factory For every matching file, invoke one build in a build step Trigger/call builds on other projects. There you specify the target file (wildcards allowed) and the name it should get in the child workspace.
Note: Your downstream job does not need to have the option This build is parameterized set, the file will be copied either way. Edit: This might not work anymore, see comments.
这篇关于如何将文件传递给阻止上游作业的下游作业?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!