Add stash provider bootstrap support
The new command set is: flux bootstrap bitbucket-server --owner=<project> --username=<user> --repository=<repository name> --hostname=<domain> --token-auth There is a parity in the capabilities with the other providers. Signed-off-by: Soule BA <soule@weave.works>
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/fluxcd/go-git-providers/github"
|
||||
"github.com/fluxcd/go-git-providers/gitlab"
|
||||
"github.com/fluxcd/go-git-providers/gitprovider"
|
||||
"github.com/fluxcd/go-git-providers/stash"
|
||||
)
|
||||
|
||||
// BuildGitProvider builds a gitprovider.Client for the provided
|
||||
@@ -51,6 +52,14 @@ func BuildGitProvider(config Config) (gitprovider.Client, error) {
|
||||
if client, err = gitlab.NewClient(config.Token, "", opts...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case GitProviderStash:
|
||||
opts := []gitprovider.ClientOption{}
|
||||
if config.Hostname != "" {
|
||||
opts = append(opts, gitprovider.WithDomain(config.Hostname))
|
||||
}
|
||||
if client, err = stash.NewStashClient(config.Username, config.Token, opts...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported Git provider '%s'", config.Provider)
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ type GitProvider string
|
||||
const (
|
||||
GitProviderGitHub GitProvider = "github"
|
||||
GitProviderGitLab GitProvider = "gitlab"
|
||||
GitProviderStash GitProvider = "stash"
|
||||
)
|
||||
|
||||
// Config defines the configuration for connecting to a GitProvider.
|
||||
@@ -33,6 +34,10 @@ type Config struct {
|
||||
// e.g. github.example.com.
|
||||
Hostname string
|
||||
|
||||
// Username contains the username used to authenticate with
|
||||
// the Provider.
|
||||
Username string
|
||||
|
||||
// Token contains the token used to authenticate with the
|
||||
// Provider.
|
||||
Token string
|
||||
|
||||
Reference in New Issue
Block a user