在YAML中,在各个阶段之前检出

huangapple go评论57阅读模式
英文:

Checkout before stages in YAML

问题

我正在进行阶段性的检出以下载存储库。

stages:

  • stage: dev
    jobs:

    • deployment: DeploySQLObjects
      displayName: "部署 SQL 对象"
      environment: "Synapse_DEV"
      strategy:
      runOnce:
      deploy:
      steps:
      - checkout: self
  • stage: test
    .......
  • stage: prod
    .......

是否可以在所有阶段之前执行检出,并让所有阶段都使用这个检出?我不太确定如何做。我只看到了没有阶段的步骤示例。

英文:

Im doing a checkout in my stages to download the repo.

stages:
    - stage: dev    
    jobs:
      - deployment: DeploySQLObjects
        displayName: "Deploy SQL objects" 
        environment: "Synapse_DEV"
        strategy:   
          runOnce:
            deploy:
             steps:   
              - checkout: self 
     - stage: test
         .......
     - stage: prod
         .......

Is it possible do to the checkout before all stages and let all stages use this checkout?
Im not quite sure how to do it. Ive only seen examples with steps without stages

答案1

得分: 2

如果您正在使用Azure托管的构建代理,每个作业将使用新的构建实例。在这种情况下,您不能使用一个检出步骤...

如果您正在使用自托管的构建代理,您可以通过git命令将一个检出阶段添加到可共享的文件夹,并在其他作业中使用它。

英文:

If you are using Azure Hosted build agents, each job will use a new build instance. In this case, you can not use one checkout step...

If you are using Self Hosted build agents, you may add one checkout stage to some shareable folder through git commands and use it for other jobs.

huangapple
  • 本文由 发表于 2023年2月10日 14:53:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/75407801.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定