Documentation
¶
Overview ¶
Package test checks a generated registry.json against the release it describes.
registry.json is what aqua installs from, and a pull request carrying one is merged without a human reading it, so this is where the trust in the file comes from. The generator established the same things when it wrote the file; checking them again here is what makes the merge safe rather than a matter of believing the generator.
What can be checked depends on the machine. An asset in a format this machine can't open is reported and passed over rather than failed, which is why this runs on a matrix: between the runners, every format a registry holds is opened somewhere.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Environments ¶ added in v0.0.8
Environments lists the environments the files describe, sorted, without repeats.
The checks run one job per environment, on a machine of that environment, and the jobs are worked out from this: a fixed list would leave an entry for an environment nobody thought of unchecked, which is the one thing a merge gate must not do.
Types ¶
type ChecksumChecker ¶ added in v0.15.57
type ChecksumChecker interface {
CheckListedChecksum(ctx context.Context, logger *slog.Logger, version string, asset *generate.Asset, checksumURL, assetName string, cfg *aquaregistry.Checksum) error
}
ChecksumChecker compares a downloaded asset with what the checksum file a definition names lists for it.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller checks registry.json files.
func New ¶
func New(verifier Verifier, env Environment) *Controller
New creates a Controller. An empty environment checks every entry.
func (*Controller) Run ¶
func (c *Controller) Run(ctx context.Context, logger *slog.Logger, pkgName string, paths []string) error
Run checks every file and fails if any of them didn't hold up.
Every file is checked before returning rather than stopping at the first failure: a pull request adding several versions should say what is wrong with all of them.
func (*Controller) RunTemplate ¶ added in v0.15.57
func (c *Controller) RunTemplate(ctx context.Context, logger *slog.Logger, cfg *aquag2.Config, checksums ChecksumChecker) error
RunTemplate checks a package served as a template by installing the versions its definition lists for testing: each is expanded the way aqua expands it, and every entry of the environment is downloaded, opened, checked for the files it names and the signatures it claims, and held to the checksum file the definition names when it names one.
Nothing was generated for such a package, so these versions -- the newest and one at each boundary of its version_overrides -- are what stands between a definition and what aqua installs, as a pkg.yaml does in aqua-registry. A package that says why it can't be installed in CI is only reported.
type Environment ¶ added in v0.0.8
Environment is one os and arch, as an entry names them.
func (Environment) Empty ¶ added in v0.0.8
func (e Environment) Empty() bool
Empty says the caller named no environment, so every entry is checked.
func (Environment) String ¶ added in v0.0.8
func (e Environment) String() string
String renders the environment the way a registry writes it.