forked from toolshed/abra
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			main
			...
			overview-c
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| d575131d5b | |||
| 15d6b1a2a5 | 
| @ -81,35 +81,8 @@ var AppNewCommand = &cobra.Command{ | |||||||
| 				log.Fatal(err) | 				log.Fatal(err) | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			// NOTE(d1): rely on tags as there is no recipe.EnvVersion yet because | 			recipeVersion = chaosVersion | ||||||
| 			// the app has not been fully created. we rely on the local git state of | 		} else { | ||||||
| 			// the repository |  | ||||||
| 			tags, err := recipe.Tags() |  | ||||||
| 			if err != nil { |  | ||||||
| 				log.Fatal(err) |  | ||||||
| 			} |  | ||||||
|  |  | ||||||
| 			internal.SortVersionsDesc(tags) |  | ||||||
|  |  | ||||||
| 			if len(tags) == 0 { |  | ||||||
| 				// NOTE(d1): this is a new recipe with no released versions |  | ||||||
| 				recipeVersion = config.UNKNOWN_DEFAULT |  | ||||||
| 			} else { |  | ||||||
| 				recipeVersion = tags[len(tags)-1] |  | ||||||
| 			} |  | ||||||
|  |  | ||||||
| 			if err := recipe.IsDirty(); err != nil { |  | ||||||
| 				log.Fatal(err) |  | ||||||
| 			} |  | ||||||
|  |  | ||||||
| 			if !internal.Offline && !recipe.Dirty { |  | ||||||
| 				if err := recipe.EnsureUpToDate(); err != nil { |  | ||||||
| 					log.Fatal(err) |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		if !internal.Chaos { |  | ||||||
| 			if err := recipe.EnsureIsClean(); err != nil { | 			if err := recipe.EnsureIsClean(); err != nil { | ||||||
| 				log.Fatal(err) | 				log.Fatal(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 = composeFiles | 		deployConfig = formatComposeFiles(composeFiles) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	server := app.Server | 	server := app.Server | ||||||
| @ -128,6 +128,10 @@ 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, | ||||||
| @ -140,7 +144,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 = composeFiles | 		deployConfig = formatComposeFiles(composeFiles) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	server := app.Server | 	server := app.Server | ||||||
| @ -225,7 +229,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 = composeFiles | 		deployConfig = formatComposeFiles(composeFiles) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	server := app.Server | 	server := app.Server | ||||||
|  | |||||||
| @ -56,7 +56,7 @@ teardown(){ | |||||||
|   assert_success |   assert_success | ||||||
| } | } | ||||||
|  |  | ||||||
| @test "create new app with chaos commit" { | @test "create new app with version commit" { | ||||||
|   tagHash=$(_get_tag_hash "0.3.0+1.21.0") |   tagHash=$(_get_tag_hash "0.3.0+1.21.0") | ||||||
|  |  | ||||||
|   run $ABRA app new "$TEST_RECIPE" "$tagHash" \ |   run $ABRA app new "$TEST_RECIPE" "$tagHash" \ | ||||||
| @ -129,6 +129,10 @@ teardown(){ | |||||||
|   assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" |   assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" | ||||||
|   assert_equal "$(_git_status)" "?? foo" |   assert_equal "$(_git_status)" "?? foo" | ||||||
|  |  | ||||||
|  |   run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" status | ||||||
|  |   assert_success | ||||||
|  |   assert_output --partial 'foo' | ||||||
|  |  | ||||||
|   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" | ||||||
| } | } | ||||||
| @ -210,7 +214,7 @@ teardown(){ | |||||||
|     --chaos |     --chaos | ||||||
|   assert_success |   assert_success | ||||||
|   assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" |   assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" | ||||||
|   assert_output --partial "version: $latestRelease" |   assert_output --partial "version: ${currentHash:0:8}" | ||||||
|   assert_output --partial "chaos: ${currentHash:0:8}" |   assert_output --partial "chaos: ${currentHash:0:8}" | ||||||
|  |  | ||||||
|   assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" |   assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" | ||||||
| @ -238,7 +242,7 @@ teardown(){ | |||||||
|     --chaos |     --chaos | ||||||
|   assert_success |   assert_success | ||||||
|   assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" |   assert_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" | ||||||
|   assert_output --partial "version: unknown" |   assert_output --partial "version: ${currentHash:0:8}" | ||||||
|   assert_output --partial "chaos: ${currentHash:0:8}" |   assert_output --partial "chaos: ${currentHash:0:8}" | ||||||
|  |  | ||||||
|   assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" |   assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user