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)
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ func createReleaseFromTag(recipe recipe.Recipe, tagString, mainAppVersion string
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
if err := pushRelease(recipe.Dir()); err != nil {
|
||||
if err := pushRelease(recipe); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
@ -308,7 +308,7 @@ func tagRelease(tagString string, repo *git.Repository) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func pushRelease(recipeDir string) error {
|
||||
func pushRelease(recipe recipe.Recipe) error {
|
||||
if internal.Dry {
|
||||
logrus.Info("dry run: no changes pushed")
|
||||
return nil
|
||||
@ -325,7 +325,7 @@ func pushRelease(recipeDir string) error {
|
||||
}
|
||||
|
||||
if internal.Push {
|
||||
if err := gitPkg.Push(recipeDir, true); err != nil {
|
||||
if err := recipe.Push(internal.Dry); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -403,7 +403,7 @@ func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recip
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
if err := pushRelease(recipe.Dir()); err != nil {
|
||||
if err := pushRelease(recipe); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user