Skip to content

Commit

Permalink
bicep: add spinner to azd down (#4336)
Browse files Browse the repository at this point in the history
Add a spinner to `azd down` since resource discovery takes a long time. The length operation is caused by deployment fetching. This is still tracked with #3577.
  • Loading branch information
weikanglim authored Sep 18, 2024
1 parent d91c739 commit be21179
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cli/azd/pkg/infra/provisioning/bicep/bicep_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ func (p *BicepProvider) State(ctx context.Context, options *provisioning.StateOp

var err error
spinnerMessage := "Loading Bicep template"
// TODO: Report progress, "Loading Bicep template"
p.console.ShowSpinner(ctx, spinnerMessage, input.Step)
defer func() {
// Make sure we stop the spinner if an error occurs with the last message.
Expand Down Expand Up @@ -238,7 +237,6 @@ func (p *BicepProvider) State(ctx context.Context, options *provisioning.StateOp
outputs = azure.ArmTemplateOutputs{}
}

// TODO: Report progress, "Retrieving Azure deployment"
spinnerMessage = "Retrieving Azure deployment"
p.console.ShowSpinner(ctx, spinnerMessage, input.Step)

Expand Down Expand Up @@ -350,7 +348,6 @@ func (p *BicepProvider) plan(ctx context.Context) (*deploymentDetails, error) {
p.console.ShowSpinner(ctx, "Creating a deployment plan", input.Step)

modulePath := p.modulePath()
// TODO: Report progress, "Compiling Bicep template"
compileResult, err := p.compileBicep(ctx, modulePath)
if err != nil {
return nil, fmt.Errorf("creating template: %w", err)
Expand Down Expand Up @@ -730,7 +727,8 @@ func (p *BicepProvider) Destroy(
options provisioning.DestroyOptions,
) (*provisioning.DestroyResult, error) {
modulePath := p.modulePath()
// TODO: Report progress, "Compiling Bicep template"
p.console.ShowSpinner(ctx, "Discovering resources to delete...", input.Step)
defer p.console.StopSpinner(ctx, "", input.StepDone)
compileResult, err := p.compileBicep(ctx, modulePath)
if err != nil {
return nil, fmt.Errorf("creating template: %w", err)
Expand Down Expand Up @@ -792,6 +790,7 @@ func (p *BicepProvider) Destroy(
return nil, fmt.Errorf("getting cognitive accounts to purge: %w", err)
}

p.console.StopSpinner(ctx, "", input.StepDone)
if err := p.destroyDeploymentWithConfirmation(
ctx,
options,
Expand Down

0 comments on commit be21179

Please sign in to comment.