Skip to content

cli: obtain host release and arch for config-only artifact dumps - #10485

Open
iav wants to merge 1 commit into
armbian:mainfrom
iav:fix/artifact-config-dump-json-hostrelease
Open

iav wants to merge 1 commit into
armbian:mainfrom
iav:fix/artifact-config-dump-json-hostrelease

Conversation

@iav

@iav iav commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Problem. artifact-config-dump-json died with error 43 on any plain checkout.
CONFIG_DEFS_ONLY=yes makes prep_conf_main_minimal_ni() skip check_basic_host(), yet the
artifact handler still reaches prepare_host(), whose late_prepare_host_dependencies()
requires HOSTRELEASE and HOSTARCH.

Fix. Obtain both values when the dump skipped those checks; the host arch is split out of
obtain_and_check_host_release_and_arch() as obtain_hostarch_only().

Host preparation itself is unchanged. The command prepares the host like every other artifact
command -- inside the container when it relaunches into docker -- or skips it on
PRE_PREPARED_HOST=yes, which is what lib/tools/common/armbian_utils.py passes.

Tested on an arm64 host: with output/info absent, artifact-config-dump-json WHAT=kernel BOARD=helios4 BRANCH=edge prints the JSON and leaves the host untouched, and its
artifact_version is byte-identical to the same dump run on main.

Summary by CodeRabbit

  • Bug Fixes

    • Configuration-only artifact operations now reliably detect missing host release and architecture information before preparing the host.
    • Improved consistency when determining the build host architecture, helping prevent failures caused by incomplete host details.
  • Refactor

    • Host architecture detection was streamlined without changing the resulting validation behavior.

@github-actions github-actions Bot added 08 Milestone: Third quarter release size/medium PR with more then 50 and less then 250 lines Needs review Seeking for review Framework Framework components labels Aug 20, 2026
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 96560841-c4ea-43b1-8455-bfd92f9a8d79

📥 Commits

Reviewing files that changed from the base of the PR and between 9db44dd and 6874e45.

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

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change extracts host architecture detection into obtain_hostarch_only() and updates configuration-only artifact runs to initialize missing HOSTRELEASE and HOSTARCH before host preparation.

Changes

Host initialization and artifact configuration

Layer / File(s) Summary
Host architecture detection
lib/functions/host/host-release.sh
obtain_and_check_host_release_and_arch() now calls obtain_hostarch_only(). The new function sets HOSTARCH from dpkg --print-architecture and displays the host architecture alert.
Configuration-only host setup
lib/functions/cli/cli-artifact.sh
When CONFIG_DEFS_ONLY=yes, cli_artifact_run initializes missing HOSTRELEASE and HOSTARCH before prepare_host().

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 6874e

The supported artifact configuration dump workflow has no remaining identified merge-blocking risk.

🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the CLI change and the config-only artifact dump behavior. It accurately highlights obtaining the host release and architecture for this scenario.
  • Fix all pre-merge checks with AI
✨ 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.

@iav

iav commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Beyond fixing the crash, this makes an existing exact answer usable. The artifact hash is the digest of every input (git SHA, patches, .config, drivers, framework bash), so running this command on the base and on a PR branch and diffing artifact_version deterministically answers "rebuild or cache hit?" -- the question #10473 currently predicts with a model.

That was impractical until now: on a plain checkout the command died with error 43, and in CI it only worked inside an already-prepared environment. It now runs out of the box and, for WHAT=kernel, touches nothing on the host.

It does not replace the narrowing #10473 does -- a dump costs about a minute per artifact, so 403 boards is out of the question. It is an exact check on top of that narrowing.

@rpardini

Copy link
Copy Markdown
Member

Hmm. Isn't this covered by PRE_PREPARED_HOST (https://github.com/armbian/build/blob/main/lib/tools/common/armbian_utils.py#L471-L475 - as called by the actual matrix-prepare GHA step?

(I think the reasoning back then was that the host is going to be prepared by the invoker of the config dump, so doesn't "need" to be prepared again)

@iav

iav commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Nothing loses its host preparation. In GHA the invoker still prepares it and passes PRE_PREPARED_HOST=yes — unchanged. Real builds (build/kernel/rootfs, i.e. anything without CONFIG_DEFS_ONLY) still go through prepare_host() — unchanged. The dump itself doesn't need a prepared host, it only prints variables; the exception is artifacts whose version requires aggregation (WHAT=rootfs), which runs python from the host deps and calls assert_prepared_host() — that path still prepares, which is why the skip is conditional. Net effect: the host is prepared exactly when something is about to be built, and a hand-run dump on a fresh checkout prints the vars instead of exiting 43 with HOSTRELEASE is not set.

@rpardini

Copy link
Copy Markdown
Member

Yes, the assumption changes from "host will have been prepared by parent/caller" to "host doesn't ever need to be prepared (save for rootfs)" - I don't mind, just wonder how much fallout will come later.

@iav

iav commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

We won't know until we try™

@iav
iav force-pushed the fix/artifact-config-dump-json-hostrelease branch from ba9b01c to 2f45430 Compare September 15, 2026 20:16
@github-actions github-actions Bot added size/small PR with less then 50 lines and removed size/medium PR with more then 50 and less then 250 lines labels Sep 15, 2026
@iav
iav force-pushed the fix/artifact-config-dump-json-hostrelease branch from 2f45430 to 9db44dd Compare September 15, 2026 23:40
`artifact-config-dump-json` died with `error 43` on any plain checkout:
`CONFIG_DEFS_ONLY=yes` makes `prep_conf_main_minimal_ni()` skip
`check_basic_host()`, so `HOSTRELEASE` and `HOSTARCH` stay unset, while
`late_prepare_host_dependencies()` inside `prepare_host()` requires both.

Obtain the two values in `cli_artifact_run()` when the dump skipped those
checks; the host arch is split out of `obtain_and_check_host_release_and_arch()`
as `obtain_hostarch_only()`. Host preparation itself is untouched: the command
prepares the host like every other artifact command, or trusts the caller's
`PRE_PREPARED_HOST=yes`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@iav
iav force-pushed the fix/artifact-config-dump-json-hostrelease branch from 9db44dd to 6874e45 Compare September 16, 2026 01:23
@iav

iav commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Reworked after the discussion above: host preparation is no longer skipped.

The previous version changed the assumption to "the host never needs to be prepared", and the
fallout showed up immediately: a plain checkout has no output/info -- only prepare_host()
creates it -- so the dump died in git-ref2info.sh:113 reading git_sources.json. Same failure
on main with PRE_PREPARED_HOST=yes, so that gap is older than this PR.

What is left here is only the cause of the original crash: HOSTRELEASE and HOSTARCH unset
under CONFIG_DEFS_ONLY. The old assumption stands -- the command prepares the host, or the
caller declares it prepared.

@iav iav changed the title cli: don't prepare the host for config-only artifact dumps cli: obtain host release and arch for config-only artifact dumps Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

08 Milestone: Third quarter release Framework Framework components Needs review Seeking for review size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

2 participants