diff --git a/json-schema/registry.json b/json-schema/registry.json index 3a926dc2a..d35f5a4b9 100644 --- a/json-schema/registry.json +++ b/json-schema/registry.json @@ -341,6 +341,9 @@ }, "append_ext": { "type": "boolean" + }, + "envs": { + "$ref": "#/$defs/SupportedEnvs" } }, "additionalProperties": false, diff --git a/pkg/config/registry/override.go b/pkg/config/registry/override.go index 2a8861d1f..79d993838 100644 --- a/pkg/config/registry/override.go +++ b/pkg/config/registry/override.go @@ -30,5 +30,10 @@ func (ov *Override) Match(rt *runtime.Runtime) bool { if ov.GOArch != "" && ov.GOArch != rt.GOARCH { return false } + if ov.Envs != nil { + if !matchEnvs(ov.Envs, rt.GOOS, rt.GOARCH, rt.GOOS+"/"+rt.GOARCH, false) { + return false + } + } return true } diff --git a/pkg/config/registry/package_info.go b/pkg/config/registry/package_info.go index c6eef1c83..51f9580c9 100644 --- a/pkg/config/registry/package_info.go +++ b/pkg/config/registry/package_info.go @@ -134,6 +134,7 @@ type Override struct { Cosign *Cosign `json:"cosign,omitempty"` SLSAProvenance *SLSAProvenance `json:"slsa_provenance,omitempty" yaml:"slsa_provenance,omitempty"` AppendExt *bool `json:"append_ext,omitempty" yaml:"append_ext,omitempty"` + Envs SupportedEnvs `yaml:",omitempty" json:"envs,omitempty"` } func (p *PackageInfo) Copy() *PackageInfo {