Skip to content

Commit

Permalink
Removed unused glDefaultVisibility and changed to RepositoryVisibilit…
Browse files Browse the repository at this point in the history
…y from hardcoded strings
  • Loading branch information
nagyv committed Jul 4, 2024
1 parent 9c0631d commit 82c150a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/flux/bootstrap_gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"strings"
"time"

"github.com/fluxcd/go-git-providers/gitprovider"
"github.com/fluxcd/pkg/git"
"github.com/fluxcd/pkg/git/gogit"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -76,7 +77,6 @@ the bootstrap command will perform an upgrade if needed.`,
const (
glDefaultPermission = "maintain"
glDefaultDomain = "gitlab.com"
glDefaultVisibility = "private"
glTokenEnvVar = "GITLAB_TOKEN"
gitlabProjectRegex = `\A[[:alnum:]\x{00A9}-\x{1f9ff}_][[:alnum:]\p{Pd}\x{00A9}-\x{1f9ff}_\.]*\z`
)
Expand Down Expand Up @@ -138,7 +138,7 @@ func bootstrapGitLabCmdRun(cmd *cobra.Command, args []string) error {
}

if !gitlabArgs.private {
gitlabArgs.visibility = "public"
gitlabArgs.visibility.Set(string(gitprovider.RepositoryVisibilityPublic))
cmd.Println("Using visibility public as --private=false")
}

Expand Down
2 changes: 1 addition & 1 deletion internal/flags/gitlab_visibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (d *GitLabVisibility) String() string {

func (d *GitLabVisibility) Set(str string) error {
if strings.TrimSpace(str) == "" {
str = "private"
str = string(gitprovider.RepositoryVisibilityPrivate)
}
if !utils.ContainsItemString(supportedGitLabVisibilities, str) {
return fmt.Errorf("unsupported visibility '%s', must be one of: %s",
Expand Down

0 comments on commit 82c150a

Please sign in to comment.