Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@
- feat(compute/build): Block version 1.93.0 of Rust to avoid a wasm32-wasip2 bug. ([#1653](https://github.com/fastly/cli/pull/1653))
- feat(service/vcl): escape control characters when displaying VCL content for cleaner terminal output ([#1637](https://github.com/fastly/cli/pull/1637))

- feat(compute/deploy): Apply \[setup.products] for enabling products during initial deploy or publish ([#1617](https://github.com/fastly/cli/pull/1617))

### Dependencies:

- build(deps): `golang.org/x/net` from 0.50.0 to 0.51.0 ([#1674](https://github.com/fastly/cli/pull/1674))
Expand Down
31 changes: 31 additions & 0 deletions pkg/commands/compute/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,7 @@ type ServiceResources struct {
objectStores *setup.KVStores
kvStores *setup.KVStores
secretStores *setup.SecretStores
products *setup.Products
}

// ConstructNewServiceResources instantiates multiple [setup] config resources for a
Expand Down Expand Up @@ -795,6 +796,17 @@ func (c *DeployCommand) ConstructNewServiceResources(
Stdin: in,
Stdout: out,
}

sr.products = &setup.Products{
APIClient: c.Globals.APIClient,
AcceptDefaults: c.Globals.Flags.AcceptDefaults,
NonInteractive: c.Globals.Flags.NonInteractive,
ServiceID: serviceID,
ServiceVersion: serviceVersion,
Setup: c.Globals.Manifest.File.Setup.Products,
Stdin: in,
Stdout: out,
}
}

// ConfigureServiceResources calls the .Predefined() and .Configure() methods
Expand Down Expand Up @@ -849,6 +861,13 @@ func (c *DeployCommand) ConfigureServiceResources(sr ServiceResources, serviceID
}
}

if sr.products.Predefined() {
if err := sr.products.Configure(); err != nil {
errLogService(c.Globals.ErrLog, err, serviceID, serviceVersion)
return fmt.Errorf("error configuring service products: %w", err)
}
}

return nil
}

Expand All @@ -865,6 +884,7 @@ func (c *DeployCommand) CreateServiceResources(
sr.objectStores.Spinner = spinner
sr.kvStores.Spinner = spinner
sr.secretStores.Spinner = spinner
sr.products.Spinner = spinner

if err := sr.backends.Create(); err != nil {
c.Globals.ErrLog.AddWithContext(err, map[string]any{
Expand Down Expand Up @@ -921,6 +941,17 @@ func (c *DeployCommand) CreateServiceResources(
return err
}

if err := sr.products.Create(); err != nil {
c.Globals.ErrLog.AddWithContext(err, map[string]any{
"Accept defaults": c.Globals.Flags.AcceptDefaults,
"Auto-yes": c.Globals.Flags.AutoYes,
"Non-interactive": c.Globals.Flags.NonInteractive,
"Service ID": serviceID,
"Service Version": serviceVersion,
})
return err
}
Comment thread
philippschulte marked this conversation as resolved.

return nil
}

Expand Down
Loading
Loading