gitlab-ci:当众多其他工作之一或完成时,如何经营工作

发布于 2025-01-20 22:35:50 字数 730 浏览 2 评论 0原文

我需要设置一个在完成其他几个作业之一之后开始运行的作业,这些作业都处于同一阶段。

I ve tried to use the keyword "needs" , but i didn't recognize how to tell it to consider the case of "if only one among all job is done"

What i'm looking for , is some way to get it :

if : JOB_A is done OR JOB_BA is done

then : Run JOB_C

JOB_A
  stage: mystage
...

JOB_B
  stage: mystage
...

JOB_C:
  stage: mystage
  variables:
    PLAYBOOK_NAME: myplaybook.yml
    INVENTORY_NAME: myInventory.yml
  needs: [JOB_A or JOB_B]  # THIS is a wrong way to set it i think
  when: manual

Suggestions ??

I need to set a job that starts running after one of several other jobs are done , that are all in the same stage.

I ve tried to use the keyword "needs" , but i didn't recognize how to tell it to consider the case of "if only one among all job is done"

What i'm looking for , is some way to get it :

if : JOB_A is done OR JOB_BA is done

then : Run JOB_C

JOB_A
  stage: mystage
...

JOB_B
  stage: mystage
...

JOB_C:
  stage: mystage
  variables:
    PLAYBOOK_NAME: myplaybook.yml
    INVENTORY_NAME: myInventory.yml
  needs: [JOB_A or JOB_B]  # THIS is a wrong way to set it i think
  when: manual

Suggestions ??

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

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

发布评论

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

评论(1

亽野灬性zι浪 2025-01-27 22:35:50

在您描述的用例中,需要手动运行所需的作业,因此只有在运行它们时才添加到管道中,因此您应该能够将需求与可选集合为true的需求,如在这里需要以这种方式需要所有作业。

我不得不说,在手动工作之后,我对自动化工作的需求并不相信。在我看来,通过使用环境变量,可以将几项手动作业重构,但我们没有足够的信息来帮助您进行此设计。

In the use case you describe, the needed jobs are manually run and so are only added to the pipeline when you run them, so you should be able to use needs with optional set to true as described in the doc here needing all the jobs this way could fit your use case.

I have to say I'm not convinced by the need of automating jobs after with manual jobs. It seems to me the several manual jobs could be refactored in one with the use of environment variables, but we don't have enough info to help you on this design.

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