如何在 Jenkins 中构建工作管道?

发布于 2024-12-06 10:00:56 字数 838 浏览 7 评论 0原文

在我的项目中,我有 3 个 Web 应用程序,全部依赖于一个 all-commons 项目。

在我的 Jenkins 服务器中,我构建了 4 个作业:all-commons_RELEASEweb-A_RELEASEweb-B_RELEASEweb-C_RELEASE< /代码>。 这些作业的作用是构建部署在我们的 Nexus 上的工件。然后,有人在 Nexus 中检索这些工件并将其部署到我们的开发/认证服务器上。

我想要的是有一个(额外的?)工作,它将按顺序启动所有 4 个版本。 这样,一旦该作业完成,所有 RELEASE 作业都已执行。 当然,如果一次构建失败,该过程就会停止。

我的第一个想法是在 all-commons_RELEASE 的构建后操作构建其他项目列表中指示web-A_RELEASE。 然后,web-B_RELEASE 依赖于 web-A_RELEASE,依此类推。

但是,我希望能够单独启动其中任何一个,如果我指示对项目的依赖性,这是不可能的。例如,如果我手动启动 web-B_RELEASE,那么之后将构建 web-C_RELEASE,这不是我想要的......

你知道怎么做吗我可以实现这一点,或者有一个插件可以帮助我做到这一点?

问候。

ps:Jenkins 1.430,所有 RELEASE 作业都是自由风格的项目(它们混合了 Maven 和 bash 命令)。

In my project, I have 3 web-applications, all depend on one all-commons project.

In my Jenkins server, I built 4 jobs, all-commons_RELEASE, web-A_RELEASE, web-B_RELEASE and web-C_RELEASE.
The role of these jobs is to build the artifacts, which are deployed on our Nexus. Then, someone retrieve these artifacts in Nexus and deploy them on our dev / homologation servers.

What I want, is to have one (additional?) job that will launch all the 4 builds, in a sequential way.
This way, once this job is finished, all the RELEASE jobs have been executed.
Of course, if one build fails, the process is stopped.

My first thought was to indicate the web-A_RELEASE in the Build other projects list of the Post-build Actions of all-commons_RELEASE.
Then, web-B_RELEASE is dependent on web-A_RELEASE, and so on.

However, I want to be able to start any of them separately, which is not possible if I indicate a dependency on the projects. For example, if I manually start web-B_RELEASE, then web-C_RELEASE will be built after that, which is not what I want...

Do you have any idea how I can achieve that, or a plugin to help me to do that?

Regards.

ps: Jenkins 1.430, and all RELEASE jobs are free-style projects (they mix Maven and bash commands).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

失去的东西太少 2024-12-13 10:00:56

也许您可以使用参数化触发器插件

使用该插件,您可以将触发器设置为“管道”作业中的构建步骤。有一个复选框“阻止直到触发的作业完成”,您需要激活该复选框。您可以简单地将三个作业配置为以这种方式触发,并且只有在运行这个新的管道作业时才会发生触发,因此运行其他作业而不触发任何内容都可以正常工作。

这应该正是您所需要的。

Perhaps you could use the Parametrized Trigger Plugin?

Using the plugin you can set the trigger as a build step in your "Pipeline" Job. There is a checkbox "Block until triggered job is finished", which you need to activate. You could simply configure your three jobs to be triggered this way, and the triggering would only occur if you run this new Pipeline Job, so running the other jobs without triggering anything would work fine.

This should be exactly what you need.

雅心素梦 2024-12-13 10:00:56

不知道您是否已经找到答案,但对于其他好奇的人:

您可以创建另一个作业 build_all,然后将其他每个构建作为构建步骤触发。

对于build_all,您想要的设置如下所示,每个构建步骤都是“触发/调用在其他项目上构建”

  • 构建步骤 1:all-commons_RELEASE
  • 构建步骤 2:web-A_RELEASE
  • 构建步骤3:web-B_RELEASE
  • 构建步骤 4:web-C_RELEASE

确保选中“阻止直到触发的项目完成其构建”选项,以确保构建按顺序发生。

Don't know if you've found your answer yet, but for others who are curious:

You can create another job build_all, and then have each of the other builds triggered as build steps.

The setup you'd want would look like this for build_all, with each build step being "Trigger/Call builds on other projects"

  • Build Step 1 : all-commons_RELEASE
  • Build Step 2 : web-A_RELEASE
  • Build Step 3 : web-B_RELEASE
  • Build Step 4 : web-C_RELEASE

Make sure you check the "Block until the triggered projects finish their builds" option to ensure the builds happen sequentially.

又怨 2024-12-13 10:00:56

试试这个

Build Flow 插件

您可以按顺序运行或构建您的作业像这样 :

build("job1")
build("job2")
.
.
build("job-n")

Try this

Build Flow plugin

you can sequentially run or build your job like this :

build("job1")
build("job2")
.
.
build("job-n")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文