Skip to content

Commit

Permalink
feat(server): store trdl-channels.yaml in the default branch by default
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-igrychev committed Oct 19, 2021
1 parent d6fbe64 commit e45ba9b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion server/path_configure.go
Expand Up @@ -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: {
Expand Down
10 changes: 2 additions & 8 deletions server/path_publish.go
Expand Up @@ -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"
Expand All @@ -24,8 +24,6 @@ import (

const (
storageKeyLastPublishedGitCommit = "last_published_git_commit"

defaultGitTrdlChannelsBranch = "trdl"
)

func NewErrPublishingNonExistingReleases(releases []string) error {
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit e45ba9b

Please sign in to comment.