fix: clone https url by default
Catalogue package had to be merged into the recipe package due to too many circular import errors. Also, use https url for cloning, assume folks don't have ssh setup by default (the whole reason for the refactor).
This commit is contained in:
@ -1,13 +1,18 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
configPkg "coopcloud.tech/abra/pkg/config"
|
||||
"github.com/go-git/go-git/v5"
|
||||
"github.com/go-git/go-git/v5/config"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Push pushes the latest changes
|
||||
func Push(repoPath string) error {
|
||||
commitRepo, err := git.PlainOpen(repoPath)
|
||||
func Push(recipeName string, tags bool) error {
|
||||
recipeDir := path.Join(configPkg.RECIPES_DIR, recipeName)
|
||||
commitRepo, err := git.PlainOpen(recipeDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -15,8 +20,19 @@ func Push(repoPath string) error {
|
||||
if err := commitRepo.Push(&git.PushOptions{}); err != nil {
|
||||
return err
|
||||
}
|
||||
logrus.Info("git changes pushed")
|
||||
|
||||
logrus.Info("changes pushed")
|
||||
if tags {
|
||||
pushOpts := &git.PushOptions{
|
||||
RefSpecs: []config.RefSpec{
|
||||
config.RefSpec("+refs/tags/*:refs/tags/*"),
|
||||
},
|
||||
}
|
||||
if err := commitRepo.Push(pushOpts); err != nil {
|
||||
return err
|
||||
}
|
||||
logrus.Info("git tags pushed")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user