fix docker deploy with registry + skip confirmation with optional arg
This commit is contained in:
parent
dbda7784fa
commit
d90048a69d
@ -118,6 +118,8 @@ The binary is then installed in your **$GOPATH/bin**.
|
||||
```bash
|
||||
hmdeploy --help
|
||||
Usage of hmdeploy:
|
||||
-confirm
|
||||
do not ask for confirmation, you're the best, you don't need confirmation
|
||||
-debug
|
||||
show debug logs
|
||||
-destroy
|
||||
@ -143,7 +145,7 @@ hmdeploy --path /path/my-project --destroy
|
||||
## Next steps
|
||||
* ~~Improve the CLI arguments~~
|
||||
* ~~Destroy~~
|
||||
* Post-install script
|
||||
* Check deployment/undeployment state
|
||||
* Deals with bugs
|
||||
* Tests 😮💨
|
||||
|
||||
|
||||
@ -184,7 +184,7 @@ func (sd *SwarmDeployer) Deploy() error {
|
||||
|
||||
log.Info().Str("project", sd.project.Name).Msg("deploying swarm project...")
|
||||
composeFileBase := filepath.Base(sd.project.Deps.ComposeFile)
|
||||
if _, err := sd.conn.Execute(fmt.Sprintf("docker stack deploy -c %s %s", composeFileBase, sd.project.Name)); err != nil {
|
||||
if _, err := sd.conn.Execute(fmt.Sprintf("docker stack deploy -c %s %s --with-registry-auth", composeFileBase, sd.project.Name)); err != nil {
|
||||
sd.setDone(err)
|
||||
return err
|
||||
}
|
||||
|
||||
11
main.go
11
main.go
@ -251,6 +251,11 @@ func main() { //nolint: all //hjf
|
||||
destroy := flag.Bool("destroy", false, "delete the deployed project")
|
||||
noNginx := flag.Bool("no-nginx", false, "no Nginx deployment")
|
||||
debug := flag.Bool("debug", false, "show debug logs")
|
||||
confirm := flag.Bool(
|
||||
"confirm",
|
||||
false,
|
||||
"do not ask for confirmation, you're the best, you don't need confirmation",
|
||||
)
|
||||
flag.Parse()
|
||||
|
||||
initLogger(*debug)
|
||||
@ -286,8 +291,10 @@ func main() { //nolint: all //hjf
|
||||
tasks := deps.generateTasksTree()
|
||||
tasks.Display()
|
||||
|
||||
if err := utils.Confirm(ctx, *destroy); err != nil {
|
||||
log.Fatal().Err(err).Msg("error while confirming execution")
|
||||
if !*confirm {
|
||||
if err := utils.Confirm(ctx, *destroy); err != nil {
|
||||
log.Fatal().Err(err).Msg("error while confirming execution")
|
||||
}
|
||||
}
|
||||
|
||||
s := scheduler.NewScheduler(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user