0
votes

For my current project i want to create an azure devops pipeline for a project which uses a library as a submodule. This library however is in a different organizational unit in github, thus azure devops can't acces it freely.

In order to provide correct authentication i've created a personal acces token for github.

Official microsoft documentation page says i have to excute a specific command in which i have to fill 2 variables. (link to page, subheader Alternative to using the Checkout submodules option https://docs.microsoft.com/en-gb/azure/devops/pipelines/repos/pipeline-options-for-git?view=azure-devops&viewFallbackFrom=vsts

Either i must be reading it wrong or the workings of this command has changed without updating the documentation.

The following stackoverflow question & answer a user suggested something was changed earlier this year. I've tried this suggestion but it's not working for me.

How to authenticate to a private Github submodule in a VSTS automated build?

Could somebody provide me a more detailed version of steps i should take or tell me what i'm doing wrong?

My tries below assuming the following repo: github.com/libraryorganization personalaccestoken: 1234ABCD!@#$ base64 encoded personal acces token: MTIzNEFCQ0QhQCMk base64 encoded personal acces token (pat: added in front of accestoken : cGF0OjEyMzRBQkNEIUAjJA==

  • git -c http.https://github.com/libraryorganization.extraheader="AUTHORIZATION: basic MTIzNEFCQ0QhQCMk" submodule update --init --recursive
  • git -c http.https://github.com/libraryorganization.extraheader="AUTHORIZATION: basic cGF0OjEyMzRBQkNEIUAjJA" submodule update --init --recursive
  • git -c http.https://github.com/libraryorganization.extraheader="AUTHORIZATION: basic 1234ABCD!@#$" submodule update --init --recursive
  • git -c http.https://github.com/libraryorganization.extraheader="AUTHORIZATION: basic pat:1234ABCD!@#$" submodule update --init --recursive
  • git -c http.https://github.com/libraryorganization.extraheader="AUTHORIZATION: basic myusername:mypassword" submodule update --init --recursive
  • git -c http.https://github.com/libraryorganization.extraheader="AUTHORIZATION: basic Base64Encode("1234ABCD!@#$:")"
  • git -c http.https://github.com/libraryorganization.extraheader="AUTHORIZATION: basic Base64Encode("myusername:mypassword")" submodule update --init --recursive
1
Are you using YAML pipeline or Classic UI pipeline?PatrickLu-MSFT
I'm using a YAML pipelineA C

1 Answers

0
votes

It maybe an authentication issue. You need to get the OAuth token into each of the submodule repos.

Make sure you have the build pipeline setting enabled to Allow scripts access to the OAuth token. As documented, this stuffs the token into a variable called System.AccessToken.

It also stuffs the token into a git config setting that you'll see at the end of your get sources step when you run it after enabling the setting. This is how git authenticates to Azure DevOps.

Since you are using script, make sure you have check the allow scripts access to the OAuth token option.