在 Bitbucket Pipeline 中,可以通过使用关键字 depends
来定义在另一个步骤完成后才开始执行当前步骤。例如:
pipelines:
default:
- step:
name: Build and Test
script:
- npm install
- npm run build
- npm run test
- step:
name: Deploy to Production
script:
- echo "Deploying to production..."
depends:
- Build and Test
在这个示例中,第二个步骤 Deploy to Production
依赖于前一个步骤 Build and Test
。只有在前一个步骤完成之后,才会开始执行第二个步骤。
通过 depends
关键字的方式,Bitbucket Pipeline 在运行时可以知道前一个步骤已经结束,并且开始下一个步骤。