forked from toolshed/abra
fix: Throws an error when trying to deploy unstaged changes version
This commit is contained in:
parent
b6573720ec
commit
124a91c67f
@ -1,6 +1,7 @@
|
|||||||
package recipe
|
package recipe
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
@ -67,6 +68,9 @@ func (r Recipe) EnsureExists() error {
|
|||||||
|
|
||||||
// EnsureVersion checks whether a specific version exists for a recipe.
|
// EnsureVersion checks whether a specific version exists for a recipe.
|
||||||
func (r Recipe) EnsureVersion(version string) (bool, error) {
|
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
|
isChaosCommit := false
|
||||||
|
|
||||||
if err := gitPkg.EnsureGitRepo(r.Dir); err != nil {
|
if err := gitPkg.EnsureGitRepo(r.Dir); err != nil {
|
||||||
|
@ -25,6 +25,17 @@ teardown(){
|
|||||||
_reset_app
|
_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
|
# bats test_tags=slow
|
||||||
@test "deploy version written to env" {
|
@test "deploy version written to env" {
|
||||||
run $ABRA app deploy "$TEST_APP_DOMAIN" "0.1.0+1.20.0" --no-input --no-converge-checks
|
run $ABRA app deploy "$TEST_APP_DOMAIN" "0.1.0+1.20.0" --no-input --no-converge-checks
|
||||||
|
Loading…
x
Reference in New Issue
Block a user