You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(offline): honor OFFLINE_WORK in git-ref2info and memoize TTL
Fixes#6439.
memoized_git_ref_to_info() unconditionally ran 'git ls-remote' against the
upstream source even with OFFLINE_WORK=yes; when the remote was unreachable
the build aborted with a misleading network error.
Two coordinated guards:
* memoize-cached.sh: when OFFLINE_WORK=yes, serve the cache file regardless
of TTL (alternative is a network call that will fail). The "stale cache
served" event is logged.
* git-ref2info.sh: early offline guard before the ls-remote loop. For
ref_type=commit the SHA1 is taken from the ref itself (no network); for
branch/tag we look up a pinned SHA1 in config/sources/git_sources.json.
If neither is available, exit_with_error with a clear message instead
of letting curl/ls-remote surface as 502.
Same guard applied to the include_makefile_body block (curl to git host)
since there is no local-bare fallback in scope here.
Behaviour matrix unchanged for OFFLINE_WORK=no (default).
Assisted-by: Claude:claude-opus-4.7
display_alert "OFFLINE_WORK: using pinned SHA1 from git_sources.json""${ref_name} -> ${sha1}""info"
53
+
refs_to_try=() # skip ls-remote loop below
54
+
else
55
+
exit_with_error "OFFLINE_WORK=yes but no SHA1 available for '${MEMO_DICT[GIT_SOURCE]}' '${ref_type}' '${ref_name}' - run online once to populate cache, or pin sha1 in config/sources/git_sources.json"
56
+
fi
57
+
fi
58
+
34
59
# Enter loop. The first that resolves to a valid sha1 wins.
35
60
declare to_try
36
61
forto_tryin"${refs_to_try[@]}";do
@@ -93,10 +118,15 @@ function memoized_git_ref_to_info() {
exit_with_error "Invalid pinned SHA1 '${cached_revision}' for '${MEMO_DICT[GIT_SOURCE]}' '${ref_name}' in config/sources/git_sources.json"
129
+
fi
100
130
fi
101
131
102
132
MEMO_DICT+=(["SHA1"]="${sha1}")
@@ -228,6 +258,14 @@ function memoized_git_ref_to_info() {
228
258
return 0
229
259
}
230
260
261
+
# OFFLINE_WORK guard: Makefile body is fetched via curl to git host(s) — no
262
+
# network when offline. We have no local fallback here (no bare-clone path in
263
+
# scope), so fail with a clear message instead of letting curl surface as a
264
+
# misleading 'undetermined' kernel version downstream (#6439).
265
+
if [[ "${OFFLINE_WORK}"=="yes" ]];then
266
+
exit_with_error "OFFLINE_WORK=yes but Makefile body for '${MEMO_DICT[GIT_SOURCE]}' '${ref_name}' (sha1 ${sha1}) not in cache - run online once to populate ${SRC}/cache/memoize/"
0 commit comments