Skip to content

Add --offline and AVOCADO_OFFLINE - #398

Open
jetm wants to merge 6 commits into
feed-loop/preflight-wiringfrom
feed-ergo/offline
Open

jetm wants to merge 6 commits into
feed-loop/preflight-wiringfrom
feed-ergo/offline

Conversation

@jetm

@jetm jetm commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

On a plane or behind an air gap, every avocado command still dials out before local work: the release check, the feed preflight, the snapshot pin checks, add-on lookups and Connect token minting. With no network the command fails even when the SDK already holds everything.

I add a global --offline flag, or AVOCADO_OFFLINE set to 1, true or yes. With it, avocado skips those requests and uses the locked pin, printing it once. With no pin on the default feed it stops and names avocado update. Commands that truly need the network fail naming --offline. dnf inside the SDK is unchanged; see docs/offline.md.

This PR is stacked on #394, because it changes the preflight code that PR reworks (preflight_feeds_once now takes the stages it probes). The last commit is a lockfile-only quinn-udp bump for the pre-push audit hook.

With strace -f -e trace=connect, the same install made two inet connections online and none with --offline.

jetm added 5 commits November 13, 2026 17:25
On a plane, behind an air gap or on a flaky link, every avocado
command still opens sockets before doing local work: the background
release check, and the feed preflight that probes each feed the
command's stages use. With no network the preflight fails the command
even when every package is already in the SDK, so there is no way to
work from what is installed.

I add a global --offline flag, with AVOCADO_OFFLINE=1 (or true/yes,
the spellings AVOCADO_REPO_INSECURE accepts) as the environment
equivalent, resolved once in main into a process-wide flag that every
network caller reads. This commit wires the two callers that run on
every command: the release check is not spawned, and
preflight_feeds_once returns before probing or recording anything, so
a later online call in the same process still probes the stages it
needs. The skip is announced once, like the --runs-on skip.

The preflight tests that read the flag now share the offline serial
key, so a test flipping it cannot make another skip its probes.

Signed-off-by: Javier Tia <javier@peridio.com>
With the preflight skipped, two feed steps still dial out under
--offline. check_addons fetches targets.json to confirm each add-on
feed exists for the target, and resolve_connect_credentials mints a
Connect feed token over HTTPS. The first turns an offline run into a
network failure for no gain, and the second fails deep inside the mint
with a connection error that never says offline was the cause.

The add-on check is skipped offline, leaving dnf to report a real
miss, the same way it already does when the index cannot be read. The
mint refuses before any socket opens and names the Connect feeds that
need a token, because a short-lived token cannot be replaced by
anything recorded locally. A stage that uses no Connect feed still
returns early and is unaffected.

connect_feed_stores_the_rewrite_decision mints a token, so it now
reads the flag and joins the offline serial key.

Signed-off-by: Javier Tia <javier@peridio.com>
Snapshot pinning talks to the feed on every feed-touching command: it
confirms the locked pin still exists, looks for a newer snapshot, and
with no pin fetches the channel's latest and records it. Under
--offline each of those is a request that cannot succeed, so a project
with a perfectly good pin in avocado.lock could still not build.

Offline, a matching pin is exported as-is and a line says which pin is
in use and that no newer-snapshot check was made, printed once per run
so a stale pin is never silent and never repeated per install task.
With no pin, the default avocado feed is refused with a message naming
`avocado update`, because that feed always publishes snapshots and the
missing pin is a gap one online run fills. A custom feed proceeds
unpinned with a one-time note, since a feed that serves no snapshots
can never have a pin and refusing would make offline unusable there.

`avocado update` refuses offline before any request, but only after
the override and missing-release checks, which need no network and
still return their usual answer.

Signed-off-by: Javier Tia <javier@peridio.com>
--offline changes what several commands do without the network, and
two of those changes are easy to misread: a locked pin is used however
old it is, and the package manager inside the SDK container is not
made offline at all. Without a page, a user reads the flag as "builds
work without a network" and is surprised by both.

docs/offline.md states what the CLI skips, what happens with no
locked pin on the default feed versus another repository, which
commands still need the network and fail naming --offline, and what
the flag leaves to dnf. The CHANGELOG entry summarises the same and
points at the page.

Signed-off-by: Javier Tia <javier@peridio.com>
cargo audit reports a spin loop in quinn-udp 0.5.14 after a truncated
datagram, and the pre-push hook refuses every push of a branch built on
main while the lockfile still pins it.

A lockfile-only bump to 0.5.16, the patched release inside the same
semver range. It becomes a no-op on rebase once main carries the same
bump.

Signed-off-by: Javier Tia <javier@peridio.com>
Bring the stack base's latest main merge into the offline-flag branch so
the PR stops conflicting. CHANGELOG.md collided in the Unreleased/Added
list: the offline entry and the feed index and package-scriptlet entries
were all added at the same spot, so both sides are kept.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant