Add family artifact selection and provenance
This commit is contained in:
@@ -53,6 +53,8 @@ type AnalyzeArtifactRecord struct {
|
||||
Status AnalyzeArtifactStatus `json:"status"`
|
||||
FingerprintVersion int `json:"fingerprint_version,omitempty"`
|
||||
Fingerprint string `json:"fingerprint,omitempty"`
|
||||
Family string `json:"family,omitempty"`
|
||||
CharacterID string `json:"character_id,omitempty"`
|
||||
Dependencies []string `json:"dependencies,omitempty"`
|
||||
Output *ArtifactRecord `json:"output,omitempty"`
|
||||
OutputSize int64 `json:"output_size,omitempty"`
|
||||
@@ -134,6 +136,14 @@ func validateAnalyzeArtifactRecord(mapKey string, record AnalyzeArtifactRecord)
|
||||
if err := validateAnalyzeDependencies(record.Dependencies); err != nil {
|
||||
return err
|
||||
}
|
||||
if (record.Family == "") != (record.CharacterID == "") {
|
||||
return fmt.Errorf("family and character_id must be present together")
|
||||
}
|
||||
if record.Family != "" {
|
||||
if !artifactpolicy.IsConfiguredKey(record.Family) || !artifactpolicy.IsConfiguredKey(record.CharacterID) {
|
||||
return fmt.Errorf("family and character_id must match ^[a-z][a-z0-9_]*$")
|
||||
}
|
||||
}
|
||||
if err := validateAnalyzeFingerprint(record.FingerprintVersion, record.Fingerprint, record.Status == AnalyzeArtifactCurrent); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user