gpt4 book ai didi

gitlab - 如何使一个阶段依赖于另一个阶段?

转载 作者:行者123 更新时间:2023-12-05 01:28:47 25 4
gpt4 key购买 nike

我有一个如下所示的 YAML 文件。假设 *.md 文件已提交,构建不起作用,但测试有效。在这里我怎样才能让测试依赖于构建?就像构建不工作一样,测试也不应该工作。

提前致谢。

build:
stage: build
script:
- echo "Build is running"
only:
changes:
- Dockerfile
- requirements.txt
- ./configs/*
test:
stage: test
script:
- echo "Test is running"
- echo "$CI_JOB_STAGE"
dependencies:
- build

最佳答案

那应该是什么stages defines

Use stages to define stages that contain groups of jobs.
stages is defined globally for the pipeline.
Use stage in a job to define which stage the job is part of.

The order of the stages items defines the execution order for jobs:

  • Jobs in the same stage run in parallel.
  • Jobs in the next stage run after the jobs from the previous stage complete successfully.

For example:

stages:
- build
- test
- deploy
  • All jobs in build execute in parallel.
  • If all jobs in build succeed, the test jobs execute in parallel.
  • If all jobs in test succeed, the deploy jobs execute in parallel.
  • If all jobs in deploy succeed, the pipeline is marked as passed.

If any job fails, the pipeline is marked as failed and jobs in later stages do not start.
Jobs in the current stage are not stopped and continue to run.

因此,在您的情况下:

stages:
- build
- test
如果 build 失败,

test 将不会运行。

关于gitlab - 如何使一个阶段依赖于另一个阶段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68329054/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com