[英]Jobs in azure depending on jobs from other stages (inside templates)
從.gitlab-ci.yml
遷移到azure-pipelines.yml
。 在.gitlab-ci.yml
中,我有一個場景,其中一個作業(在部署階段)需要另外兩個作業(來自測試階段)來執行
.deploy
stage: deploy
needs:
- testmethod1
- testmethod2
deployPROD:
extends: .deploy
轉到 azure 上下文,我在我的存儲庫中創建了一個模板文件夾,其中包含測試文件只是為了復制這個場景。
我的azure-pipelines.yml
文件如下所示:
trigger:
- azure-pipelines
pool:
vmImage: ubuntu-latest
jobs:
- job: InitialA
steps:
- script: echo hello from initial A
- job: InitialB
steps:
- script: echo hello from initial B
- job: Subsequent
dependsOn:
- templates/test1.yml/testme
steps:
- script: echo hello from subsequent
我使用了dependsOn
鍵來顯示依賴的作業。 現在 repo 的結構以及模板文件如下所示:
但我最終得到以下錯誤:
那么我的方法正確嗎? 我在 azure 中使用了正確的關鍵字嗎? 如果是,我需要在dependsOn
鍵中考慮的路徑是什么?
歡迎提出建議。
您可以添加模板作業,后續作業可以dependsOn
於模板作業。 Azure Pipeline 中的更多模板用法請參閱模板類型和用法。 代碼示例:
trigger:
- none
pool:
vmImage: ubuntu-latest
jobs:
- job: InitialA
steps:
- script: echo hello from initial A
- job: InitialB
steps:
- script: echo hello from initial B
- job: templates
steps:
- template: test.yml # Template reference
- job: Subsequent
dependsOn: templates
steps:
- script: echo hello from subsequent
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.