feature/docker-action #11

Merged
kjuulh merged 11 commits from feature/docker-action into v0.1 2022-09-18 11:51:23 +02:00
3 changed files with 19 additions and 10 deletions
Showing only changes of commit 64e9f8dca8 - Show all commits

1
.gitignore vendored
View File

@ -1 +1,2 @@
.cuddle/
.env

View File

@ -2,7 +2,9 @@ package providers
import (
"context"
"errors"
"fmt"
"strings"
"time"
"git.front.kjuulh.io/kjuulh/kraken/internal/services/signer"
@ -63,12 +65,12 @@ func NewGit(logger *zap.Logger, gitConfig *GitConfig, openPGP *signer.OpenPGP) *
}
func (g *Git) GetOriginHEADForRepo(ctx context.Context, gitRepo *GitRepo) (string, error) {
remote, err := gitRepo.repo.Remote("origin")
auth, err := g.GetAuth()
if err != nil {
return "", err
}
auth, err := g.GetAuth()
remote, err := gitRepo.repo.Remote("origin")
if err != nil {
return "", err
}
@ -82,11 +84,16 @@ func (g *Git) GetOriginHEADForRepo(ctx context.Context, gitRepo *GitRepo) (strin
headRef := ""
for _, ref := range refs {
if !ref.Name().IsBranch() {
headRef = ref.Target().Short()
//g.logger.Debug(ref.String())
if ref.Name().IsBranch() && strings.Contains(ref.String(), "/heads/") {
headRef = ref.Name().Short()
}
}
if headRef == "" {
return "", errors.New("no upstream HEAD branch could be found")
}
return headRef, nil
}
@ -143,8 +150,8 @@ func (g *Git) Clone(ctx context.Context, storageArea *storage.Area, repoUrl stri
URL: repoUrl,
Auth: auth,
RemoteName: "origin",
ReferenceName: "refs/heads/main",
SingleBranch: true,
// ReferenceName: "refs/heads/main",
SingleBranch: false,
NoCheckout: false,
Depth: 1,
RecurseSubmodules: 1,
@ -292,7 +299,6 @@ func (g *Git) Push(ctx context.Context, gitRepo *GitRepo) error {
CABundle: []byte{},
RequireRemoteRefs: []config.RefSpec{},
})
if err != nil {
return err
}

View File

@ -2,4 +2,6 @@
set -e
export $(cat .env | xargs)
go run cmd/server/server.go start