Repository navigation
feat: install drivers from HTTP URL templates in dbc.toml - #621
Conversation
The hash of an HTTP source archive without a checksum file is now only measured, like the one of a registry archive without a published hash: the signature, the extraction checks and the version in its MANIFEST are checked by the installation. dbc sync --no-verify no longer refuses to measure an archive of a signed HTTP source.
The signer checks and the description of an unsigned pin are shared with HTTP sources now, so they say source. A locked HTTP source is also told apart by its own type rather than as any type but registry.
…ly with the same signer
… variant targets
dbc sync --locked now checks a driver of an HTTP source against its lock
entry like planHTTP does, without fetching a checksum file, and reports a
removed declaration, a switch between an HTTP source and a registry, a
changed url template or version, and a signer that the source no longer
selects together with the other problems. The registries are never
consulted for such a driver.
A url template only has {os} and {arch}, so it would give a musl or
variant target the archive of the plain target. HTTP sources now reject
such targets, declared, implicit or recorded in the lock file. The checksum
file errors also name the format that dbc reads.
…oving the lock file Removing the driver's entry is enough; removing the whole lock file may also select newer versions of the other drivers.
The signer is now checked even when the url template changed, so that a key change is reported together with it, and an unsupported target of the driver list is reported once. A recorded artifact that cannot be replayed tells to remove only that driver's lock entry, since dbc lock would reject it again.
…d checksum files Use a sub-table in the example, since a multi-line inline table is TOML 1.1 only.
273e0ea to
cea83ce
Compare
…P source Pin a recorded URL that the template does not give, a missing artifact for this platform and a registry entry for a driver that now has an HTTP source.
…d also when its signer is not accepted A recorded URL that the template does not give is now reported together with a signer that the source no longer selects.
|
8272e19 rejects musl and architecture variants for HTTP sources, adds HTTP replay to The dedicated update command is tracked in #196. Could you take another look at the target restriction and HTTP replay under |
zeroshade
left a comment
There was a problem hiding this comment.
Re-reviewed; LGTM.
- Target restriction:
checkHTTPTargetrejects musl and variant targets, whether declared or (with no platforms declared) the current platform.checkHTTPArtifactsalso rejects them when already recorded in the lock file, with a per-driver hint. This applies todbc lock,dbc syncanddbc sync --locked. --lockedreplay: HTTP entries go throughcheckLockedHTTPand never reachreplayLock/bind. The signer is checked even when the template changed, and recorded URLs are checked against the template even when the signer is rejected. Version and source changes are reported bylockMismatches/httpMismatches. Nothing is fetched, because the replayed plan has no pending artifacts.- The sub-table example, the per-entry hint for unsigned sources, and the checksum format hint all look good.
Nit: in cmd/dbc/http_source.go, checksumFormatHint sits between checksumFor's doc comment and func checksumFor. Go treats that comment as part of the constant's doc, and checksumFor ends up with none. Moving the constant above the comment fixes it.
Let projects install off-registry dbc packages using HTTP URL templates in
dbc.toml(see #394).{version},{os}, and{arch}in the path. dbc does not discover available versions, soversionmust be a full version ("1.2.0"or"=1.2.0");{version}expands to it, including any prerelease or build metadata. Unknown HTTP source keys are errors. An HTTP source can name a key from the project's[signing_keys](feat: share project signing keys across sources #620), use the built-in key by default, or opt out withsigning_key = false. Registry sources rejectsigning_keyandchecksum_url.linux_amd64_muslorlinux_amd64_v3) cannot be installed from an HTTP source yet. A template cannot tell those targets from the plain target, so HTTP sources reject them, including artifacts already recorded for them.checksum_urlwhen set, as GNUsha256sumlines or as a single hash for a file that serves one archive. Otherwise, it records the first download's SHA-256 and size. As in refactor: letdbc lockpin measured archives without checking them #623, locking extracts an archive only to check an applicable v1 library checksum. At installation,dbc syncchecks the archive, itsMANIFESTversion, and any required library signature. dbc warns when a new hash comes from a declared plain HTTP URL.DBC_BASE_URLdoes not affect HTTP sources.dbc syncrejects a changed source or a recorded URL that no longer matches the template.dbc lockcan relock an explicitly changed source subject to signer continuity. Each unsigned source is a signer of its own, so changing an unsigned source's template needs its lock entry removed first; the error says so. Removing the HTTP declaration stops both commands without a registry search.dbc sync --locked: Installs from the recorded artifacts without updating the lockfile or fetching a checksum file or registry index. The HTTP declaration, URL template, exact version, and pinned signer must still match.version_list_url, extracting them with a regex, JSON path or expression, so thatlatestand version prefixes work. A similar source key would let an HTTP source take a version range; this version of dbc rejects such a key with a hint that a newer dbc may be required.