Documentation
¶
Overview ¶
Package support holds the integration-test harness: a fake GHCR blob server, a synthetic Sigstore fixture for minting real attestation bundles, a fixture tarball builder, and the testscript commands that glue them into .txtar scripts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CmdAttestReferrer ¶ added in v0.19.0
func CmdAttestReferrer(ts *testscript.TestScript, neg bool, args []string)
CmdAttestReferrer is the "gale-attest-referrer" script command.
Usage:
gale-attest-referrer <package> <lockfile> <identity-repo>
It wires the fake GHCR to serve an OCI referrers index, a referrer manifest, and a real signed Sigstore bundle for <package> whose certificate identity names <identity-repo> (pass anything other than kelp/gale-recipes to mint a bundle that must fail verification on identity mismatch). It rewrites <lockfile> so the package carries the matching manifest_digest and writes the fixture's trusted root to $WORK/trusted_root.json. Scripts then point GALE_SIGSTORE_TRUSTED_ROOT at that file and set GALE_SIGSTORE_TEST_NO_SCT=1 (synthetic fixtures cannot mint SCTs) so `gale verify` runs native in-process verification entirely against the fake registry — no real network, no GitHub token.
func CmdFixture ¶
func CmdFixture(ts *testscript.TestScript, neg bool, args []string)
CmdFixture is the "gale-fixture" script command.
Subcommands:
gale-fixture recipes <dst>
Copy fixtures/recipes/* to <dst>, expanding
placeholders (__GHCR_URL__, __<NAME>_PAYLOAD_SHA__,
etc.) against the current script environment.
gale-fixture render <template-rel-path> <dst>
Read a template from $FIXTURES/<template-rel-path>,
substitute placeholders, write to <dst> (strips
.tmpl suffix if present).
gale-fixture register-blob <url-path> <payload-name>
Ask the fake GHCR to serve <payload-name> at
<url-path>. Overrides the default route.
gale-fixture serve-file <url-path> <src-file>
Serve the contents of <src-file> at <url-path>
on the fake GHCR (raw bytes, not a tarball).
func EnvNameForSHA ¶
EnvNameForSHA converts a payload name to its env var.
Types ¶
type FakeGHCR ¶
type FakeGHCR struct {
URL string
// contains filtered or unexported fields
}
FakeGHCR serves fixture tarballs over HTTP so install scenarios exercise the real download/extract path without touching real GHCR.
func StartFakeGHCR ¶
StartFakeGHCR launches an httptest server. The server serves every registered payload at the URL declared via Register(path, name). By default every payload is registered under /blobs/<name>/any.
func (*FakeGHCR) AttestReferrer ¶ added in v0.19.0
AttestReferrer registers an OCI referrers index, a referrer manifest, and a Sigstore bundle blob for the package's image manifest under the kelp/gale-recipes/<name> repository path. The bundle is a REAL signed sigstoretest bundle: its subject digest equals the returned image manifest digest, and its certificate identity (SAN + SourceRepositoryURI) names identityRepo ("owner/name"). Pass a repo other than the one gale verifies against (kelp/gale-recipes) to mint a bundle that must fail verification on identity mismatch.
It returns the manifest digest the caller records in the lockfile (so gale derives the same referrers URL and verifies the same subject) plus the trusted_root.json bytes the bundle chains to, for GALE_SIGSTORE_TRUSTED_ROOT.
The OCI bytes are minimal but shaped exactly like what gale parses:
- referrers index: {"manifests":[{digest, artifactType: "application/vnd.dev.sigstore.bundle.v0.3+json"}]}
- referrer manifest: {"layers":[{digest: <bundle blob digest>}]}
- bundle blob: the signed Sigstore bundle JSON.
func (*FakeGHCR) RegisterContent ¶ added in v0.16.0
RegisterContent serves raw bytes at urlPath. Used for non-tarball responses like index.tsv or .versions files.
type Payload ¶
type Payload struct {
TarballPath string // absolute path to the .tar.zst on disk
SHA256 string // hex sha256 of the tarball
}
Payload is a pre-built fixture tarball served by the fake GHCR.
type Payloads ¶
Payloads maps payload name to its metadata.
func BuildPayloads ¶
BuildPayloads walks fixturesRoot/payloads/ and builds a tar.zst archive per subdir. Each archive is named <name>.tar.zst under tmpRoot and is registered in the returned Payloads struct. Called once per test run.