Skip to content

artifact-uboot: add UBOOT_GIT_CACHE_TTL (fixes #7710)#9699

Merged
igorpecovnik merged 1 commit intoarmbian:mainfrom
iav:fix/7710-uboot-git-cache-ttl
Apr 20, 2026
Merged

artifact-uboot: add UBOOT_GIT_CACHE_TTL (fixes #7710)#9699
igorpecovnik merged 1 commit intoarmbian:mainfrom
iav:fix/7710-uboot-git-cache-ttl

Conversation

@iav
Copy link
Copy Markdown
Contributor

@iav iav commented Apr 19, 2026

Summary

Fix #7710 by introducing UBOOT_GIT_CACHE_TTL, mirroring the existing
KERNEL_GIT_CACHE_TTL for kernel.

The upstream u-boot git ref SHA1 is memoized for 3600 seconds by default,
so commits pushed to a tracked BOOTBRANCH (branch:* refspec) are not
picked up until that TTL expires. There was no user-visible knob to
shorten the window — only ARTIFACT_IGNORE_CACHE=yes as a blunt workaround.

As suggested by @rpardini in #7710:

A Pull request implementing UBOOT_GIT_CACHE_TTL (via memoize_cache_ttl var
to run_memoized() just like is done in obtain_kernel_git_info_and_makefile()
would be welcome.

What changes

lib/functions/artifacts/artifact-uboot.sh: read UBOOT_GIT_CACHE_TTL,
emit display_alert when set, pass it as memoize_cache_ttl to run_memoized.
Default behaviour unchanged (3600s).

Test plan

  • ./compile.sh uboot BOARD=helios4 BRANCH=edge UBOOT_GIT_CACHE_TTL=1
    Setting u-boot git cache TTL to [ 1 ] + Producing new & caching [ GIT_INFO_UBOOT ], exit 0
  • ./compile.sh uboot BOARD=helios4 BRANCH=edge (no override)
    → no TTL alert, Using cached [ GIT_INFO_UBOOT ], exit 0

Summary by CodeRabbit

  • New Features
    • Added configurable cache timeout for git operations via environment variable (default: 1 hour).

fixes armbian#7710)

By default the git ref of BOOTSOURCE/BOOTBRANCH is memoized for 3600 seconds,
so pushing new commits to a tracked branch is not picked up until the cache
expires.  Add UBOOT_GIT_CACHE_TTL, mirroring KERNEL_GIT_CACHE_TTL in
artifact-kernel.sh, so users can override this timeout (set to a low value
or 0 to always re-resolve the upstream SHA1).

As suggested by rpardini in armbian#7710.
@iav iav requested a review from a team as a code owner April 19, 2026 17:54
@iav iav requested review from mhoffrog and schwar3kat and removed request for a team April 19, 2026 17:54
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 19, 2026

📝 Walkthrough

Walkthrough

The artifact_uboot_prepare_version() function now reads an optional UBOOT_GIT_CACHE_TTL environment variable (defaulting to 3600 seconds) and passes the configured TTL value to the memoization cache before retrieving git-derived u-boot information for version computation.

Changes

Cohort / File(s) Summary
U-boot Git Cache Configuration
lib/functions/artifacts/artifact-uboot.sh
Modified artifact_uboot_prepare_version() to read configurable UBOOT_GIT_CACHE_TTL environment variable and assign it to memoize_cache_ttl before invoking memoized git operations, enabling control over cache refresh behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A cache that lingered, oh so long,
Made rebuilds skip what should be strong,
But now a TTL comes to play,
Git info refreshes every day!
Fresh u-boot hops into the fold, 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title clearly summarizes the main change: adding UBOOT_GIT_CACHE_TTL environment variable to control cache TTL and references the fixed issue.
Linked Issues check ✅ Passed The PR directly addresses issue #7710 by implementing user-controllable cache TTL for git ref resolution, allowing cache window to be shortened without ARTIFACT_IGNORE_CACHE workaround.
Out of Scope Changes check ✅ Passed Changes are focused and scoped: only modifying artifact_uboot_prepare_version() to read UBOOT_GIT_CACHE_TTL and pass it to memoization, no unrelated alterations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added Needs review Seeking for review Framework Framework components size/small PR with less then 50 lines 05 Milestone: Second quarter release labels Apr 19, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lib/functions/artifacts/artifact-uboot.sh`:
- Around line 43-47: The current use of declare -i for
uboot_git_cache_ttl_seconds causes silent coercion and raw arithmetic errors for
invalid inputs; replace the declare -i pattern and the direct assignment from
UBOOT_GIT_CACHE_TTL by converting the user-provided string with arithmetic
expansion (e.g. set uboot_git_cache_ttl_seconds using $((UBOOT_GIT_CACHE_TTL +
0)) after trimming/allowing whitespace) before calling display_alert, so invalid
strings become 0 and valid numeric seconds are preserved; update the logic
around the UBOOT_GIT_CACHE_TTL check and the uboot_git_cache_ttl_seconds
assignment to use this expansion instead of declare -i.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7aa840c5-0110-4f1e-bc2e-29856ec5c184

📥 Commits

Reviewing files that changed from the base of the PR and between 03192b8 and 8ad8b91.

📒 Files selected for processing (1)
  • lib/functions/artifacts/artifact-uboot.sh

Comment thread lib/functions/artifacts/artifact-uboot.sh
Copy link
Copy Markdown
Member

@rpardini rpardini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

@github-actions github-actions Bot added the Ready to merge Reviewed, tested and ready for merge label Apr 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions Bot removed the Needs review Seeking for review label Apr 20, 2026
@igorpecovnik igorpecovnik merged commit 83ddc22 into armbian:main Apr 20, 2026
15 checks passed
@iav iav deleted the fix/7710-uboot-git-cache-ttl branch April 20, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release Framework Framework components Ready to merge Reviewed, tested and ready for merge size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

[Bug]: Armbian skips rebuild updated U-boot and keeps cached

3 participants