Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .dagger/publishimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ func (m *HarborCli) PublishImageAndSign(
// Generate SBOM (SPDX JSON) for the published image
sbom := m.GenerateSBOM(
ctx,
addr,
registryUsername,
addr,
registryUsername,
registryPassword,
);
)

// Attest SBOM to the image using Cosign in-toto attestation
if _, err := m.AttestSBOM(
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/artifact/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"fmt"

"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/prompt"
"github.com/goharbor/harbor-cli/pkg/utils"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/artifact/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ package artifact
import (
"github.com/goharbor/go-client/pkg/sdk/v2.0/client/artifact"
"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/prompt"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/goharbor/harbor-cli/pkg/views/artifact/view"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down
13 changes: 3 additions & 10 deletions cmd/harbor/root/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package root
import (
"fmt"
"io"
"time"

"github.com/goharbor/harbor-cli/cmd/harbor/root/artifact"
"github.com/goharbor/harbor-cli/cmd/harbor/root/configurations"
Expand All @@ -38,8 +37,8 @@ import (
"github.com/goharbor/harbor-cli/cmd/harbor/root/user"
"github.com/goharbor/harbor-cli/cmd/harbor/root/vulnerability"
"github.com/goharbor/harbor-cli/cmd/harbor/root/webhook"
"github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -69,17 +68,11 @@ harbor help
// Initialize configuration
utils.InitConfig(cfgFile, userSpecifiedConfig)

// Conditionally set the timestamp format only in verbose mode
formatter := &logrus.TextFormatter{}

if verbose {
formatter.FullTimestamp = true
formatter.TimestampFormat = time.RFC3339
logrus.SetLevel(logrus.DebugLevel)
log.SetLevel(log.LevelDebug)
} else {
logrus.SetOutput(io.Discard)
log.SetOutput(io.Discard)
}
logrus.SetFormatter(formatter)

return nil
},
Expand Down
8 changes: 4 additions & 4 deletions cmd/harbor/root/context/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"reflect"
"strings"

log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -81,9 +81,9 @@ If you specify --name, that credential (rather than the "current" one) will be u
}

if found {
logrus.Infof("Removed credential '%s' and cleared CurrentCredentialName", currentName)
log.Infof("Removed credential '%s' and cleared CurrentCredentialName", currentName)
} else {
logrus.Infof("No credential named '%s' found; cleared CurrentCredentialName anyway", currentName)
log.Infof("No credential named '%s' found; cleared CurrentCredentialName anyway", currentName)
}

return nil
Expand Down Expand Up @@ -111,7 +111,7 @@ If you specify --name, that credential (rather than the "current" one) will be u

// 5. Confirm to the user (no error here)
canonicalPath := strings.Join(actualSegments, ".")
logrus.Infof("Successfully cleared %s", canonicalPath)
log.Infof("Successfully cleared %s", canonicalPath)

return nil
},
Expand Down
8 changes: 4 additions & 4 deletions cmd/harbor/root/context/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"strconv"
"strings"

log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -67,9 +67,9 @@ If you specify --name, that credential (rather than the "current" one) will be u
return fmt.Errorf("failed to save updated config: %w", err)
}

// 5. Confirm to the user (logrus.Info is fine here; no error)
// 5. Confirm to the user (log.Info is fine here; no error)
canonicalPath := strings.Join(actualSegments, ".")
logrus.Infof("Successfully updated %s to '%s'", canonicalPath, newValue)
log.Infof("Successfully updated %s to '%s'", canonicalPath, newValue)

