fix: no gitops on recipe for "app new"

Closes coop-cloud/organising#408
This commit is contained in:
2023-02-15 00:49:22 +01:00
parent 992e675921
commit 312b93e794
11 changed files with 33 additions and 17 deletions

View File

@ -587,7 +587,11 @@ func GetStringInBetween(recipeName, str, start, end string) (result string, err
}
// EnsureUpToDate ensures that the local repo is synced to the remote
func EnsureUpToDate(recipeName string) error {
func EnsureUpToDate(recipeName string, conf *runtime.Config) error {
if !conf.EnsureRecipeLatest {
return nil
}
recipeDir := path.Join(config.RECIPES_DIR, recipeName)
isClean, err := gitPkg.IsClean(recipeDir)
@ -932,10 +936,8 @@ func ReadReposMetadata() (RepoCatalogue, error) {
}
// GetRecipeVersions retrieves all recipe versions.
func GetRecipeVersions(recipeName string, opts ...runtime.Option) (RecipeVersions, error) {
func GetRecipeVersions(recipeName string, conf *runtime.Config) (RecipeVersions, error) {
versions := RecipeVersions{}
conf := runtime.New(opts...)
recipeDir := path.Join(config.RECIPES_DIR, recipeName)
logrus.Debugf("attempting to open git repository in %s", recipeDir)
@ -1037,7 +1039,7 @@ func GetRecipeCatalogueVersions(recipeName string, catl RecipeCatalogue) ([]stri
}
// UpdateRepositories clones and updates all recipe repositories locally.
func UpdateRepositories(repos RepoCatalogue, recipeName string) error {
func UpdateRepositories(repos RepoCatalogue, recipeName string, conf *runtime.Config) error {
var barLength int
if recipeName != "" {
barLength = 1
@ -1071,7 +1073,7 @@ func UpdateRepositories(repos RepoCatalogue, recipeName string) error {
logrus.Fatal(err)
}
if err := EnsureUpToDate(rm.Name); err != nil {
if err := EnsureUpToDate(rm.Name, conf); err != nil {
logrus.Fatal(err)
}