Skip to content

Commit a8cb0ad

Browse files
committed
.github/zephyr: simplify and fix the git describe performance hack
Fixes the git describe/tag performance hack added in commit 2328478 (".github/zephyr.yml: fix tags missing from `git -C zephyr/ describe`") which worked for an amazingly long time (1.5 year) but apparently ran its course. Git version 2.48 apparently does not like it anymore. Replace it with something slower but simpler and safer. Should fix build reproducibility issue #9797, much more details there. Also fixes commit 4bc6488 (".github/zephyr: de-hardcode the name of the zephyr remote") Signed-off-by: Marc Herbert <marc.herbert@intel.com>
1 parent 503ae3e commit a8cb0ad

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

.github/workflows/zephyr.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,19 @@ jobs:
179179
# does not use --tags.
180180
#
181181
# 2. west fetches using the remote URL, not the remote name. So remote
182-
# branches (if any) are missing from --decorate below
183-
#
184-
# => an "empty" and quick fetch _with_ a refspec and the remote name fixes
185-
# both issues in no time.
182+
# branches are missing from --decorate below. Cosmetic but annoying;
183+
# especially in the "zmain" case.
186184
187185
cd zephyr
188-
time git fetch --filter=tree:0 "$(git remote |head -n1)" "$rem_rev":_branch_placeholder
189-
git branch -D _branch_placeholder
190-
191186
set -x
187+
# Fix problem 2. Do NOT assume anything about remote names: nothing is guaranteed.
188+
_zurl=$(west list -f '{url}' zephyr)
189+
git remote add sof_zep_rem "$_zurl"
190+
time git fetch --filter=tree:0 sof_zep_rem "$rem_rev"
191+
# Fix problem 1. Indirectly fetches useless branches but should be quick enough
192+
# thanks to the --filter
193+
time git fetch --filter=tree:0 --tags sof_zep_rem
194+
192195
west list
193196
west status
194197
git log --oneline -n 5 --decorate --graph --no-abbrev-commit
@@ -327,12 +330,23 @@ jobs:
327330
west init -l sof
328331
west update --narrow --fetch-opt=--filter=tree:0
329332
330-
# Get some tags to fix `git describe`, see build-linux comments above.
331-
cd zephyr
333+
# Get some tags to fix `git describe` etc., see detailed build-linux comments above.
334+
- name: Fetch tags for git describe
335+
working-directory: ${{ github.workspace }}/workspace/zephyr
336+
# Keep in sync with build-linux above
337+
run: |
338+
Set-PSDebug -Trace 2
332339
$_rev = "$(git rev-parse HEAD)"
333-
git fetch --filter=tree:0 "$(west list -f '{url}' zephyr)" "${_rev}:_branch_placeholder"
334-
git branch -D _branch_placeholder
340+
$_zurl = "$(west list -f '{url}' zephyr)"
341+
git remote add sof_zep_rem "${_zurl}"
342+
# Unlike Linux above, hardcode "main" for now. Will make no difference most
343+
# of the time but keeps this bit consistent with Linux, tested and ready to use.
344+
git fetch --filter=tree:0 sof_zep_rem main
345+
git fetch --filter=tree:0 --tags sof_zep_rem
335346
347+
west list
348+
west status
349+
git log --oneline -n 5 --decorate --graph --no-abbrev-commit
336350
337351
# Call Setup Python again to save the PIP packages in cache
338352
- name: Setup Python

0 commit comments

Comments
 (0)