From e45ba9b5a474b1c8b104a3e160bddcf355b3d508 Mon Sep 17 00:00:00 2001 From: Alexey Igrychev Date: Tue, 19 Oct 2021 21:01:12 +0100 Subject: [PATCH] feat(server): store trdl-channels.yaml in the default branch by default --- server/path_configure.go | 2 +- server/path_publish.go | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/server/path_configure.go b/server/path_configure.go index 57f7e8a3..de440d2c 100644 --- a/server/path_configure.go +++ b/server/path_configure.go @@ -39,7 +39,7 @@ func configurePath(b *Backend) *framework.Path { }, fieldNameGitTrdlChannelsBranch: { Type: framework.TypeString, - Description: "Git branch that contains trdl_channels.yaml configuration (trdl by default)", + Description: "Special git branch to store trdl_channels.yaml configuration", Required: false, }, fieldNameInitialLastPublishedGitCommit: { diff --git a/server/path_publish.go b/server/path_publish.go index 8c0d1ab8..65397e4a 100644 --- a/server/path_publish.go +++ b/server/path_publish.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/Masterminds/semver" - git "github.com/go-git/go-git/v5" + "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/plumbing/transport/http" "github.com/hashicorp/go-hclog" "github.com/hashicorp/vault/sdk/framework" @@ -24,8 +24,6 @@ import ( const ( storageKeyLastPublishedGitCommit = "last_published_git_commit" - - defaultGitTrdlChannelsBranch = "trdl" ) func NewErrPublishingNonExistingReleases(releases []string) error { @@ -88,11 +86,6 @@ func (b *Backend) pathPublish(ctx context.Context, req *logical.Request, fields gitPassword = gitCredentialFromStorage.Password } - gitBranch := cfg.GitTrdlChannelsBranch - if gitBranch == "" { - gitBranch = defaultGitTrdlChannelsBranch - } - lastPublishedGitCommit := cfg.InitialLastPublishedGitCommit { entry, err := req.Storage.Get(ctx, storageKeyLastPublishedGitCommit) @@ -119,6 +112,7 @@ func (b *Backend) pathPublish(ctx context.Context, req *logical.Request, fields logboek.Context(ctx).Default().LogF("Cloning git repo\n") hclog.L().Debug("Cloning git repo") + gitBranch := cfg.GitTrdlChannelsBranch gitRepo, err := cloneGitRepositoryBranch(cfg.GitRepoUrl, gitBranch, gitUsername, gitPassword) if err != nil { return fmt.Errorf("unable to clone git repository: %s", err)