Feroze Mohideen 2 years ago
parent
commit
db7f9044f9
5 changed files with 40 additions and 38 deletions
  1. 19 18
      cli/cmd/commands/app.go
  2. 7 6
      cli/cmd/commands/apply.go
  3. 3 3
      cli/cmd/v2/apply.go
  4. 3 3
      cli/cmd/v2/update.go
  5. 8 8
      cli/cmd/v2/update_image.go

+ 19 - 18
cli/cmd/commands/app.go

@@ -35,17 +35,17 @@ import (
 )
 
 var (
-	appNamespace            string
-	appVerbose              bool
-	appExistingPod          bool
-	appInteractive          bool
-	appContainerName        string
-	appTag                  string
-	deploymentTarget        string
-	appCpuMilli             int
-	appMemoryMi             int
-	jobName                 string
-	waitForSuccessfulUpdate bool
+	appNamespace                string
+	appVerbose                  bool
+	appExistingPod              bool
+	appInteractive              bool
+	appContainerName            string
+	appTag                      string
+	deploymentTarget            string
+	appCpuMilli                 int
+	appMemoryMi                 int
+	jobName                     string
+	waitForSuccessfulDeployment bool
 )
 
 const (
@@ -112,7 +112,7 @@ func registerCommand_App(cliConf config.CLIConfig) *cobra.Command {
 	}
 
 	appUpdateTagCmd.PersistentFlags().BoolVarP(
-		&waitForSuccessfulUpdate,
+		&waitForSuccessfulDeployment,
 		"wait",
 		"w",
 		false,
@@ -1259,12 +1259,13 @@ func appUpdateTag(ctx context.Context, user *types.GetAuthenticatedUserResponse,
 
 	if project.ValidateApplyV2 {
 		err := v2.UpdateImage(ctx, v2.UpdateImageInput{
-			ProjectID:            cliConf.Project,
-			ClusterID:            cliConf.Cluster,
-			AppName:              args[0],
-			DeploymentTargetName: deploymentTarget,
-			Tag:                  appTag,
-			Client:               client,
+			ProjectID:                   cliConf.Project,
+			ClusterID:                   cliConf.Cluster,
+			AppName:                     args[0],
+			DeploymentTargetName:        deploymentTarget,
+			Tag:                         appTag,
+			Client:                      client,
+			WaitForSuccessfulDeployment: waitForSuccessfulDeployment,
 		})
 		if err != nil {
 			return fmt.Errorf("error updating tag: %w", err)

+ 7 - 6
cli/cmd/commands/apply.go

@@ -108,7 +108,7 @@ applying a configuration:
 	applyCmd.PersistentFlags().StringVarP(&porterYAML, "file", "f", "", "path to porter.yaml")
 	applyCmd.PersistentFlags().BoolVarP(&previewApply, "preview", "p", false, "apply as preview environment based on current git branch")
 	applyCmd.PersistentFlags().BoolVarP(
-		&waitForSuccessfulUpdate,
+		&waitForSuccessfulDeployment,
 		"wait",
 		"w",
 		false,
@@ -143,11 +143,12 @@ func apply(ctx context.Context, _ *types.GetAuthenticatedUserResponse, client ap
 		}
 
 		inp := v2.ApplyInput{
-			CLIConfig:      cliConfig,
-			Client:         client,
-			PorterYamlPath: porterYAML,
-			AppName:        appName,
-			PreviewApply:   previewApply,
+			CLIConfig:                   cliConfig,
+			Client:                      client,
+			PorterYamlPath:              porterYAML,
+			AppName:                     appName,
+			PreviewApply:                previewApply,
+			WaitForSuccessfulDeployment: waitForSuccessfulDeployment,
 		}
 		err := v2.Apply(ctx, inp)
 		if err != nil {

+ 3 - 3
cli/cmd/v2/apply.go

@@ -35,8 +35,8 @@ type ApplyInput struct {
 	AppName string
 	// PreviewApply is true when Apply should create a new deployment target matching current git branch and apply to that target
 	PreviewApply bool
-	// WaitForSuccessfulUpdate is true when Apply should wait for the update to complete before returning
-	WaitForSuccessfulUpdate bool
+	// WaitForSuccessfulDeployment is true when Apply should wait for the update to complete before returning
+	WaitForSuccessfulDeployment bool
 }
 
 // Apply implements the functionality of the `porter apply` command for validate apply v2 projects
@@ -365,7 +365,7 @@ func Apply(ctx context.Context, inp ApplyInput) error {
 
 	color.New(color.FgGreen).Printf("Successfully applied new revision %s for app %s\n", applyResp.AppRevisionId, appName) // nolint:errcheck,gosec
 
-	if inp.WaitForSuccessfulUpdate {
+	if inp.WaitForSuccessfulDeployment {
 		return waitForAppRevisionStatus(ctx, waitForAppRevisionStatusInput{
 			ProjectID:  cliConf.Project,
 			ClusterID:  cliConf.Cluster,

+ 3 - 3
cli/cmd/v2/update.go

@@ -33,8 +33,8 @@ type UpdateInput struct {
 	AppName string
 	// PreviewApply is true when Update should create a new deployment target matching current git branch and apply to that target
 	PreviewApply bool
-	// WaitForSuccessfulUpdate is true when Update should wait for the revision deployment to complete (all services deployed successfully)
-	WaitForSuccessfulUpdate bool
+	// WaitForSuccessfulDeployment is true when Update should wait for the revision deployment to complete (all services deployed successfully)
+	WaitForSuccessfulDeployment bool
 }
 
 // Update implements the functionality of the `porter apply` command for validate apply v2 projects
@@ -260,7 +260,7 @@ func Update(ctx context.Context, inp UpdateInput) error {
 
 	color.New(color.FgGreen).Printf("Successfully applied new revision %s\n", updateResp.AppRevisionId) // nolint:errcheck,gosec
 
-	if inp.WaitForSuccessfulUpdate {
+	if inp.WaitForSuccessfulDeployment {
 		return waitForAppRevisionStatus(ctx, waitForAppRevisionStatusInput{
 			ProjectID:  cliConf.Project,
 			ClusterID:  cliConf.Cluster,

+ 8 - 8
cli/cmd/v2/update_image.go

@@ -12,13 +12,13 @@ import (
 
 // UpdateImageInput is the input for the UpdateImage function
 type UpdateImageInput struct {
-	ProjectID               uint
-	ClusterID               uint
-	AppName                 string
-	DeploymentTargetName    string
-	Tag                     string
-	Client                  api.Client
-	WaitForSuccessfulUpdate bool
+	ProjectID                   uint
+	ClusterID                   uint
+	AppName                     string
+	DeploymentTargetName        string
+	Tag                         string
+	Client                      api.Client
+	WaitForSuccessfulDeployment bool
 }
 
 // UpdateImage updates the image of an application
@@ -41,7 +41,7 @@ func UpdateImage(ctx context.Context, input UpdateImageInput) error {
 
 	_, _ = color.New(triggeredBackgroundColor).Printf("Updated application %s to use tag \"%s\"\n", input.AppName, tag)
 
-	if input.WaitForSuccessfulUpdate {
+	if input.WaitForSuccessfulDeployment {
 		return waitForAppRevisionStatus(ctx, waitForAppRevisionStatusInput{
 			ProjectID:  input.ProjectID,
 			ClusterID:  input.ClusterID,