Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
errordeveloper committed Oct 10, 2023
1 parent a502143 commit 623d855
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions oci/artefact.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,22 +372,21 @@ func SemVerTagsFromAttestations(ctx context.Context, tag name.Tag, sourceAttesta
if len(entries.EntryGroups[0]) == 0 {
return []name.Tag{}
}
groupSummary, ok := entries.EntryGroups[0][0].Full().(*git.GitSummary)

// TODO: try to use generics for this?
groupSummary, ok := entries.EntryGroups[0][0].Full().(*git.Summary)
if !ok {
return []name.Tag{}
}
if len(groupSummary.Reference.Tags) == 0 {
ref := groupSummary.Git.Reference
if len(ref.Tags) == 0 {
return []name.Tag{}
}

tags := make([]name.Tag, 0, len(groupSummary.Reference.Tags))

// TODO: detect tags with groupSummary.Path+"/" as prefix and priorities them
for i := range groupSummary.Reference.Tags {
t := groupSummary.Reference.Tags[i].Name
fmt.Println(t)
if semver.IsValid(t) {
tags = append(tags, tag.Context().Tag(t))
tags := make([]name.Tag, 0, len(ref.Tags))
for i := range ref.Tags {
if semver.IsValid(ref.Tags[i].Name) {
tags = append(tags, tag.Context().Tag(ref.Tags[i].Name))
}
}
if len(tags) == 0 {
Expand Down

0 comments on commit 623d855

Please sign in to comment.