1

I'm facing an issue while trying to access different git sources in TFS Build.

I have 2 repos Test1 & Test2 - https://tfs.org.com:8080/tfs/collection/project/_git/Test1 (& Test2). Under Test2, I added a sample.txt & .gitmodules file.

.GitModules file has a cmd - git submodule add https://tfs.org.com:8080/tfs/collection/project/_git/Test1 (Since I want to checkout Test1 contents too while triggering Test2 repo)

Now in Build def (which builds Test2) I checked the option (Checkout Submodules) - and triggered the build. But I don't see Test1's content was checkout in build server. How can I achieve this ?

Note: I have tried with other option that I found online - but no luck.

[submodule "Test1"]
    path = Test1
    url = https://tfs.org.com:8080/tfs/collection/project/_git/Test1

(The above one is a POC's that I'm testing to make it work in our actual environment, i.e, Azure DevOps - accessing TFS with OtherGit service connection to build and release)

Here is the build Log for Get Sources:

2020-10-04T15:16:20.1648800Z Entering TfsGitSourceProvider.PrepareRepositoryAsync
 
2020-10-04T15:16:20.1648800Z localPath=E:\Temp\1\s
 
2020-10-04T15:16:20.1648800Z clean=True
 
2020-10-04T15:16:20.1648800Z sourceBranch=refs/heads/master
 
2020-10-04T15:16:20.1648800Z sourceVersion=1cca491d4af9def54e8e9d11b3c6ffbb226ace21
 
2020-10-04T15:16:20.1648800Z Syncing repository: Test2 (Git)
 
2020-10-04T15:16:20.1648800Z repository url=https://tfs.org.com:8080/tfs/collection/project/_git/Test2
 
2020-10-04T15:16:20.1648800Z checkoutSubmodules=True
 
2020-10-04T15:16:20.2586300Z Running 'git clean -fdx' on E:\Temp\1\s.
 
2020-10-04T15:16:20.5555003Z Running 'git reset --hard HEAD' on E:\Temp\1\s.
 
2020-10-04T15:16:20.6648794Z HEAD is now at 043b897 Updated .gitmodules
 
2020-10-04T15:16:20.6805036Z Starting fetch...
 
2020-10-04T15:16:20.9930080Z Checking out 1cca491d4af9def54e8e9d11b3c6ffbb226ace21 to E:\Temp\1\s with submodules
 
2020-10-04T15:16:21.0398784Z Checked out branch refs/heads/master for repository Test2 at commit 1cca491d4af9def54e8e9d11b3c6ffbb226ace21
 
2020-10-04T15:16:21.0398784Z commit=1cca491d4af9def54e8e9d11b3c6ffbb226ace21
 
2020-10-04T15:16:21.0398784Z Leaving TfsGitSourceProvider.PrepareRepositoryAsync
4
  • You should have some logs of the Git checkout process on your build. Can you add those to your question? Commented Oct 4, 2020 at 18:15
  • @SorenBjornstad Added the build logs Commented Oct 5, 2020 at 2:19
  • @user2153844 I tested it on my side but it worded well. It looks like your steps are correct. Can you follow my steps and try again? Commented Oct 5, 2020 at 8:22
  • @user2153844 Not get your response for several days, would you please share your latest information about this issue? Feel free to let me know if you're still blocked, I'll try my best to help :) Commented Oct 15, 2020 at 2:58

2 Answers 2

1

You must select the option to download submodules.

Checkout submodules option

In YAML you must add an explicit checkout step

steps:
- checkout: self
  submodules: true
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks @giulio. But I m using TFS Classic build for now. We are not Implementing in YAML.
The top screenshot on this answer shows how to use it on Classic.
1

I followed the steps below and it worked as expected:

  1. Create two repositories and initialize.
  2. Use "git submodule add" command. enter image description here
  3. Now I have a .gitmodules file and a test1 file in my test2 repository enter image description here
  4. Create a pipeline and select the "Checkout submodules" option. enter image description here
  5. I can see the following logs after running pipelines. enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.