Compare commits

...

3 Commits

Author SHA1 Message Date
a51a3b57f6 change usage of tags to recipe versions in deploy.go
Some checks failed
continuous-integration/drone/push Build is failing
2026-01-11 19:32:03 +01:00
683a3bbf3d Merge branch 'main' into fixBrokenRecipeCheckout
Some checks failed
continuous-integration/drone/push Build is failing
2026-01-11 18:19:12 +00:00
ae9e49e1b5 fix: breaking GetRecipeVersions when an invalid recipe version exists
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2026-01-11 19:00:49 +01:00
3 changed files with 28 additions and 8 deletions

View File

@ -281,13 +281,21 @@ checkout as-is. Recipe commit hashes are also supported as values for
} }
func getLatestVersionOrCommit(app appPkg.App) (string, error) { func getLatestVersionOrCommit(app appPkg.App) (string, error) {
versions, err := app.Recipe.Tags() recipeVersions, warnings, err := app.Recipe.GetRecipeVersions()
if err != nil { if err != nil {
return "", err return "", err
} }
if len(versions) > 0 && !internal.Chaos { for _, warning := range warnings {
return versions[len(versions)-1], nil log.Warn(warning)
}
if len(recipeVersions) > 0 && !internal.Chaos {
latest := recipeVersions[len(recipeVersions)-1]
for tag := range latest {
log.Debug(i18n.G("selected latest recipe version: %s (from %d available versions)", tag, len(recipeVersions)))
return tag, nil
}
} }
head, err := app.Recipe.Head() head, err := app.Recipe.Head()

View File

@ -98,10 +98,14 @@ var AppNewCommand = &cobra.Command{
var recipeVersions recipePkg.RecipeVersions var recipeVersions recipePkg.RecipeVersions
if recipeVersion == "" { if recipeVersion == "" {
var err error var err error
recipeVersions, _, err = recipe.GetRecipeVersions() var warnings []string
recipeVersions, warnings, err = recipe.GetRecipeVersions()
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
for _, warning := range warnings {
log.Warn(warning)
}
} }
if len(recipeVersions) > 0 { if len(recipeVersions) > 0 {
@ -110,6 +114,8 @@ var AppNewCommand = &cobra.Command{
recipeVersion = tag recipeVersion = tag
} }
log.Debug(i18n.G("selected recipe version: %s (from %d available versions)", recipeVersion, len(recipeVersions)))
if _, err := recipe.EnsureVersion(recipeVersion); err != nil { if _, err := recipe.EnsureVersion(recipeVersion); err != nil {
log.Fatal(err) log.Fatal(err)
} }

View File

@ -403,15 +403,18 @@ func (r Recipe) GetRecipeVersions() (RecipeVersions, []string, error) {
Branch: plumbing.ReferenceName(ref.Name()), Branch: plumbing.ReferenceName(ref.Name()),
} }
if err := worktree.Checkout(checkOutOpts); err != nil { if err := worktree.Checkout(checkOutOpts); err != nil {
log.Debug(i18n.G("failed to check out %s in %s", tag, r.Dir)) log.Debug(i18n.G("failed to check out %s in %s: %s", tag, r.Dir, err))
return err warnMsg = append(warnMsg, i18n.G("skipping tag %s: checkout failed: %s", tag, err))
return nil
} }
log.Debug(i18n.G("git checkout: %s in %s", ref.Name(), r.Dir)) log.Debug(i18n.G("git checkout: %s in %s", ref.Name(), r.Dir))
config, err := r.GetComposeConfig(nil) config, err := r.GetComposeConfig(nil)
if err != nil { if err != nil {
return err log.Debug(i18n.G("failed to get compose config for %s: %s", tag, err))
warnMsg = append(warnMsg, i18n.G("skipping tag %s: invalid compose config: %s", tag, err))
return nil
} }
versionMeta := make(map[string]ServiceMeta) versionMeta := make(map[string]ServiceMeta)
@ -419,7 +422,9 @@ func (r Recipe) GetRecipeVersions() (RecipeVersions, []string, error) {
img, err := reference.ParseNormalizedNamed(service.Image) img, err := reference.ParseNormalizedNamed(service.Image)
if err != nil { if err != nil {
return err log.Debug(i18n.G("failed to parse image for %s in %s: %s", service.Name, tag, err))
warnMsg = append(warnMsg, i18n.G("skipping tag %s: invalid image reference in service %s: %s", tag, service.Name, err))
return nil
} }
path := reference.Path(img) path := reference.Path(img)
@ -445,6 +450,7 @@ func (r Recipe) GetRecipeVersions() (RecipeVersions, []string, error) {
return nil return nil
}); err != nil { }); err != nil {
log.Warn(i18n.G("GetRecipeVersions encountered error for %s: %s (collected %d versions)", r.Name, err, len(versions)))
return versions, warnMsg, nil return versions, warnMsg, nil
} }