I have a Git monorepo which has two folders (two separate solutions) in it. I have set two CI builds for each solution. Each CI has the Enable Continuous Integration
activated. For each CI pipeline, I have specified Path filters
(Exclude) for each folder so as to prevent CI builds for any commit for the other folder.
Is there a way for the private agent to download ONLY the source files [under a folder] which got affected by a commit?
That is, when the Database folder gets a commit, the agent downloads only the source files under the Database folder.
Is this related to Checkout submodules
?
UPDATE
This is my PowerShell script:
cd $(Build.SourcesDirectory)
git config --global user.email "my_email_here"
git config --global user.name "my_username_here"
git init
git remote add origin -f https://[email protected]/my_username_here/TxProject/_git/testtwoprojects
git config core.sparseCheckout true
Set-Content -Path .git/info/sparse-checkout -Value "Source/*"
git pull origin master
The error I receive is:
git : fatal: InvalidOperationException encountered. At C:\agent_work_temp\b5feb3b7-f104-48a0-94d8-a8c769e84a6e.ps1:8 char:1 + git remote add origin -f https://[email protected]/my_username_here/TxProjec ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (fatal: InvalidO...on encountered.:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError PowerShell exited with code '1'.
SOLUTION
I found a solution. First I changed to a Command Line task (from PowerShell) and added 2>&1
at the end of the commands.
Final code is:
cd $(Build.SourcesDirectory)
git config --global user.email "user_email"
git config --global user.name "user_name"
git init
git remote add origin -f LINK_TO_REPO 2>&1
git config core.sparseCheckout true
echo Source/ >> .git/info/sparse-checkout
git pull origin master 2>&1