Compare commits

..

3 Commits

Author SHA1 Message Date
0759be6f8f fix regexp for _remove_tags bats output
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is passing
2026-01-20 21:14:11 -08:00
182fc41c58 added integration test
Some checks failed
continuous-integration/drone/push Build is failing
2026-01-16 14:27:27 -08:00
304ac87cec ensure repo is up to date before printing status
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2026-01-14 16:58:21 -08:00
6 changed files with 31 additions and 29 deletions

View File

@ -281,21 +281,13 @@ checkout as-is. Recipe commit hashes are also supported as values for
}
func getLatestVersionOrCommit(app appPkg.App) (string, error) {
recipeVersions, warnings, err := app.Recipe.GetRecipeVersions()
versions, err := app.Recipe.Tags()
if err != nil {
return "", err
}
for _, warning := range warnings {
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
}
if len(versions) > 0 && !internal.Chaos {
return versions[len(versions)-1], nil
}
head, err := app.Recipe.Head()

View File

@ -113,6 +113,13 @@ Use "--status/-S" flag to query all servers for the live deployment status.`),
totalAppsCount++
if status {
if err := app.Recipe.EnsureUpToDate(); err != nil {
log.Warnf(
"Failed to ensure repo is up to date for recipe: %s err: %s",
app.Recipe.Name,
err,
)
}
status := i18n.G("unknown")
version := i18n.G("unknown")
chaos := i18n.G("unknown")

View File

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

View File

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

View File

@ -67,6 +67,16 @@ teardown(){
assert_output --partial "$TEST_SERVER"
assert_output --partial "$TEST_APP_DOMAIN"
assert_output --partial "deployed"
assert_output --partial "latest"
_remove_tags
run $ABRA app ls --status
assert_success
assert_output --partial "$TEST_SERVER"
assert_output --partial "$TEST_APP_DOMAIN"
assert_output --partial "deployed"
assert_output --partial "latest"
}
@test "filter by server" {

View File

@ -17,7 +17,12 @@ _remove_tags(){
run bash -c 'git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag -l | wc -l'
assert_success
assert_output '0'
# If this was done without the --regexp I get this error:
# -- output differs --
# expected : 0
# actual : 0
# --
assert_output --regexp '[[:space:]]*0'
}
_reset_tags() {