Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artifacts list view should contains tags #35

Open
jonsv322 opened this issue Dec 21, 2024 · 0 comments
Open

Artifacts list view should contains tags #35

jonsv322 opened this issue Dec 21, 2024 · 0 comments

Comments

@jonsv322
Copy link

The artifacts list view should include tags as well, it help out getting an overview if you have security issues on tagged versions.

diff --git a/pkg/views/artifact/list/view.go b/pkg/views/artifact/list/view.go
index 3b851ae..4632b0d 100644
--- a/pkg/views/artifact/list/view.go
+++ b/pkg/views/artifact/list/view.go
@@ -9,11 +9,13 @@ import (
        "github.com/goharbor/harbor-cli/pkg/views/base/tablelist"
        "os"
        "strconv"
+       "strings"
 )

 var columns = []table.Column{
        {Title: "ID", Width: 6},
        {Title: "Artifact Digest", Width: 20},
+       {Title: "Tags", Width: 20},
        {Title: "Type", Width: 12},
        {Title: "Size", Width: 12},
        {Title: "Vulnerabilities", Width: 15},
@@ -29,9 +31,16 @@ func ListArtifacts(artifacts []*models.Artifact) {
                for _, scan := range artifact.ScanOverview {
                        totalVulnerabilities += scan.Summary.Total
                }
+               tags := []string{}
+               if artifact.Tags != nil {
+                       for _, tag := range artifact.Tags {
+                               tags = append(tags, tag.Name)
+                       }
+               }
                rows = append(rows, table.Row{
                        strconv.FormatInt(int64(artifact.ID), 10),
                        artifact.Digest[:16],
+                       strings.Join(tags, ", "),
                        artifact.Type,
                        artifactSize,
                        strconv.FormatInt(totalVulnerabilities, 10),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant