forked from toolshed/abra
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			fix-integr
			...
			fix-panic-
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 4facfea7c2 | 
| @ -261,7 +261,7 @@ func init() { | |||||||
| 	AppCmdCommand.Flags().BoolVarP( | 	AppCmdCommand.Flags().BoolVarP( | ||||||
| 		&requestTTY, | 		&requestTTY, | ||||||
| 		"tty", | 		"tty", | ||||||
| 		"T", | 		"t", | ||||||
| 		false, | 		false, | ||||||
| 		"request remote TTY", | 		"request remote TTY", | ||||||
| 	) | 	) | ||||||
|  | |||||||
| @ -46,8 +46,7 @@ checkout as-is. Recipe commit hashes are also supported as values for | |||||||
| 	ValidArgsFunction: func( | 	ValidArgsFunction: func( | ||||||
| 		cmd *cobra.Command, | 		cmd *cobra.Command, | ||||||
| 		args []string, | 		args []string, | ||||||
| 		toComplete string, | 		toComplete string) ([]string, cobra.ShellCompDirective) { | ||||||
| 	) ([]string, cobra.ShellCompDirective) { |  | ||||||
| 		switch l := len(args); l { | 		switch l := len(args); l { | ||||||
| 		case 0: | 		case 0: | ||||||
| 			return autocomplete.AppNameComplete() | 			return autocomplete.AppNameComplete() | ||||||
| @ -100,9 +99,27 @@ checkout as-is. Recipe commit hashes are also supported as values for | |||||||
| 			log.Fatalf("%s is already deployed", app.Name) | 			log.Fatalf("%s is already deployed", app.Name) | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		toDeployVersion, toDeployChaosVersion, err = getDeployVersion(args, deployMeta, app) | 		if len(args) == 2 && args[1] != "" { | ||||||
| 		if err != nil { | 			toDeployVersion = args[1] | ||||||
| 			log.Fatal(err) | 		} | ||||||
|  |  | ||||||
|  | 		if !deployMeta.IsDeployed && | ||||||
|  | 			toDeployVersion == "" && | ||||||
|  | 			app.Recipe.EnvVersion != "" && !internal.IgnoreEnvVersion { | ||||||
|  | 			log.Debugf("new deployment, choosing .env version: %s", app.Recipe.EnvVersion) | ||||||
|  | 			toDeployVersion = app.Recipe.EnvVersion | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		if !internal.Chaos && toDeployVersion == "" { | ||||||
|  | 			if err := getLatestVersionOrCommit(app, &toDeployVersion); err != nil { | ||||||
|  | 				log.Fatal(err) | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		if internal.Chaos { | ||||||
|  | 			if err := getChaosVersion(app, &toDeployVersion, &toDeployChaosVersion); err != nil { | ||||||
|  | 				log.Fatal(err) | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if !internal.Chaos { | 		if !internal.Chaos { | ||||||
| @ -254,22 +271,32 @@ func getChaosVersion(app app.App, toDeployVersion, toDeployChaosVersion *string) | |||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
| func getLatestVersionOrCommit(app app.App) (string, string, error) { | func getLatestVersionOrCommit(app app.App, toDeployVersion *string) error { | ||||||
| 	versions, err := app.Recipe.Tags() | 	versions, err := app.Recipe.Tags() | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return "", "", err | 		return err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if len(versions) > 0 && !internal.Chaos { | 	if len(versions) > 0 && !internal.Chaos { | ||||||
| 		return versions[len(versions)-1], "", nil | 		*toDeployVersion = versions[len(versions)-1] | ||||||
|  |  | ||||||
|  | 		log.Debugf("choosing %s as version to deploy", *toDeployVersion) | ||||||
|  |  | ||||||
|  | 		if _, err := app.Recipe.EnsureVersion(*toDeployVersion); err != nil { | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		return nil | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	head, err := app.Recipe.Head() | 	head, err := app.Recipe.Head() | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return "", "", err | 		return err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return "", formatter.SmallSHA(head.String()), nil | 	*toDeployVersion = formatter.SmallSHA(head.String()) | ||||||
|  |  | ||||||
|  | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
| // validateArgsAndFlags ensures compatible args/flags. | // validateArgsAndFlags ensures compatible args/flags. | ||||||
| @ -296,46 +323,6 @@ func validateSecrets(cl *dockerClient.Client, app app.App) error { | |||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
| func getDeployVersion(cliArgs []string, deployMeta stack.DeployMeta, app app.App) (string, string, error) { |  | ||||||
| 	// Chaos mode overrides everything |  | ||||||
| 	if internal.Chaos { |  | ||||||
| 		v, err := app.Recipe.ChaosVersion() |  | ||||||
| 		if err != nil { |  | ||||||
| 			return "", "", err |  | ||||||
| 		} |  | ||||||
| 		log.Debugf("version: taking chaos version: %s", v) |  | ||||||
| 		return v, v, nil |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	// Check if the deploy version is set with a cli argument |  | ||||||
| 	if len(cliArgs) == 2 && cliArgs[1] != "" { |  | ||||||
| 		log.Debugf("version: taking version from cli arg: %s", cliArgs[1]) |  | ||||||
| 		return cliArgs[1], "", nil |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	// Check if the recipe has a version in the .env file |  | ||||||
| 	if app.Recipe.EnvVersion != "" && !internal.IgnoreEnvVersion { |  | ||||||
| 		log.Debugf("version: taking version from .env file: %s", app.Recipe.EnvVersion) |  | ||||||
| 		return app.Recipe.EnvVersion, "", nil |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	// Take deployed version |  | ||||||
| 	if deployMeta.IsDeployed { |  | ||||||
| 		log.Debugf("version: taking deployed version: %s", deployMeta.Version) |  | ||||||
| 		return deployMeta.Version, "", nil |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	v, vc, err := getLatestVersionOrCommit(app) |  | ||||||
| 	log.Debugf("version: taking new recipe versio: %s, %s", v, vc) |  | ||||||
| 	if err != nil { |  | ||||||
| 		log.Fatal(err) |  | ||||||
| 	} |  | ||||||
| 	if v == "" { |  | ||||||
| 		return vc, vc, nil |  | ||||||
| 	} |  | ||||||
| 	return v, vc, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| 	AppDeployCommand.Flags().BoolVarP( | 	AppDeployCommand.Flags().BoolVarP( | ||||||
| 		&internal.Chaos, | 		&internal.Chaos, | ||||||
|  | |||||||
| @ -123,13 +123,6 @@ Pass "--all-services/-a" to restart all services.`, | |||||||
| var allServices bool | var allServices bool | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| 	AppRestartCommand.Flags().BoolVarP( |  | ||||||
| 		&internal.Chaos, |  | ||||||
| 		"chaos", |  | ||||||
| 		"C", |  | ||||||
| 		false, |  | ||||||
| 		"ignore uncommitted recipes changes", |  | ||||||
| 	) |  | ||||||
| 	AppRestartCommand.Flags().BoolVarP( | 	AppRestartCommand.Flags().BoolVarP( | ||||||
| 		&allServices, | 		&allServices, | ||||||
| 		"all-services", | 		"all-services", | ||||||
|  | |||||||
| @ -59,16 +59,16 @@ Passing "--prune/-p" does not remove those volumes.`, | |||||||
| 			chaosVersion = deployMeta.ChaosVersion | 			chaosVersion = deployMeta.ChaosVersion | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		version := deployMeta.Version | 		toWriteVersion := deployMeta.Version | ||||||
| 		if deployMeta.IsChaos { | 		if deployMeta.IsChaos { | ||||||
| 			version = chaosVersion | 			toWriteVersion = chaosVersion | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if err := internal.UndeployOverview( | 		if err := internal.UndeployOverview( | ||||||
| 			app, | 			app, | ||||||
| 			deployMeta.Version, | 			deployMeta.Version, | ||||||
| 			chaosVersion, | 			chaosVersion, | ||||||
| 			version, | 			toWriteVersion, | ||||||
| 		); err != nil { | 		); err != nil { | ||||||
| 			log.Fatal(err) | 			log.Fatal(err) | ||||||
| 		} | 		} | ||||||
| @ -86,6 +86,10 @@ Passing "--prune/-p" does not remove those volumes.`, | |||||||
| 				log.Fatal(err) | 				log.Fatal(err) | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | 		if err := app.WriteRecipeVersion(toWriteVersion, false); err != nil { | ||||||
|  | 			log.Fatalf("writing recipe version failed: %s", err) | ||||||
|  | 		} | ||||||
| 	}, | 	}, | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -49,7 +49,7 @@ func NewVersionOverview( | |||||||
| 	releaseNotes string) error { | 	releaseNotes string) error { | ||||||
| 	deployConfig := "compose.yml" | 	deployConfig := "compose.yml" | ||||||
| 	if composeFiles, ok := app.Env["COMPOSE_FILE"]; ok { | 	if composeFiles, ok := app.Env["COMPOSE_FILE"]; ok { | ||||||
| 		deployConfig = formatComposeFiles(composeFiles) | 		deployConfig = composeFiles | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	server := app.Server | 	server := app.Server | ||||||
| @ -64,7 +64,10 @@ func NewVersionOverview( | |||||||
|  |  | ||||||
| 	upperKind := strings.ToUpper(kind) | 	upperKind := strings.ToUpper(kind) | ||||||
|  |  | ||||||
| 	envVersion := app.Recipe.EnvVersionRaw | 	envVersion, err := recipe.GetEnvVersionRaw(app.Recipe.Name) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if envVersion == "" { | 	if envVersion == "" { | ||||||
| 		envVersion = config.NO_VERSION_DEFAULT | 		envVersion = config.NO_VERSION_DEFAULT | ||||||
| @ -125,10 +128,6 @@ func NewVersionOverview( | |||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
| func formatComposeFiles(composeFiles string) string { |  | ||||||
| 	return strings.ReplaceAll(composeFiles, ":", "\n") |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // DeployOverview shows a deployment overview | // DeployOverview shows a deployment overview | ||||||
| func DeployOverview( | func DeployOverview( | ||||||
| 	app appPkg.App, | 	app appPkg.App, | ||||||
| @ -141,7 +140,7 @@ func DeployOverview( | |||||||
| ) error { | ) error { | ||||||
| 	deployConfig := "compose.yml" | 	deployConfig := "compose.yml" | ||||||
| 	if composeFiles, ok := app.Env["COMPOSE_FILE"]; ok { | 	if composeFiles, ok := app.Env["COMPOSE_FILE"]; ok { | ||||||
| 		deployConfig = formatComposeFiles(composeFiles) | 		deployConfig = composeFiles | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	server := app.Server | 	server := app.Server | ||||||
| @ -226,7 +225,7 @@ func UndeployOverview( | |||||||
| ) error { | ) error { | ||||||
| 	deployConfig := "compose.yml" | 	deployConfig := "compose.yml" | ||||||
| 	if composeFiles, ok := app.Env["COMPOSE_FILE"]; ok { | 	if composeFiles, ok := app.Env["COMPOSE_FILE"]; ok { | ||||||
| 		deployConfig = formatComposeFiles(composeFiles) | 		deployConfig = composeFiles | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	server := app.Server | 	server := app.Server | ||||||
|  | |||||||
| @ -4,13 +4,11 @@ import ( | |||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"os" | 	"os" | ||||||
| 	"slices" | 	"slices" | ||||||
| 	"sort" |  | ||||||
| 	"strings" | 	"strings" | ||||||
|  |  | ||||||
| 	"coopcloud.tech/abra/pkg/formatter" | 	"coopcloud.tech/abra/pkg/formatter" | ||||||
| 	gitPkg "coopcloud.tech/abra/pkg/git" | 	gitPkg "coopcloud.tech/abra/pkg/git" | ||||||
| 	"coopcloud.tech/abra/pkg/log" | 	"coopcloud.tech/abra/pkg/log" | ||||||
| 	"coopcloud.tech/tagcmp" |  | ||||||
| 	"github.com/distribution/reference" | 	"github.com/distribution/reference" | ||||||
| 	"github.com/go-git/go-git/v5" | 	"github.com/go-git/go-git/v5" | ||||||
| 	"github.com/go-git/go-git/v5/plumbing" | 	"github.com/go-git/go-git/v5/plumbing" | ||||||
| @ -347,18 +345,6 @@ func (r Recipe) Tags() ([]string, error) { | |||||||
| 		return tags, err | 		return tags, err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	sort.Slice(tags, func(i, j int) bool { |  | ||||||
| 		version1, err := tagcmp.Parse(tags[i]) |  | ||||||
| 		if err != nil { |  | ||||||
| 			return false |  | ||||||
| 		} |  | ||||||
| 		version2, err := tagcmp.Parse(tags[j]) |  | ||||||
| 		if err != nil { |  | ||||||
| 			return false |  | ||||||
| 		} |  | ||||||
| 		return version1.IsLessThan(version2) |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	log.Debugf("detected %s as tags for recipe %s", strings.Join(tags, ", "), r.Name) | 	log.Debugf("detected %s as tags for recipe %s", strings.Join(tags, ", "), r.Name) | ||||||
|  |  | ||||||
| 	return tags, nil | 	return tags, nil | ||||||
|  | |||||||
| @ -135,8 +135,6 @@ func GetEnvVersionRaw(name string) (string, error) { | |||||||
|  |  | ||||||
| func Get(name string) Recipe { | func Get(name string) Recipe { | ||||||
| 	version := "" | 	version := "" | ||||||
| 	versionRaw := "" |  | ||||||
| 	dirty := false |  | ||||||
| 	if strings.Contains(name, ":") { | 	if strings.Contains(name, ":") { | ||||||
| 		split := strings.Split(name, ":") | 		split := strings.Split(name, ":") | ||||||
| 		if len(split) > 2 { | 		if len(split) > 2 { | ||||||
| @ -145,9 +143,7 @@ func Get(name string) Recipe { | |||||||
| 		name = split[0] | 		name = split[0] | ||||||
|  |  | ||||||
| 		version = split[1] | 		version = split[1] | ||||||
| 		versionRaw = version |  | ||||||
| 		if strings.HasSuffix(version, config.DIRTY_DEFAULT) { | 		if strings.HasSuffix(version, config.DIRTY_DEFAULT) { | ||||||
| 			dirty = true |  | ||||||
| 			version = strings.Replace(split[1], config.DIRTY_DEFAULT, "", 1) | 			version = strings.Replace(split[1], config.DIRTY_DEFAULT, "", 1) | ||||||
| 			log.Debugf("removed dirty suffix from .env version: %s -> %s", split[1], version) | 			log.Debugf("removed dirty suffix from .env version: %s -> %s", split[1], version) | ||||||
| 		} | 		} | ||||||
| @ -171,13 +167,11 @@ func Get(name string) Recipe { | |||||||
| 	dir := path.Join(config.RECIPES_DIR, escapeRecipeName(name)) | 	dir := path.Join(config.RECIPES_DIR, escapeRecipeName(name)) | ||||||
|  |  | ||||||
| 	r := Recipe{ | 	r := Recipe{ | ||||||
| 		Name:          name, | 		Name:       name, | ||||||
| 		EnvVersion:    version, | 		EnvVersion: version, | ||||||
| 		EnvVersionRaw: versionRaw, | 		Dir:        dir, | ||||||
| 		Dirty:         dirty, | 		GitURL:     gitURL, | ||||||
| 		Dir:           dir, | 		SSHURL:     sshURL, | ||||||
| 		GitURL:        gitURL, |  | ||||||
| 		SSHURL:        sshURL, |  | ||||||
|  |  | ||||||
| 		ComposePath:   path.Join(dir, "compose.yml"), | 		ComposePath:   path.Join(dir, "compose.yml"), | ||||||
| 		ReadmePath:    path.Join(dir, "README.md"), | 		ReadmePath:    path.Join(dir, "README.md"), | ||||||
| @ -193,14 +187,12 @@ func Get(name string) Recipe { | |||||||
| } | } | ||||||
|  |  | ||||||
| type Recipe struct { | type Recipe struct { | ||||||
| 	Name string | 	Name       string | ||||||
| 	// EnvVersion without +U | 	EnvVersion string | ||||||
| 	EnvVersion    string | 	Dirty      bool // NOTE(d1): git terminology for unstaged changes | ||||||
| 	EnvVersionRaw string | 	Dir        string | ||||||
| 	Dirty         bool // NOTE(d1): git terminology for unstaged changes | 	GitURL     string | ||||||
| 	Dir           string | 	SSHURL     string | ||||||
| 	GitURL        string |  | ||||||
| 	SSHURL        string |  | ||||||
|  |  | ||||||
| 	ComposePath   string | 	ComposePath   string | ||||||
| 	ReadmePath    string | 	ReadmePath    string | ||||||
|  | |||||||
| @ -54,21 +54,13 @@ teardown(){ | |||||||
| } | } | ||||||
|  |  | ||||||
| # bats test_tags=slow | # bats test_tags=slow | ||||||
| @test "deploy commit written to env and redeploy keeps that version" { | @test "chaos commit written to env" { | ||||||
|   run $ABRA app deploy "$TEST_APP_DOMAIN" "1e83340e" --no-input --no-converge-checks |   run $ABRA app deploy "$TEST_APP_DOMAIN" "1e83340e" --no-input --no-converge-checks | ||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run grep -q "TYPE=$TEST_RECIPE:1e83340e" \ |   run grep -q "TYPE=$TEST_RECIPE:1e83340e" \ | ||||||
|     "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" |     "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" | ||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run $ABRA app deploy "$TEST_APP_DOMAIN" \ |  | ||||||
|     --force --no-input --no-converge-checks |  | ||||||
|   assert_success |  | ||||||
|  |  | ||||||
|   run grep -q "TYPE=$TEST_RECIPE:1e83340e" \ |  | ||||||
|     "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" |  | ||||||
|   assert_success |  | ||||||
| } | } | ||||||
|  |  | ||||||
| # bats test_tags=slow | # bats test_tags=slow | ||||||
| @ -106,15 +98,12 @@ teardown(){ | |||||||
| } | } | ||||||
|  |  | ||||||
| # bats test_tags=slow | # bats test_tags=slow | ||||||
| @test "takes deployed version when no .env version is present " { | @test "deploy overwrites chaos deploy" { | ||||||
|   run $ABRA app deploy "$TEST_APP_DOMAIN" "0.1.0+1.20.0" --no-input --no-converge-checks --ignore-env-version |   run $ABRA app deploy "$TEST_APP_DOMAIN" "1e83340e" \ | ||||||
|  |     --no-input --no-converge-checks | ||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run grep -q "TYPE=$TEST_RECIPE:0.1.0+1.20.0" \ |   run grep -q "TYPE=$TEST_RECIPE:1e83340e" \ | ||||||
|     "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" |  | ||||||
|   assert_success |  | ||||||
|  |  | ||||||
|   run sed -i 's/TYPE=abra-test-recipe:.*/TYPE=abra-test-recipe/g' \ |  | ||||||
|     "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" |     "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" | ||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
| @ -122,7 +111,7 @@ teardown(){ | |||||||
|     --force --no-input --no-converge-checks |     --force --no-input --no-converge-checks | ||||||
|   assert_success |   assert_success | ||||||
|  |  | ||||||
|   run grep -q "TYPE=$TEST_RECIPE:0.1.0+1.20.0" \ |   run grep -q "TYPE=$TEST_RECIPE:1e83340e" \ | ||||||
|     "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" |     "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" | ||||||
|   assert_success |   assert_failure | ||||||
| } | } | ||||||
|  | |||||||
| @ -165,13 +165,14 @@ teardown(){ | |||||||
|   run $ABRA app rollback "$TEST_APP_DOMAIN" "0.1.1+1.20.2" --no-input --no-converge-checks |   run $ABRA app rollback "$TEST_APP_DOMAIN" "0.1.1+1.20.2" --no-input --no-converge-checks | ||||||
|   assert_success |   assert_success | ||||||
|   assert_output --partial "0.1.1+1.20.2" |   assert_output --partial "0.1.1+1.20.2" | ||||||
|   assert_output --partial "0.2.0+1.21.0" |   assert_output --partial "${tagHash:0:8}" | ||||||
|   refute_output --partial "false" |  | ||||||
|  |  | ||||||
|   run $ABRA app rollback "$TEST_APP_DOMAIN" "0.1.0+1.20.0" --no-input --no-converge-checks |   run $ABRA app rollback "$TEST_APP_DOMAIN" "0.1.0+1.20.0" --no-input --no-converge-checks | ||||||
|   assert_success |   assert_success | ||||||
|   assert_output --partial "0.1.1+1.20.2" |  | ||||||
|   assert_output --partial "0.1.0+1.20.0" |   assert_output --partial "0.1.0+1.20.0" | ||||||
|  |  | ||||||
|  |   tagHash=$(_get_tag_hash "0.1.1+1.20.2") | ||||||
|  |   refute_output --partial "${tagHash:0:8}" | ||||||
|   assert_output --partial "false" |   assert_output --partial "false" | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -64,6 +64,10 @@ teardown(){ | |||||||
|   # env version |   # env version | ||||||
|   assert_output --regexp 'CURRENT VERSION.*' + "${latestRelease}" |   assert_output --regexp 'CURRENT VERSION.*' + "${latestRelease}" | ||||||
|   assert_output --regexp 'NEW VERSION.*' + "${headHash:0:8}" |   assert_output --regexp 'NEW VERSION.*' + "${headHash:0:8}" | ||||||
|  |  | ||||||
|  |   run grep -q "TYPE=$TEST_RECIPE:${headHash:0:8}" \ | ||||||
|  |     "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" | ||||||
|  |   assert_success | ||||||
| } | } | ||||||
|  |  | ||||||
| @test "chaos deploy with unstaged commits and undeploy" { | @test "chaos deploy with unstaged commits and undeploy" { | ||||||
| @ -89,6 +93,10 @@ teardown(){ | |||||||
|   assert_output --regexp 'CURRENT VERSION.*' + "${latestRelease}" |   assert_output --regexp 'CURRENT VERSION.*' + "${latestRelease}" | ||||||
|   assert_output --regexp 'NEW VERSION.*' + "${headHash:0:8}+U" |   assert_output --regexp 'NEW VERSION.*' + "${headHash:0:8}+U" | ||||||
|  |  | ||||||
|  |   run grep -q "TYPE=$TEST_RECIPE:${headHash:0:8}" \ | ||||||
|  |     "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" | ||||||
|  |   assert_success | ||||||
|  |  | ||||||
|   run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo" |   run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE/foo" | ||||||
|   assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" |   assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" | ||||||
| } | } | ||||||
|  | |||||||
| @ -217,7 +217,7 @@ teardown(){ | |||||||
|   run $ABRA app upgrade "$TEST_APP_DOMAIN" "0.1.1+1.20.2" --no-input --no-converge-checks |   run $ABRA app upgrade "$TEST_APP_DOMAIN" "0.1.1+1.20.2" --no-input --no-converge-checks | ||||||
|   assert_success |   assert_success | ||||||
|   assert_output --partial "0.1.1+1.20.2" |   assert_output --partial "0.1.1+1.20.2" | ||||||
|   assert_output --partial "0.1.0+1.20.0" |   assert_output --partial "${tagHash:0:8}" | ||||||
|  |  | ||||||
|   run $ABRA app upgrade "$TEST_APP_DOMAIN" "0.2.0+1.21.0" --no-input --no-converge-checks |   run $ABRA app upgrade "$TEST_APP_DOMAIN" "0.2.0+1.21.0" --no-input --no-converge-checks | ||||||
|   assert_success |   assert_success | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user