Search code examples
azure-devopsazure-pipelinespipeline

azure pipeline pull dependency projects


I have a project which depends on 2-3 other projects, is there a way to pull them together with the master project?

When the build process starts projects will be on the file system and the master project can locate the other dependency projects?


Solution

  • As @Kehinde's said in comment, what you want could be achieved by the feature Multi-repo checkout.

    Note:

    Multi-repo checkout is the feature which only supported YAML. Because what the design logic is Checkouts from multiple repos in combination with YAML builds enable focusing the source level dependency management to one structured descriptor file in Git (the YAML biuld definition) for good visibility.

    But for pipeline that configured by classic UI, you had to add those other repositories/projects as submodules, or as manual scripts to run git checkout in pipeline.


    For personal, I strongly suggest you use YAML to achieve what you want.

    Simple sample YAML definition:

    resources:
      repositories:
      - repository: tools
        name: Tools
        type: git
    
    steps:
    - checkout: self
    - checkout: tools
    - script: dir $(Build.SourcesDirectory)
    

    Here, image I have a repository called "MyCode" with a YAML pipeline, plus a second repository called "Tools".

    In above third step(dir $(Build.SourcesDirectory)), it will show you two directories, "MyCode" and "Tools", in the sources directory.

    Hope this helps.


    For Bitbucket:

    resources:
      repositories:
      - repository: MyBitBucketRepo
        type: bitbucket
        endpoint: MyBitBucketServiceConnection
        name: {BitBucketOrg}/{BitBucketRepo}
    
    trigger:
    - master
    
    pool:
      vmImage: 'ubuntu-latest'
    
    steps:
    - checkout: self
    - checkout: MyBitBucketRepo
    - script: dir $(Build.SourcesDirectory)