forked from toolshed/abra
fix: auto-config ssh urls and push to them
This commit is contained in:
@ -14,6 +14,7 @@ import (
|
||||
"coopcloud.tech/abra/pkg/limit"
|
||||
"coopcloud.tech/abra/pkg/recipe"
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"github.com/go-git/go-git/v5"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
@ -154,6 +155,7 @@ If you have a Hub account you can have Abra log you in to avoid this. Pass
|
||||
catl[recipeMeta.Name] = recipe.RecipeMeta{
|
||||
Name: recipeMeta.Name,
|
||||
Repository: recipeMeta.CloneURL,
|
||||
SSHURL: recipeMeta.SSHURL,
|
||||
Icon: recipeMeta.AvatarURL,
|
||||
DefaultBranch: recipeMeta.DefaultBranch,
|
||||
Description: recipeMeta.Description,
|
||||
@ -212,7 +214,17 @@ If you have a Hub account you can have Abra log you in to avoid this. Pass
|
||||
}
|
||||
|
||||
if internal.Push {
|
||||
if err := gitPkg.Push(cataloguePath, false); err != nil {
|
||||
repo, err := git.PlainOpen(cataloguePath)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
sshURL := fmt.Sprintf(config.SSH_URL_TEMPLATE, "recipes")
|
||||
if err := gitPkg.CreateRemote(repo, "origin-ssh", sshURL, internal.Dry); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
if err := gitPkg.Push(cataloguePath, "origin-ssh", false, internal.Dry); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user