feature/docker-action #11

Merged
kjuulh merged 11 commits from feature/docker-action into v0.1 2022-09-18 11:51:23 +02:00
Showing only changes of commit c865b597c0 - Show all commits

View File

@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"strings"
"time"
"git.front.kjuulh.io/kjuulh/kraken/internal/services/signer"
@ -85,8 +84,8 @@ func (g *Git) GetOriginHEADForRepo(ctx context.Context, gitRepo *GitRepo) (strin
headRef := ""
for _, ref := range refs {
//g.logger.Debug(ref.String())
if ref.Name().IsBranch() && strings.Contains(ref.String(), "/heads/") {
headRef = ref.Name().Short()
if !ref.Name().IsBranch() {
headRef = ref.Target().Short()
}
}
@ -114,7 +113,7 @@ func (g *Git) CloneBranch(ctx context.Context, storageArea *storage.Area, repoUr
Auth: auth,
RemoteName: "origin",
ReferenceName: plumbing.NewBranchReferenceName(branch),
SingleBranch: true,
SingleBranch: false,
NoCheckout: false,
Depth: 1,
RecurseSubmodules: 1,
@ -125,7 +124,7 @@ func (g *Git) CloneBranch(ctx context.Context, storageArea *storage.Area, repoUr
}
repo, err := git.PlainCloneContext(ctx, storageArea.Path, false, &cloneOptions)
if err != nil {
if err != nil && !errors.Is(err, git.NoErrAlreadyUpToDate) {
return nil, err
}
@ -150,7 +149,7 @@ func (g *Git) Clone(ctx context.Context, storageArea *storage.Area, repoUrl stri
URL: repoUrl,
Auth: auth,
RemoteName: "origin",
// ReferenceName: "refs/heads/main",
ReferenceName: "refs/heads/main",
SingleBranch: false,
NoCheckout: false,
Depth: 1,
@ -252,7 +251,7 @@ func (g *Git) CreateBranch(ctx context.Context, gitRepo *GitRepo) error {
InsecureSkipTLS: false,
CABundle: []byte{},
})
if err != nil {
if err != nil && !errors.Is(err, git.NoErrAlreadyUpToDate) {
return fmt.Errorf("could not pull from origin: %w", err)
}