Skip to content

bits 0.8.0 - #158

Open
pbuncic wants to merge 360 commits into
mainfrom
optimisation
Open

pbuncic wants to merge 360 commits into
mainfrom
optimisation

Conversation

@pbuncic

@pbuncic pbuncic commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

bits 0.8.0

Rolls the optimisation branch up as the 0.8.0 release: everything since 0.7 (2026-11-01), including the interim 0.7.1 and v0.7.2 tags, which never took entries out of the changelog. 41 features, 46 changes, 44 improvements, 148 fixes. The full list is the # 0.8.0 section of CHANGELOG.md; the headline work is below.

The release is dominated by bits-store — a site package store that bits reads, writes, and certifies through over HTTP with short-lived tokens — and the console/orchestrator work that drives and audits it. Alongside that: build reuse and planning fixes, source/pip handling, container builds, the recipes/ layout, and relocatable RPMs.

The site package store (bits-store)

A bits-store+https://host/store store reads pre-built packages by hash without listing the store, and takes uploads (--write-store / ::rw) with a store token — the revision marker first, then the build, in parts above 5 GiB; an object already stored under its hash is kept and its sha256 recorded. bits publish --manifest and bits certify write the BOM, NOTICE, source offer, SBOMs and the pipeline record through it. Signed reuse reads its manifests from the service's /MANIFESTS.

Builds that may not be redistributed (redistributable: sources|none) go to a per-community private /restricted, signed by bits-store and reused only when that signature verifies over the downloaded bytes (keys under keys/restricted/). A build records who uploaded each object it keeps (stored_by), and a certified manifest carries each package's full approval chain (approvals: the uploader, then every certification, in time order).

Source and package fetches route through the store where a site configures it: a sources store (store.sources) and a restricted one (store.sources_restricted), a public pypi index (store.pypi → PIP_INDEX_URL), a git mirror (store.git, insteadOf for https clones/fetches), and a crates registry (store.crates) mounted into build containers. bits store add-source URL FILE uploads an archive no build can fetch itself. pip packages are pinned: the first build records the exact file pip installed by sha256, and later builds install only that file (BITS_PIP_PIN); a group can also build its pip packages from source (system.pip_build, or --pip-build).

Console & orchestrator

