Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
wbreza committed Sep 24, 2024
1 parent 3f5626b commit 1cf55cc
Show file tree
Hide file tree
Showing 8 changed files with 285 additions and 293 deletions.
2 changes: 0 additions & 2 deletions cli/azd/cmd/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ func (ra *restoreAction) Run(ctx context.Context) (*actions.ActionResult, error)

startTime := time.Now()

serviceNameWarningCheck(ra.console, ra.flags.serviceName, "restore")

targetServiceName := ra.flags.serviceName
if len(ra.args) == 1 {
targetServiceName = ra.args[0]
Expand Down
10 changes: 1 addition & 9 deletions cli/azd/cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/MakeNowJust/heredoc/v2"
"github.com/azure/azure-dev/cli/azd/cmd/actions"
"github.com/azure/azure-dev/cli/azd/internal"
"github.com/azure/azure-dev/cli/azd/internal/cmd"
"github.com/azure/azure-dev/cli/azd/pkg/auth"
"github.com/azure/azure-dev/cli/azd/pkg/environment"
"github.com/azure/azure-dev/cli/azd/pkg/infra/provisioning"
Expand All @@ -25,20 +24,13 @@ import (
)

type upFlags struct {
cmd.ProvisionFlags
cmd.DeployFlags
global *internal.GlobalCommandOptions
internal.EnvFlag
}

func (u *upFlags) Bind(local *pflag.FlagSet, global *internal.GlobalCommandOptions) {
u.EnvFlag.Bind(local, global)
u.global = global

u.ProvisionFlags.BindNonCommon(local, global)
u.ProvisionFlags.SetCommon(&u.EnvFlag)
u.DeployFlags.BindNonCommon(local, global)
u.DeployFlags.SetCommon(&u.EnvFlag)
}

func newUpFlags(cmd *cobra.Command, global *internal.GlobalCommandOptions) *upFlags {
Expand Down Expand Up @@ -71,7 +63,7 @@ var defaultUpWorkflow = &workflow.Workflow{
Name: "up",
Steps: []*workflow.Step{
{AzdCommand: workflow.Command{Args: []string{"package", "--all"}}},
{AzdCommand: workflow.Command{Args: []string{"provision"}}},
{AzdCommand: workflow.Command{Args: []string{"provision", "--all"}}},
{AzdCommand: workflow.Command{Args: []string{"deploy", "--all"}}},
},
}
Expand Down
12 changes: 0 additions & 12 deletions cli/azd/cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ func azurePortalLink(portalUrlBase, subscriptionId, resourceGroupName string) st
resourceGroupName))
}

func serviceNameWarningCheck(console input.Console, serviceNameFlag string, commandName string) {
if serviceNameFlag == "" {
return
}

fmt.Fprintln(
console.Handles().Stderr,
output.WithWarningFormat("WARNING: The `--service` flag is deprecated and will be removed in a future release."),
)
fmt.Fprintf(console.Handles().Stderr, "Next time use `azd %s <service>`.\n\n", commandName)
}

func getTargetServiceName(
ctx context.Context,
projectManager project.ProjectManager,
Expand Down
14 changes: 1 addition & 13 deletions cli/azd/internal/cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
)

type DeployFlags struct {
serviceName string
All bool
fromPackage string
global *internal.GlobalCommandOptions
Expand All @@ -45,15 +44,6 @@ func (d *DeployFlags) Bind(local *pflag.FlagSet, global *internal.GlobalCommandO
func (d *DeployFlags) BindNonCommon(
local *pflag.FlagSet,
global *internal.GlobalCommandOptions) {
local.StringVar(
&d.serviceName,
"service",
"",
//nolint:lll
"Deploys a specific service (when the string is unspecified, all services that are listed in the "+azdcontext.ProjectFileName+" file are deployed).",
)
//deprecate:flag hide --service
_ = local.MarkHidden("service")
d.global = global
}

Expand Down Expand Up @@ -169,13 +159,11 @@ type DeploymentResult struct {
}

func (da *DeployAction) Run(ctx context.Context) (*actions.ActionResult, error) {
targetServiceName := da.flags.serviceName
var targetServiceName string
if len(da.args) == 1 {
targetServiceName = da.args[0]
}

serviceNameWarningCheck(da.console, da.flags.serviceName, "deploy")

if da.env.GetSubscriptionId() == "" {
return nil, errors.New(
"infrastructure has not been provisioned. Run `azd provision`",
Expand Down
Loading

0 comments on commit 1cf55cc

Please sign in to comment.