0

I have 2 repositories - 1 ADO & 1 GitHub:

ADO repo contains internal code

GitHub repo contains external code

I'm using https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops to checkout the above repositories.

I need to use some code files in GitHub repo to build the code in ADO repo (meaning internal code in ADO repo has dependency to external code GitHub repo).

Example

<ADO repo>

<ADO-code-file>

<content>:

private readonly IXYZ _log = null;

<GitHub repo>

<GitHub-code-file>: IXYZ.cs

<content>:

public interface IXYZ
{
}

build for internal code in ADO repo

private readonly IXYZ _log = null; 

is failing now because IXYZ.cs is a part of GitHub repository.

Is it possible to refer to the external code in GitHub repo from ADO repo?

user989988
  • 3,006
  • 7
  • 44
  • 91

1 Answers1

0

It's able to refer a public repo (GitHub) as submodule in Azure DevOps Git Repo.

Select if you want to download files from submodules. You can either choose to get the immediate submodules or all submodules nested to any depth of recursion. If you want to use LFS with submodules, be sure to see the note about using LFS with submodules.

The build pipeline will check out your Git submodules as long as they are:

  • Unauthenticated: A public, unauthenticated repo with no credentials required to clone or fetch.
  • Authenticated: Contained in the same project, GitHub organization, or Bitbucket Cloud account as the Git repo specified above.

Added by using a URL relative to the main repository. For example, this one would be checked out: git submodule add /../../submodule.git mymodule This one would not be checked out: git submodule add https://dev.azure.com/fabrikamfiber/_git/ConsoleApp mymodule

A sample for your reference:

[submodule "DBPkg"]
  path = DBPkg
  url = ../DBPkg

You could also check this link: https://stackoverflow.com/a/34618962/5391065

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • Thank you! How does adding git submodule fix the above issue I'm having? – user989988 Nov 18 '20 at 01:31
  • @user989988 `is failing now because ILoggingRepository.cs is a part of GitHub repository.` Instead of downloading/checking out two repos separately through script/api in Azure DevOPs pipeline. if you switch to use submodule, this error across different repos should not happen again. Suggest you give a try locally first. – PatrickLu-MSFT Nov 18 '20 at 03:14
  • Hi @user989988, any update on this, have you figured out it? – PatrickLu-MSFT Nov 26 '20 at 09:15