Skip to content

Commit a2379f7

Browse files
committed
fixup! Add a build definition for Azure DevOps
For some reason, the indentation of the PowerShell tasks got all messed up. Fix that. While at it, do not define `c()` for only one user, and do not initialize `/etc/passwd` (it does not seem to have a noticeable effect). Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 82d81f2 commit a2379f7

File tree

1 file changed

+56
-64
lines changed

1 file changed

+56
-64
lines changed

azure-pipelines.yml

Lines changed: 56 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -167,81 +167,73 @@ phases:
167167
timeoutInMinutes: 240
168168
steps:
169169
- powershell: |
170-
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
171-
net use s: \\gitfileshare.file.core.windows.net\test-cache "$GITFILESHAREPWD" /user:AZURE\gitfileshare /persistent:no
172-
cmd /c mklink /d "$(Build.SourcesDirectory)\test-cache" S:\
173-
}
170+
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
171+
net use s: \\gitfileshare.file.core.windows.net\test-cache "$GITFILESHAREPWD" /user:AZURE\gitfileshare /persistent:no
172+
cmd /c mklink /d "$(Build.SourcesDirectory)\test-cache" S:\
173+
}
174174
displayName: 'Mount test-cache'
175175
env:
176176
GITFILESHAREPWD: $(gitfileshare.pwd)
177177
- powershell: |
178-
# Helper to check the error level of the latest command (exit with error when appropriate)
179-
function c() { if (!$?) { exit(1) } }
180-
181-
# Add build agent's MinGit to PATH
182-
$env:PATH = $env:AGENT_HOMEDIRECTORY +"\externals\\git\cmd;" +$env:PATH
183-
184-
# Helper to initialize (or update) a Git worktree
185-
function init ($path, $url, $set_origin) {
186-
if (Test-Path $path) {
187-
cd $path; c
188-
if (Test-Path .git) {
189-
git init; c
190-
} else {
191-
git status
192-
}
193-
} else {
194-
git init $path; c
195-
cd $path; c
196-
}
197-
git config core.autocrlf false; c
198-
git config core.untrackedCache true; c
199-
if (($set_origin -ne 0) -and !(git config remote.origin.url)) {
200-
git remote add origin $url; c
201-
}
202-
git fetch --depth=1 $url master; c
203-
git reset --hard FETCH_HEAD; c
204-
git clean -df; c
205-
}
206-
207-
# Initialize Git for Windows' SDK
208-
$sdk_path = "$(Build.SourcesDirectory)\git-sdk-64"
209-
init "$sdk_path" "https://dev.azure.com/git-for-windows/git-sdk-64/_git/git-sdk-64" 0
210-
init usr\src\build-extra https://github.com/git-for-windows/build-extra 1
211-
212-
# Let Git ignore the SDK and the test-cache
213-
"/git-sdk-64/`n/test-cache/`n" | Out-File -NoNewLine -Encoding ascii -Append "$(Build.SourcesDirectory)\.git\info\exclude"
214-
215-
# Help MSYS2 runtime startup by initializing /etc/passwd
216-
& "$sdk_path\git-cmd" --command=usr\\bin\\bash.exe -lc "mkpasswd -c >>/etc/passwd"; c
178+
# Helper to check the error level of the latest command (exit with error when appropriate)
179+
function c() { if (!$?) { exit(1) } }
180+
181+
# Add build agent's MinGit to PATH
182+
$env:PATH = $env:AGENT_HOMEDIRECTORY +"\externals\\git\cmd;" +$env:PATH
183+
184+
# Helper to initialize (or update) a Git worktree
185+
function init ($path, $url, $set_origin) {
186+
if (Test-Path $path) {
187+
cd $path; c
188+
if (Test-Path .git) {
189+
git init; c
190+
} else {
191+
git status
192+
}
193+
} else {
194+
git init $path; c
195+
cd $path; c
196+
}
197+
git config core.autocrlf false; c
198+
git config core.untrackedCache true; c
199+
if (($set_origin -ne 0) -and !(git config remote.origin.url)) {
200+
git remote add origin $url; c
201+
}
202+
git fetch --depth=1 $url master; c
203+
git reset --hard FETCH_HEAD; c
204+
git clean -df; c
205+
}
206+
207+
# Initialize Git for Windows' SDK
208+
$sdk_path = "$(Build.SourcesDirectory)\git-sdk-64"
209+
init "$sdk_path" "https://dev.azure.com/git-for-windows/git-sdk-64/_git/git-sdk-64" 0
210+
init usr\src\build-extra https://github.com/git-for-windows/build-extra 1
211+
212+
# Let Git ignore the SDK and the test-cache
213+
"/git-sdk-64/`n/test-cache/`n" | Out-File -NoNewLine -Encoding ascii -Append "$(Build.SourcesDirectory)\.git\info\exclude"
217214
displayName: 'Initialize the Git for Windows SDK'
218215
- powershell: |
219-
# Helper to check the error level of the latest command (exit with error when appropriate)
220-
function c() { if (!$?) { exit(1) } }
221-
222-
cd "$(Build.SourcesDirectory)"; c
223-
224-
git-sdk-64\git-cmd --command=usr\\bin\\bash.exe -lc @"
225-
export MAKEFLAGS=-j10
226-
export DEVELOPER=1
227-
export NO_PERL=1
228-
export NO_SVN_TESTS=1
229-
export GIT_TEST_SKIP_REBASE_P=1
230-
231-
ci/run-build-and-tests.sh || {
232-
ci/print-test-failures.sh
233-
exit 1
234-
}
235-
"@
236-
c
216+
git-sdk-64\git-cmd --command=usr\\bin\\bash.exe -lc @"
217+
export MAKEFLAGS=-j10
218+
export DEVELOPER=1
219+
export NO_PERL=1
220+
export NO_SVN_TESTS=1
221+
export GIT_TEST_SKIP_REBASE_P=1
222+
223+
ci/run-build-and-tests.sh || {
224+
ci/print-test-failures.sh
225+
exit 1
226+
}
227+
"@
228+
if (!$?) { exit(1) }
237229
displayName: 'Build & Test'
238230
env:
239231
HOME: $(Build.SourcesDirectory)
240232
MSYSTEM: MINGW64
241233
- powershell: |
242-
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
243-
cmd /c rmdir "$(Build.SourcesDirectory)\test-cache"
244-
}
234+
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
235+
cmd /c rmdir "$(Build.SourcesDirectory)\test-cache"
236+
}
245237
displayName: 'Unmount test-cache'
246238
condition: true
247239
env:

0 commit comments

Comments
 (0)