bits login logs the terminal into bits-console (a console session in ~/.bits/console-session, approved with an enrolled passkey; --group is now optional and yields the group's store token), and bits logout revokes it. CI jobs get their own store token (POST /ops/ci/store-token, $BITS_STORE_TOKEN_FILE), scoped to the community and platform the console dispatched the pipeline for.

The console backend grew the data behind its tabs without GitLab: running-build progress from pushed metrics (/ops/builds?progress=1), CVMFS and Monitoring snapshots, build host and queued_by, a developers role that can read logs and failures but not secrets, and overall-admin views over bits-store (summary/objects/access, history series, git mirror and upstream fills, and where a build's packages live). Admin actions on the store (withdraw, lift, delete, GC plan/apply) go through its admin API with per-action minute tokens, audited. The orchestrator folds bits-store's own problems into issues beside build failures.

Build, reuse & planning

Reuse no longer queries the store for already-installed packages, and the revision counter reuses the plan's store listings instead of re-asking. The reuse plan (bits build --dry-run) now recognises an installed package by its .build-hash even when the cached tarball has been pruned, matching what the build does (#157). Container builds can use podman (--container-engine podman, rootless) and confine the work dir on shared hosts (--docker --confine-work-dir). --run-tests tests the top package without failing the build; build-failure reports name the host OS, the container, and the step bits was in with its last log lines.

Packaging & distribution

bits rpm builds relocatable RPMs of built packages (#150). bits cvmfs publish gained --compress, --publish-path ingest-batch, defaults variables as path slots ({root_release}), and --require-signed-installed. bits prune was reworked: --stored-tarballs [DAYS], --leftovers, per-architecture listing, and TARS link cleanup. bits upgrade --hold keeps a package in its release series. Patches now apply to packages built from a git source (#148).

Recipes & sources

Recipe repositories may put package recipes under recipes/, searched after the checkout root, with root recipes winning on a name clash, so flat and mixed checkouts both work (#151). file:// sources and patches are hashed by their bytes, take a ,algo:hex checksum after the path, are copied rather than cached/mirrored, and are re-extracted when the local archive changes.

Fixes

148 fixes, concentrated in the orchestrator's certification and manifest handling, bits-store reuse and token scoping, bits cleanup/prune dry-run accuracy, the build sandbox, and init.sh generation. See the # 0.8.0 section of CHANGELOG.md for the complete list.


This PR is the optimisation line; tag the merge 0.8.0 (the version comes from the git tag, so there is no source bump).

The sweep removed every tarball sentinel, so a second bits run in the same
work dir lost its claims and both fetched the same file. Kept unless the
owner is gone, the PID is ours, or it is older than the 600 s wait; the
source glob now matches SOURCES/cache.
A "+" or "(" in a package or version (tauola++, 1.0+cms) left its version
links unparsed, so a revision already taken could be handed out again; "("
(or "++" on Python 3.8-3.10) did not compile and stopped bits.
It was built for every package, with xcodebuild on macOS, and a dead second
block rebuilt it after success for development packages. Now in
report_build_failure, called only on failure; the message is unchanged.
The excerpt read the whole log into memory, which can be gigabytes, once per
failed package with --builders. It now reads the last 16 MiB.
A recipe's hook: name becomes a variable name, which was not quoted: with
--docker, a name with ";" ran its command on the host.
A value with '"' broke build.sh and one with "$" or a backquote was
expanded (no longer); a name with a space or ";" ran as shell code.
run_hooks splits on commas: a YAML list was joined with "_" (or raised a
TypeError with --docker), a SYMLINK_STAGE list was not found, and an
empty hook stopped a build without --docker.
The expression runs in bash on the host, outside any container, and got
the whole environment: CI, store and forge tokens included.
The hooks are recipe-repository scripts run on the host, outside any
container, and got the whole environment: CI, store and forge tokens.
The wipe ran only for recipes with patches, so a tree patched before kept
the dropped patches. A tree never patched is still left as it is.
An interrupted unpack of the same hash left files there, and the next
unpack moved them into the installed package with its own.
cversion and cpath are used nowhere, in bits or in any recipe repository;
under set -e a host or image without gcc stopped there, silently.
The marker is written in place; one cut short by a kill made json.loads
raise, and the build stopped on every run until it was removed by hand.
HTTP and boto3 took the first object under the hash, whatever its name;
another object listed first was downloaded and the package rebuilt.
The installed .meta.json is this run's record, so who built the package
was lost; the tarball's own .meta.json is now kept in it as "origin".
A node with no sequence memory (a fresh home) is protected from a manifest
put back only by expires; the orchestrator writes it, a manual sign may not.
The way to hand a recipe a credential once native builds no longer
inherit them, without its value on a command line; it set NAME empty.
A native build's recipe ran on the host with every token but the S3 keys;
a container build gets only its -e variables. -e NAME passes one on.
The marker was written at upload, after the build; two builds of one
version with different hashes could both take N. Now the number is
claimed when picked, and one taken meanwhile is skipped.
The self-copy replaces all metadata; it set the sha256 alone, dropping
bits-by (who uploaded it) and the content type.
Upload is check-then-put: two builds of one hash both upload, the last
stays, and the first recorded its own sha256. Reading it back after the
upload narrows that window.
The marker was written before the try that turns a refused restricted
upload into "kept on this host"; its refusal stopped the build instead.
An rsync or s3:// read store with a b3:// write store went to the rsync
or s3cmd backend, which took the b3 URL as its own write store.
Every fetch of a file wrote <file>.tmp; two bits runs (or threads) in one
work dir fetching it at once wrote into the same file.
fetch_symlinks removed every link before reading the store's, and a
hash-only store has none: local revisions were lost and reused.
getRetry answers None for both; a store outage then rebuilt packages
and refetched sources as if the store were empty, said only by the GET.
The URL's last segment went unquoted into "mkdir -p; cp", run on the
host outside any sandbox: a ";" or "$(...)" in it was executed.
Branch, tag and repository went unquoted into one shell command on the
host; each step is now an argument list, and a part starting with "-"
is refused.
pip_options and pip= from the URL went into a shell command on the
host; pip now runs from an argument list, and pip= names a pip only.
Its re-sign failed after the removals when a certification landed between
the check and the signing.
bits login's console session and POST /store/token's token (were 8 h);
bits login --group's store token keeps its day.
The revision scan ignores dangling symlinks, so a link naming a tarball that is
not in this work dir cannot change what it picks; for a package the plan found
installed the tarball is here already, and create_version_link rebuilds the
local link for every package anyway. Querying per package delayed a full pool's
first build by ~90 s. Untested here: needs a run against a real store.
The plan lists the store 16 keys at a time and threw the cache away; the loop's
revision counter then asked for the same keys one at a time, a connection each.
Only listings made live this run are handed over - the cache behind them also
holds entries up to 60 days old - and not at all with a write store, which the
loop clears on the first devel package. No key is foreseen yet, so no gain yet.
A package already installed was left out of the plan's listings - the plan does
not need it - but the counter still asks the store about every remote hash of a
package reused at a localN revision, because _revs ignores local object names.
That was one serial request per reused package, ~80 s before the first build of
a full pool. Listed 16 at a time now, and not at all for --dry-run.
The site had no index page, and the FAQ and the task index were built
but not in the navigation, so readers could not reach them.
TASKS no longer links to the README, which is outside the site.
The README is outside docs/, so the relative links were dead on the
site. The address works there and on GitHub.
The README repeated the user guide and the reference (2,800 words), so
newcomers met every option before a first build. What it dropped is in
those documents; the FAQ and the chat cases that cited the dropped
sections now cite them there.
The README no longer said where bits comes from; the user guide did.
It also states that an AI model helped write code and documentation.
Newcomers had no page that leads through one build without choices.
It builds ROOT in a container on EL9 and ends in a shell where it runs.
Output of a real run is still to be pasted in (TODO comments).
MkDocs and GitHub differ for headings with '/', '&' or ':', so 95 of
the 582 links between sections worked on GitHub and were dead on the
site. With GitHub's rule one link works in both.
Terms such as platform and architecture, or the two kinds of profile,
were defined where first used, in several places and wordings.
Each now has one short definition that links to its section.
Old spellings were explained inline wherever the current one is, about
60 times. This page lists each once, with its replacement and whether
it still works, so the inline notes can go.
…ants

381 sourced recipes were each fetched on every build - the phase that failed on
a dropped github connection. A mirror stamped within 8 hours whose refs already
name every tag the build needs is left alone; anything else fetches, so a
just-bumped recipe still works. Refs are read off disk, never through git: a
--filter=tree:0 mirror is a promisor, where asking git about a missing object
fetches it over the network. A name that is also a branch is never cached, as
the build resolves refs/heads first. --force-fetch overrides the window for a
tag moved upstream; bits status and init stamp mirrors too, so a status run
suppresses the next build's fetch. BITS_FETCH_TTL=0 restores the old behaviour.
Not detected: a ref whose object was pruned, until the window lapses.
Notes on former spellings interrupted the guide in twelve places. They
are replaced by one pointer in Configuration; the FAQ and two chat
cases that are about old names now cite the renamed page.
Option rows and command descriptions carried about thirty notes on
former spellings. They are on the renamed page; two chat cases about
old names cite it. A silent trap (architecture: shared) keeps a line.
…bles

The docs sent upgraders from bits.rc to environment variables. Most of
those settings are the community's, in the system: section of its
defaults-release.sh; the rest is saved with bits use.
ALICE's names, images and store were mentioned as asides in six places
of the installation chapter, so every reader had to parse them.
They are now one list under Platforms; the other places link to it.
Development setup, source files, tests and contributing sat between
the architecture and the command reference, in front of what users
look up. They are now docs/DEVELOPING.md; the text is unchanged.
GitHub shows it to anyone opening an issue or a pull request; the
rules were only in a section of the reference. It is a summary that
points to docs/DEVELOPING.md.
Sixteen option rows ran to 400-1000 characters and no longer read as
a table. Each keeps what the option does; the rest moves, unchanged in
substance, to a list under the same table, so links and headings stay.
With none of its signed manifests in a store whose /MANIFESTS holds the
orchestrator's marker, nothing is certified for it yet: it reuses
nothing instead of stopping (a new platform needed the flag).
Thirteen more rows (prune, compliance, recipe fields, one variable)
ran to 440-1000 characters. Each keeps what it is for; the detail
moves to a list under the same table. No heading or link changes.
The reuse plan found an install only through its TARS tarball, so a pruned
tarball made --dry-run (and the prefetch) plan a rebuild though the install
tree still matched. Probe the install dir by .build-hash too, as the build
already does before fetching a tarball. Fixes #157.
Roll the Unreleased section up as 0.8.0 — everything on optimisation since
0.7 — and add the #157 fix entry, whose code landed without a changelog line.
Open a fresh Unreleased for later work.
They imported pytest, which the CI's tox env does not install: every job
failed on the import, and unittest would not have collected them anyway.
A finder of a flaw in bits had only the public issue tracker. Reports
go through GitHub's private vulnerability reporting; fixes are made on
main and the latest release.
ROADMAP.md is gone, but the navigation, the README and three documents
still pointed to it, so the site menu had a dead entry and readers
dead links.
On macOS CI python3 from PATH lacked requests: bitsStore now takes BITS_PYTHON,
which its tests set. Tests no longer leak AWS keys, S3 settings or BITS_PATH;
bits closes the prepare's pipe and its in-use files, and servers are closed.

This branch has not been deployed

No deployments
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