Skip to content

Commit bec0334

Browse files
committed
ci: avoid pounding on the poor ci-artifacts container
When this developer tested how the git-sdk-64-minimal artifact could be served to all the GitHub workflow runs that need it, Azure Blobs looked like a pretty good choice: it is reliable, fast and we already use it in Git for Windows to serve components like OpenSSL, cURL, etc It came as an unpleasant surprise just _how many_ times this artifact was downloaded. It exploded the bandwidth to a point where the free tier would no longer be enough, threatening to block other, essential Git for Windows services. Let's switch back to using the Build Artifacts of our trusty Azure Pipeline for the time being. To avoid unnecessary hammering of the Azure Pipeline artifacts, we use the GitHub Action `actions/upload-artifact` in the `windows-build` job and the GitHub Action `actions/download-artifact` in the `windows-test` and `vs-test` jobs (the latter now depends on `windows-build` for that reason, too). Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 4267c88 commit bec0334

File tree

1 file changed

+54
-11
lines changed

1 file changed

+54
-11
lines changed

.github/workflows/main.yml

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,24 @@ jobs:
1212
- uses: actions/checkout@v1
1313
- name: download git-sdk-64-minimal
1414
shell: bash
15-
run: a=git-sdk-64-minimal && mkdir -p $a && curl -# https://wingit.blob.core.windows.net/ci-artifacts/$a.tar.xz | tar -C $a -xJf -
15+
run: |
16+
## Add `json_pp` to the search path
17+
PATH=$PATH:/usr/bin/core_perl
18+
19+
## Get artifact
20+
urlbase=https://dev.azure.com/git-for-windows/git/_apis/build/builds
21+
id=$(curl "$urlbase?definitions=22&statusFilter=completed&resultFilter=succeeded&\$top=1" |
22+
json_pp |
23+
sed -n 's/^ "id" : \([1-9][0-9]*\).*/\1/p')
24+
download_url="$(curl "$urlbase/$id/artifacts" |
25+
json_pp |
26+
sed -n '/^ {/{:1;N;/\n }/b2;b1;:2;/"name" : "git-sdk-64-minimal"/{s/.*"downloadUrl" : "\([^\"]*\).*/\1/p}}')"
27+
curl --connect-timeout 10 --retry 5 --retry-delay 0 --retry-max-time 240 \
28+
-o artifacts.zip "$download_url"
29+
30+
## Unzip and remove the artifact
31+
unzip artifacts.zip
32+
rm artifacts.zip
1633
- name: build
1734
shell: powershell
1835
env:
@@ -30,6 +47,11 @@ jobs:
3047
with:
3148
name: windows-artifacts
3249
path: artifacts
50+
- name: upload git-sdk-64-minimal
51+
uses: actions/upload-artifact@v1
52+
with:
53+
name: git-sdk-64-minimal
54+
path: git-sdk-64-minimal
3355
windows-test:
3456
runs-on: windows-latest
3557
needs: [windows-build]
@@ -38,9 +60,6 @@ jobs:
3860
nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
3961
steps:
4062
- uses: actions/checkout@v1
41-
- name: download git-sdk-64-minimal
42-
shell: bash
43-
run: a=git-sdk-64-minimal && mkdir -p $a && curl -# https://wingit.blob.core.windows.net/ci-artifacts/$a.tar.xz | tar -C $a -xJf -
4463
- name: download build artifacts
4564
uses: actions/download-artifact@v1
4665
with:
@@ -49,6 +68,11 @@ jobs:
4968
- name: extract build artifacts
5069
shell: bash
5170
run: tar xf artifacts.tar.gz
71+
- name: download git-sdk-64-minimal
72+
uses: actions/download-artifact@v1
73+
with:
74+
name: git-sdk-64-minimal
75+
path: ${{github.workspace}}/git-sdk-64-minimal/
5276
- name: test
5377
shell: powershell
5478
run: |
@@ -79,7 +103,24 @@ jobs:
79103
- uses: actions/checkout@v1
80104
- name: download git-sdk-64-minimal
81105
shell: bash
82-
run: a=git-sdk-64-minimal && mkdir -p $a && curl -# https://wingit.blob.core.windows.net/ci-artifacts/$a.tar.xz | tar -C $a -xJf -
106+
run: |
107+
## Add `json_pp` to the search path
108+
PATH=$PATH:/usr/bin/core_perl
109+
110+
## Get artifact
111+
urlbase=https://dev.azure.com/git-for-windows/git/_apis/build/builds
112+
id=$(curl "$urlbase?definitions=22&statusFilter=completed&resultFilter=succeeded&\$top=1" |
113+
json_pp |
114+
sed -n 's/^ "id" : \([1-9][0-9]*\).*/\1/p')
115+
download_url="$(curl "$urlbase/$id/artifacts" |
116+
json_pp |
117+
sed -n '/^ {/{:1;N;/\n }/b2;b1;:2;/"name" : "git-sdk-64-minimal"/{s/.*"downloadUrl" : "\([^\"]*\).*/\1/p}}')"
118+
curl --connect-timeout 10 --retry 5 --retry-delay 0 --retry-max-time 240 \
119+
-o artifacts.zip "$download_url"
120+
121+
## Unzip and remove the artifact
122+
unzip artifacts.zip
123+
rm artifacts.zip
83124
- name: generate Visual Studio solution
84125
shell: powershell
85126
run: |
@@ -119,15 +160,17 @@ jobs:
119160
path: artifacts
120161
vs-test:
121162
runs-on: windows-latest
122-
needs: [vs-build]
163+
needs: [vs-build, windows-build]
123164
strategy:
124165
matrix:
125166
nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
126167
steps:
127168
- uses: actions/checkout@v1
128-
- name: download git-64-portable
129-
shell: bash
130-
run: a=git-64-portable && mkdir -p $a && curl -# https://wingit.blob.core.windows.net/ci-artifacts/$a.tar.xz | tar -C $a -xJf -
169+
- name: download git-sdk-64-minimal
170+
uses: actions/download-artifact@v1
171+
with:
172+
name: git-sdk-64-minimal
173+
path: ${{github.workspace}}/git-sdk-64-minimal/
131174
- name: download build artifacts
132175
uses: actions/download-artifact@v1
133176
with:
@@ -143,9 +186,9 @@ jobs:
143186
NO_SVN_TESTS: 1
144187
GIT_TEST_SKIP_REBASE_P: 1
145188
run: |
146-
& git-64-portable\git-cmd.exe --command=usr\bin\bash.exe -lc @"
189+
& .\git-sdk-64-minimal\usr\bin\bash.exe -lc @"
147190
# Let Git ignore the SDK and the test-cache
148-
printf '%s\n' /git-64-portable/ /test-cache/ >>.git/info/exclude
191+
printf '%s\n' /git-sdk-64-minimal/ /test-cache/ >>.git/info/exclude
149192
150193
cd t &&
151194
PATH=\"`$PWD/helper:`$PATH\" &&

0 commit comments

Comments
 (0)