Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2019-01-29 17:19:31 +0300
committerJunio C Hamano <gitster@pobox.com>2019-01-29 20:26:46 +0300
commit6c1f4ae65ad62f33c85884c723aa2c8a57207b85 (patch)
tree2f0b9772efc1c1cd430bee62d6fdb407673f5fea /azure-pipelines.yml
parent2e90484eb4ad0eb4334a94ba5ae401a293870e3a (diff)
ci: use git-sdk-64-minimal build artifact
Instead of a shallow fetch followed by a sparse checkout, we are better off by using a separate, dedicated Pipeline that bundles the SDK as a build artifact, and then consuming that build artifact here. In fact, since this artifact will be used a lot, we spent substantial time on figuring out a minimal subset of the Git for Windows SDK, just enough to build and test Git. The result is a size reduction from around 1GB (compressed) to around 55MB (compressed). This also comes with the change where we now call `usr\bin\bash.exe` directly, as `git-cmd.exe` is not included in the minimal SDK. That reduces the time to initialize Git for Windows' SDK from anywhere between 2m30s-7m to a little over 1m. Note: in theory, we could also use the DownloadBuildArtifacts@0 task here. However, restricted permissions that are in effect when building from forks would let this fail for PR builds, defeating the whole purpose of the Azure Pipelines support for git.git. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'azure-pipelines.yml')
-rw-r--r--azure-pipelines.yml44
1 files changed, 9 insertions, 35 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 0f7b2125a1..480e841a85 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -18,44 +18,18 @@ jobs:
env:
GITFILESHAREPWD: $(gitfileshare.pwd)
- powershell: |
- # Helper to check the error level of the latest command (exit with error when appropriate)
- function c() { if (!$?) { exit(1) } }
-
- # Add build agent's MinGit to PATH
- $env:PATH = $env:AGENT_HOMEDIRECTORY +"\externals\\git\cmd;" +$env:PATH
-
- # Helper to initialize (or update) a Git worktree
- function init ($path, $url, $set_origin) {
- if (Test-Path $path) {
- cd $path; c
- if (Test-Path .git) {
- & git init; c
- } else {
- & git status
- }
- } else {
- & git init $path; c
- cd $path; c
- }
- & git config core.autocrlf false; c
- & git config core.untrackedCache true; c
- if (($set_origin -ne 0) -and !(git config remote.origin.url)) {
- & git remote add origin $url; c
- }
- & git fetch --depth=1 $url master; c
- & git reset --hard FETCH_HEAD; c
- & git clean -df; c
- }
-
- # Initialize Git for Windows' SDK
- $sdk_path = "$(Build.SourcesDirectory)\git-sdk-64"
- init "$sdk_path" "https://dev.azure.com/git-for-windows/git-sdk-64/_git/git-sdk-64" 0
+ $urlbase = "https://dev.azure.com/git-for-windows/git/_apis/build/builds"
+ $id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=22&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
+ $downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[1].resource.downloadUrl
+ (New-Object Net.WebClient).DownloadFile($downloadUrl,"git-sdk-64-minimal.zip")
+ Expand-Archive git-sdk-64-minimal.zip -DestinationPath . -Force
+ Remove-Item git-sdk-64-minimal.zip
# Let Git ignore the SDK and the test-cache
- "/git-sdk-64/`n/test-cache/`n" | Out-File -NoNewLine -Encoding ascii -Append "$(Build.SourcesDirectory)\.git\info\exclude"
- displayName: 'Initialize the Git for Windows SDK'
+ "/git-sdk-64-minimal/`n/test-cache/`n" | Out-File -NoNewLine -Encoding ascii -Append "$(Build.SourcesDirectory)\.git\info\exclude"
+ displayName: 'Download git-sdk-64-minimal'
- powershell: |
- & "git-sdk-64\git-cmd.exe" --command=usr\\bin\\bash.exe -lc @"
+ & git-sdk-64-minimal\usr\bin\bash.exe -lc @"
export DEVELOPER=1
export NO_PERL=1
export NO_SVN_TESTS=1