Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IZE-687 added force flag for sls deploy #536

Merged
merged 1 commit into from
Nov 18, 2022
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
4 changes: 4 additions & 0 deletions internal/commands/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package commands

import (
"fmt"

"github.com/aws/aws-sdk-go/aws"
"github.com/hazelops/ize/internal/config"
"github.com/hazelops/ize/internal/manager"
Expand All @@ -20,6 +21,7 @@ type DeployOptions struct {
Image string
TaskDefinitionRevision string
Unsafe bool
Force bool
}

var deployLongDesc = templates.LongDesc(`
Expand Down Expand Up @@ -85,6 +87,7 @@ func NewCmdDeploy(project *config.Project) *cobra.Command {

cmd.Flags().StringVar(&o.TaskDefinitionRevision, "task-definition-revision", "", "set task definition revision (ECS only)")
cmd.Flags().BoolVar(&o.Unsafe, "unsafe", false, "set unsafe healthcheck options (accelerates deployment if possible)")
cmd.Flags().BoolVar(&o.Force, "force", false, "forces a deployment to take place (only serverless)")

return cmd
}
Expand Down Expand Up @@ -141,6 +144,7 @@ func (o *DeployOptions) Run() error {

if app, ok := o.Config.Serverless[o.AppName]; ok {
app.Name = o.AppName
app.Force = o.Force
m = &serverless.Manager{
Project: o.Config,
App: app,
Expand Down
1 change: 1 addition & 0 deletions internal/config/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Serverless struct {
Path string `mapstructure:",omitempty"`
SLSNodeModuleCacheMount string `mapstructure:",omitempty"`
CreateDomain bool `mapstructure:"create_domain"`
Force bool `mapstructure:"force"`
Env []string `mapstructure:",omitempty"`
Icon string `mapstructure:"icon,omitempty"`
UseYarn bool `mapstructure:"use_yarn,omitempty"`
Expand Down
6 changes: 5 additions & 1 deletion internal/manager/serverless/native.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ func (sls *Manager) runDeploy(w io.Writer) error {
command = npmToYarn(command)
}

if sls.App.Force {
command += ` \
--force`
}

logrus.SetOutput(w)
logrus.Debugf("command: %s", command)

Expand Down Expand Up @@ -258,7 +263,6 @@ func (sls *Manager) runRemoveDomain(w io.Writer) error {
--stage %s`,
nvmDir, sls.App.NodeVersion, sls.App.AwsRegion,
sls.App.AwsProfile, sls.Project.Env)


if sls.App.UseYarn {
command = npmToYarn(command)
Expand Down
4 changes: 4 additions & 0 deletions internal/schema/ize-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@
"type": "boolean",
"description": "(optional) execute commands using yarn"
},
"force": {
"type": "boolean",
"description": "(optional) forces a deployment to take place"
},
"aws_region" : {
"type": "string",
"description": "(optional) Serverless-specific AWS Region of this environment should be specified here. Normally global AWS_REGION is used."
Expand Down