From 1aa7016789d7f2a4b334643ab9db23afe8ccab58 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Mon, 18 Aug 2025 08:56:52 +0200 Subject: [PATCH] fix: skip name validation for remote recipes See https://git.coopcloud.tech/toolshed/abra/pulls/601 --- cli/internal/validate.go | 4 +++- tests/integration/recipe_lint.bats | 12 +++++++----- tests/integration/recipe_upgrade.bats | 12 +++++++----- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/cli/internal/validate.go b/cli/internal/validate.go index 2ea6cd47..9c067db4 100644 --- a/cli/internal/validate.go +++ b/cli/internal/validate.go @@ -59,7 +59,9 @@ func ValidateRecipe(args []string, cmdName string) recipe.Recipe { } if _, ok := knownRecipes[recipeName]; !ok { - log.Fatalf("no recipe '%s' exists?", recipeName) + if !strings.Contains(recipeName, "/") { + log.Fatalf("no recipe '%s' exists?", recipeName) + } } chosenRecipe := recipe.Get(recipeName) diff --git a/tests/integration/recipe_lint.bats b/tests/integration/recipe_lint.bats index 14b34520..3829e747 100644 --- a/tests/integration/recipe_lint.bats +++ b/tests/integration/recipe_lint.bats @@ -22,14 +22,16 @@ teardown(){ } @test "retrieve recipe if missing" { - run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE" - assert_success - assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE" + if [[ -d "$ABRA_DIR/recipe/custom-html" ]]; then + run rm -rf "$ABRA_DIR/recipes/custom-html" + assert_success + assert_not_exists "$ABRA_DIR/recipes/custom-html" + fi - run $ABRA recipe lint "$TEST_RECIPE" + run $ABRA recipe lint custom-html assert_success - assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE" + assert_exists "$ABRA_DIR/recipes/custom-html" } @test "bail if unstaged changes and no --chaos" { diff --git a/tests/integration/recipe_upgrade.bats b/tests/integration/recipe_upgrade.bats index 8e7c949e..0ab89759 100644 --- a/tests/integration/recipe_upgrade.bats +++ b/tests/integration/recipe_upgrade.bats @@ -30,15 +30,17 @@ teardown(){ } @test "retrieve recipe if missing" { - run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE" - assert_success - assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE" + if [[ -d "$ABRA_DIR/recipe/custom-html" ]]; then + run rm -rf "$ABRA_DIR/recipes/custom-html" + assert_success + assert_not_exists "$ABRA_DIR/recipes/custom-html" + fi - run $ABRA recipe upgrade "$TEST_RECIPE" --no-input + run $ABRA recipe upgrade "custom-html" --no-input assert_success assert_output --partial 'can upgrade service: app' - assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE" + assert_exists "$ABRA_DIR/recipes/custom-html" } @test "error if unstaged changes" {