Compare commits

...

1 Commits

Author SHA1 Message Date
124a91c67f fix: Throws an error when trying to deploy unstaged changes version
All checks were successful
continuous-integration/drone/pr Build is passing
2024-12-30 15:48:38 +01:00
2 changed files with 15 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package recipe
import (
"errors"
"fmt"
"os"
"strings"
@ -67,6 +68,9 @@ func (r Recipe) EnsureExists() error {
// EnsureVersion checks whether a specific version exists for a recipe.
func (r Recipe) EnsureVersion(version string) (bool, error) {
if strings.Contains(version, "+ unstaged changes") {
return true, errors.New("A chaos version is configured. \nMaybe your coworker deployed a local version of the recipe?\nOr did you forget to add --chaos?")
}
isChaosCommit := false
if err := gitPkg.EnsureGitRepo(r.Dir); err != nil {

View File

@ -25,6 +25,17 @@ teardown(){
_reset_app
}
# bats test_tags=slow
@test "fails to deploy + unstaged changes version" {
run sed -i 's/TYPE=abra-test-recipe.*/TYPE=git.coopcloud.tech\/coop-cloud\/abra-test-recipe:111111 + unstaged changes/g' \
"$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
assert_success
run $ABRA app deploy "$TEST_APP_DOMAIN" --no-input
assert_failure
assert_output --partial 'A chaos version is configured. \nMaybe your coworker deployed a local version of the recipe?\nOr did you forget to add --chaos?'
}
# bats test_tags=slow
@test "deploy version written to env" {
run $ABRA app deploy "$TEST_APP_DOMAIN" "0.1.0+1.20.0" --no-input --no-converge-checks