Skip to content

Commit

Permalink
remove bicep main.parameters.json caching
Browse files Browse the repository at this point in the history
  • Loading branch information
weikanglim committed Sep 20, 2024
1 parent 3b48ae5 commit da58271
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions cli/azd/pkg/infra/provisioning/bicep/bicep_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ type BicepProvider struct {
ignoreDeploymentState bool
// compileBicepResult is cached to avoid recompiling the same bicep file multiple times in the same azd run.
compileBicepMemoryCache *compileBicepResult
// prevent resolving parameters multiple times in the same azd run.
ensureParamsInMemoryCache azure.ArmParameters
keyvaultService keyvault.KeyVaultService
portalUrlBase string
keyvaultService keyvault.KeyVaultService
portalUrlBase string
}

// Name gets the name of the infra provider
Expand Down Expand Up @@ -1793,10 +1791,6 @@ func (p *BicepProvider) ensureParameters(
ctx context.Context,
template azure.ArmTemplate,
) (azure.ArmParameters, error) {
if p.ensureParamsInMemoryCache != nil {
return maps.Clone(p.ensureParamsInMemoryCache), nil
}

parameters, err := p.loadParameters(ctx)
if err != nil {
return nil, fmt.Errorf("resolving bicep parameters file: %w", err)
Expand Down Expand Up @@ -1922,19 +1916,15 @@ func (p *BicepProvider) ensureParameters(
configuredParameters[key] = azure.ArmParameterValue{
Value: value,
}
configuredParameters[prompt.key] = azure.ArmParameterValue{
Value: value,
}
}
}
}

if configModified {
if err := p.envManager.Save(ctx, p.env); err != nil {
p.console.Message(ctx, fmt.Sprintf("warning: failed to save configured values: %v", err))
return nil, fmt.Errorf("saving prompt values: %w", err)
}
}
p.ensureParamsInMemoryCache = maps.Clone(configuredParameters)
return configuredParameters, nil
}

Expand Down

0 comments on commit da58271

Please sign in to comment.