(Jenkins newb-newb-newbie here)你好。 我有一个部署在Jenkins上的Maven项目。 在这个项目中,我有一个集成测试,它依赖于.Net服务器才能正确运行。
问题是,当我试图在Jenkins上构建我的项目时,集成测试失败了,因为.Net没有启动...
我需要在构建项目之前执行shell脚本(用于启动.Net服务器)。 所以我的问题是:如何在从Jenkins构建之前启动我的项目脚本?
(Jenkins newb-newb-newbie here) Hi there. I have a Maven project, deployed on Jenkins . In this project, I have an integration test, which depends on a .Net server in order to be run correctly.
The problem is, when I'm trying to build my project on Jenkins, the integration test fails, because the .Net isn't launched...
I need to execute a shell script (for launhing the .Net server) before building my project. So my question is : how can I launch a script of my project before building from Jenkins?
最满意答案
这是一个构建步骤执行Windows批处理命令 ,您可以使用它来启动您的服务器。
您可能必须使用START才能在单独的进程中启动它,因此您的构建将继续,而无需等待服务器进程完成,并且您可能需要延迟一些以防服务器需要一些时间来解决,然后才能进行测试跑。
您可能还需要在测试完成后taskkill服务器,您可以在另一个执行Windows批处理命令构建步骤中使用tasklist和taskkill ,以及执行此操作的一些批处理魔法。
Theres a build step Execute Windows batch command which you could use to start your server.
You might have to use START to have it launched in a separate process, so your build continues without waiting for the server process to finish, and you might need to put in some delay in case your server needs some time to settle before your tests can run.
You might also need to kill your server after your tests are done, you might be able to use tasklistand taskkill in another Execute Windows batch command build step, and some batch magic to do this.
更多推荐
发布评论