Docker Bitbucket管道步骤是否连续运行?
我正在学习docker和bitbucket管道,所以请提前原谅我的noob问题。管道中的步骤是否连续运行? 例如:Docker Bitbucket管道步骤是否连续运行?,docker,bitbucket-pipelines,Docker,Bitbucket Pipelines,我正在学习docker和bitbucket管道,所以请提前原谅我的noob问题。管道中的步骤是否连续运行? 例如: image: name: my-imge:and-version pipelines: default: - step: name: first script: - echo 'something' >> my_file.txt - step: name: second
image:
name: my-imge:and-version
pipelines:
default:
- step:
name: first
script:
- echo 'something' >> my_file.txt
- step:
name: second
script:
- cat my_file.txt
假设我的docker容器中不存在my_file.txt
第二步是通过还是失败?是,步骤按顺序运行 仅当第一步成功完成时,第二步才会运行
如果需要,还可以并行运行步骤 是,步骤按顺序运行。如果一个步骤通过,下一个步骤将开始执行 但在这种情况下,你的第二步将失败 每个步骤都在自己的Docker容器中运行。没有任何状态会自动通过。您需要自己配置它 例如,如果您希望第二步能够访问“my_file.txt”,则需要将其定义为 使您的脚本在上面通过。您可以使用如下配置:
image:
name: my-imge:and-version
pipelines:
default:
- step:
name: first
artifacts:
- *.txt # Copy found .txt files into *all* sebsequent steps.
script:
- echo 'something' >> my_file.txt
- step:
name: second
script:
- cat my_file.txt # my_file.txt has been copied from step 1 as an artifact.
或者,将两个命令放在一个步骤中
image:
name: my-imge:and-version
pipelines:
default:
- step:
name: first and second combined
script:
- echo 'something' >> my_file.txt
- cat my_file.txt
但是第二个会正确运行吗?即使第一个通过?是的,它也会通过,因为文件是在第一步创建的。