Skip to content

Commit

Permalink
Merge pull request #536 from hazelops/IZE-687-ize-deploy-sls-app-force
Browse files Browse the repository at this point in the history
IZE-687 added `force` flag for sls deploy
  • Loading branch information
psihachina authored Nov 18, 2022
2 parents ac82093 + 9521602 commit d13c222
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
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

0 comments on commit d13c222

Please sign in to comment.