Skip to content

Commit

Permalink
feat: add a new field "envs" to overrides (#2320)
Browse files Browse the repository at this point in the history
* feat: add a new field "envs" to overrides

* docs: update JSON Schema
  • Loading branch information
suzuki-shunsuke authored Oct 8, 2023
1 parent fc54fb3 commit ae873cf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions json-schema/registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@
},
"append_ext": {
"type": "boolean"
},
"envs": {
"$ref": "#/$defs/SupportedEnvs"
}
},
"additionalProperties": false,
Expand Down
5 changes: 5 additions & 0 deletions pkg/config/registry/override.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
1 change: 1 addition & 0 deletions pkg/config/registry/package_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ae873cf

Please sign in to comment.