return nil
},
Expand Down Expand Up @@ -251,7 +251,7 @@ func encryptPassword(plaintext string) (string, error) {
// Make sure a key exists
if err := utils.GenerateEncryptionKey(); err != nil {
// It's okay if the key already exists; that might not be a fatal error for you
logrus.Debugf("Encryption key might already exist: %v", err)
log.Debugf("Encryption key might already exist: %v", err)
}

key, err := utils.GetEncryptionKey()
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (

"github.com/goharbor/harbor-cli/cmd/harbor/internal/version"
"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/goharbor/harbor-cli/pkg/views/info/list"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/labels/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"fmt"

"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/goharbor/harbor-cli/pkg/views/label/list"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (

"github.com/goharbor/go-client/pkg/harbor"
"github.com/goharbor/go-client/pkg/sdk/v2.0/client/user"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/goharbor/harbor-cli/pkg/views/login"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"golang.org/x/term"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (

"github.com/goharbor/go-client/pkg/sdk/v2.0/models"
"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/utils"
list "github.com/goharbor/harbor-cli/pkg/views/logs"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/project/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"fmt"

"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/goharbor/harbor-cli/pkg/views/project/create"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/project/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"sync"

"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/prompt"
"github.com/goharbor/harbor-cli/pkg/utils"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/project/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"github.com/goharbor/go-client/pkg/sdk/v2.0/client/project"
"github.com/goharbor/go-client/pkg/sdk/v2.0/models"
"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/utils"
list "github.com/goharbor/harbor-cli/pkg/views/project/list"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/project/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (

proj "github.com/goharbor/go-client/pkg/sdk/v2.0/client/project"
"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/prompt"
"github.com/goharbor/harbor-cli/pkg/utils"
auditLog "github.com/goharbor/harbor-cli/pkg/views/project/logs"
log "github.com/sirupsen/logrus"

"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down
4 changes: 2 additions & 2 deletions cmd/harbor/root/project/member/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"fmt"

"github.com/goharbor/go-client/pkg/sdk/v2.0/models"
"github.com/sirupsen/logrus"
log "github.com/goharbor/harbor-cli/pkg/log"

"github.com/goharbor/harbor-cli/pkg/api"
"github.com/goharbor/harbor-cli/pkg/prompt"
Expand Down Expand Up @@ -89,7 +89,7 @@ func CreateMemberCommand() *cobra.Command {
}

if err != nil {
logrus.Errorf("failed to create user: %v", err)
log.Errorf("failed to create user: %v", err)
}

fmt.Printf("successfully added user %s to project %s\n", createView.MemberUser.Username, opts.ProjectName)
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/project/member/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"fmt"

"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/prompt"
"github.com/goharbor/harbor-cli/pkg/utils"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down
14 changes: 7 additions & 7 deletions cmd/harbor/root/project/robot/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
"github.com/goharbor/go-client/pkg/sdk/v2.0/models"
"github.com/goharbor/harbor-cli/pkg/api"
config "github.com/goharbor/harbor-cli/pkg/config/robot"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/prompt"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/goharbor/harbor-cli/pkg/views/robot/create"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -102,7 +102,7 @@ Examples:
if loadErr != nil {
return fmt.Errorf("failed to load robot config from file: %v", loadErr)
}
logrus.Info("Successfully loaded robot configuration")
log.Info("Successfully loaded robot configuration")
opts = *loadedOpts
if opts.ProjectName == "" {
opts.ProjectName = opts.Permissions[0].Namespace
Expand Down Expand Up @@ -196,7 +196,7 @@ Examples:
return fmt.Errorf("failed to create robot: %v", utils.ParseHarborErrorMsg(err))
}

logrus.Infof("Successfully created robot account '%s' (ID: %d)",
log.Infof("Successfully created robot account '%s' (ID: %d)",
response.Payload.Name, response.Payload.ID)

FormatFlag := viper.GetString("output-format")
Expand All @@ -209,14 +209,14 @@ Examples:
name, secret := response.Payload.Name, response.Payload.Secret

if exportToFile {
logrus.Info("Exporting robot credentials to file")
log.Info("Exporting robot credentials to file")
exportSecretToFile(name, secret, response.Payload.CreationTime.String(), response.Payload.ExpiresAt)
return nil
} else {
create.CreateRobotSecretView(name, secret)
err = clipboard.WriteAll(response.Payload.Secret)
if err != nil {
logrus.Errorf("failed to write to clipboard")
log.Errorf("failed to write to clipboard")
return nil
}
fmt.Println("secret copied to clipboard.")
Expand Down Expand Up @@ -246,10 +246,10 @@ func exportSecretToFile(name, secret, creationTime string, expiresAt int64) {
filename := fmt.Sprintf("%s-secret.json", name)
jsonData, err := json.MarshalIndent(secretJson, "", " ")
if err != nil {
logrus.Errorf("Failed to marshal secret to JSON: %v", err)
log.Errorf("Failed to marshal secret to JSON: %v", err)
} else {
if err := os.WriteFile(filename, jsonData, 0600); err != nil {
logrus.Errorf("Failed to write secret to file: %v", err)
log.Errorf("Failed to write secret to file: %v", err)
} else {
fmt.Printf("Secret saved to %s\n", filename)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/project/robot/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
"strconv"

"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/prompt"
"github.com/goharbor/harbor-cli/pkg/utils"
log "github.com/sirupsen/logrus"

"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/project/robot/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (

"github.com/goharbor/harbor-cli/pkg/api"
"github.com/goharbor/harbor-cli/pkg/constants"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/prompt"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/goharbor/harbor-cli/pkg/views/robot/list"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/project/robot/refresh.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (

"github.com/atotto/clipboard"
"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/prompt"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/goharbor/harbor-cli/pkg/views/robot/create"
log "github.com/sirupsen/logrus"

"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/project/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"fmt"

"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/goharbor/harbor-cli/pkg/views/project/list"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/project/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (

"github.com/goharbor/go-client/pkg/sdk/v2.0/client/project"
"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/prompt"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/goharbor/harbor-cli/pkg/views/project/view"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/quota/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (

"github.com/goharbor/go-client/pkg/sdk/v2.0/models"
"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/prompt"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/goharbor/harbor-cli/pkg/views/quota/update"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/registry/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"fmt"

"github.com/goharbor/harbor-cli/pkg/api"
log "github.com/goharbor/harbor-cli/pkg/log"
"github.com/goharbor/harbor-cli/pkg/utils"
"github.com/goharbor/harbor-cli/pkg/views/registry/list"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down
Loading
Loading