Refer to the external code in GitHub repo from ADO repo

社会主义新天地 提交于 2021-01-01 09:41:27

问题


I have 2 repositories - 1 ADO & 1 GitHub:

ADO repo contains internal code

GitHub repo contains external code

I'm using https://docs.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?


回答1:


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



来源:https://stackoverflow.com/questions/64867728/refer-to-the-external-code-in-github-repo-from-ado-repo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!