Azure 管道使用位于子目录中的 azure-pipelines.yml

问题描述 投票:0回答:1

我有一个名为 comp_rep_qt 的 git 存储库,它使用 git 覆盖机制并克隆另一个存储库。

- comp_rep_qt
    azure-pipelines.yml

触发管道时,azure-pipelines.yml 具有用于克隆另一个存储库的脚本。

- comp_rep_qt
    azure-pipelines.yml
    execution (Note: another repo that is cloned using gitoverlay )
      - azure-pipelines.yml

请建议如何在

azure-pipelines.yml
存储库的
execution
azure-pipelines.yml
文件夹中触发
comp_rep_qt

azure-devops azure-pipelines-yaml azure-pipelines-build-task azure-pipelines-tasks
1个回答
0
投票
管道运行时,不支持引用其他YAML文件中的步骤来运行。

如果您想重用另一个存储库中另一个 YAML 文件中定义的阶段/作业/步骤,我建议您尝试

存储库资源模板

  1. 步骤重复使用。

    # Repository: repoB # YAML file: stepTemplate.yml steps: - step1 - step2
    # Repository: repoA
    # YAML file: azure-pipelines.yml
    
    resources:
      repositories:
      - repository: resRepo
        type: git
        name: repoB
        ref: main
    
    . . .
    steps:
    - stepA
    - template: stepTemplate.yml@resRepo
    - stepB
    
    通过上述配置,

    azure-pipelines.yml

    中的管道(repoA
    )将在同一作业中顺序执行以下步骤。

    - stepA - step1 - step2 - stepB
    
    
  2. 工作重用。

    # Repository: repoB # YAML file: jobTemplate.yml jobs: - job1 - job2
    # Repository: repoA
    # YAML file: azure-pipelines.yml
    
    resources:
      repositories:
      - repository: resRepo
        type: git
        name: repoB
        ref: main
    
    . . .
    jobs:
    - jobA
    - template: jobTemplate.yml@resRepo
    - jobB
    
    通过上述配置,

    azure-pipelines.yml

    中的管道(repoA
    )将执行以下作业。

    - jobA - job1 - job2 - jobB
    
    
  3. 舞台再利用。

    # Repository: repoB # YAML file: stageTemplate.yml stages: - stage1 - stage2
    # Repository: repoA
    # YAML file: azure-pipelines.yml
    
    resources:
      repositories:
      - repository: resRepo
        type: git
        name: repoB
        ref: main
    
    . . .
    stages:
    - stageA
    - template: stageTemplate.yml@resRepo
    - stageB
    
    通过上述配置,

    azure-pipelines.yml

    中的管道(repoA
    )将执行以下阶段。

    - stageA - stage1 - stage2 - stageB
    
    

© www.soinside.com 2019 - 2024. All rights reserved.