首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从不同的天蓝色存储库执行代码?

如何从不同的天蓝色存储库执行代码?
EN

Stack Overflow用户
提问于 2022-04-05 12:40:04
回答 1查看 34关注 0票数 0

我是Azure DevOps的新手,希望从两个不同的存储库执行代码,并对每个回购程序执行不同的操作,例如:

代码语言:javascript
复制
Stages:
  - stage: Data_Setup
    jobs:
      - job: Data_Setup  // Want to perform this operation on repo1
        timeoutInMinutes: 120
        pool:
          vmImage: ubuntu-20.04
        continueOnError: true
        steps:
          - task: Gradle@2
            inputs:
              gradleWrapperFile: gradlew
              tasks: cleanReports test aggregate
            env:
              SYSTEM_ACCESSTOKEN: $(System.AccessToken)
  - stage: Run_all_regression_tests     // Want to perform this operation on repo2
    jobs:
      - job: Run_all_regression_tests     
        timeoutInMinutes: 100
        pool:
          vmImage: ubuntu-20.04
        continueOnError: true
        steps:
          - task: Gradle@2
            inputs:
              gradleWrapperFile: gradlew
              tasks: cleanReports createJar test aggregate
            env:
              SYSTEM_ACCESSTOKEN: $(System.AccessToken)
EN

回答 1

Stack Overflow用户

发布于 2022-04-05 13:07:03

添加了多个存储库,

代码语言:javascript
复制
  resources:
repositories:

当您想使用特定的存储库时,您可以在步骤中使用“签出”签出,如下所示(从Microsoft文档复制)

代码语言:javascript
复制
resources:
  repositories:
  - repository: MyGitHubRepo # The name used to reference this repository in the checkout step
    type: github
    endpoint: MyGitHubServiceConnection
    name: MyGitHubOrgOrUser/MyGitHubRepo
  - repository: MyBitbucketRepo
    type: bitbucket
    endpoint: MyBitbucketServiceConnection
    name: MyBitbucketOrgOrUser/MyBitbucketRepo
  - repository: MyAzureReposGitRepository # In a different organization
    endpoint: MyAzureReposGitServiceConnection
    type: git
    name: OtherProject/MyAzureReposGitRepo

trigger:
- main

pool:
  vmImage: 'ubuntu-latest'

steps:
- checkout: self
- checkout: MyGitHubRepo
- checkout: MyBitbucketRepo
- checkout: MyAzureReposGitRepository

- script: dir $(Build.SourcesDirectory)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71751962

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档