Skip to content

Commit

Permalink
feat: pathwar compose up --force-recreate
Browse files Browse the repository at this point in the history
  • Loading branch information
Z-a-r-a-k-i committed Dec 6, 2019
1 parent 8a711cf commit dbea8ca
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 127 deletions.
1 change: 1 addition & 0 deletions api/errcode.proto
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ enum ErrCode {
ErrComposeCreateTempDir = 3013;
ErrComposeRunUp = 3014;
ErrComposeGetPathwarInfo = 3015;
ErrComposeForceRecreateDown = 3016;

//// Pathwar API (starting at 4001)

Expand Down
2 changes: 1 addition & 1 deletion docs/gen.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion go/cmd/pathwar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ var (
composePreparePrefix string
composePrepareVersion string
composeUpInstanceKey string
composeUpForceRecreate bool
serverCORSAllowedOrigins string
serverGRPCBind string
serverHTTPBind string
Expand Down Expand Up @@ -119,6 +120,7 @@ func main() {
composePrepareFlags.StringVar(&composePreparePrefix, "prefix", defaultDockerPrefix, "docker image prefix")
composePrepareFlags.StringVar(&composePrepareVersion, "version", "1.0.0", "challenge version")
composeUpFlags.StringVar(&composeUpInstanceKey, "instance-key", "default", "instance key used to generate instance ID")
composeUpFlags.BoolVar(&composeUpForceRecreate, "force-recreate", false, "down previously created instances of challenge")
serverFlags.BoolVar(&serverWithPprof, "with-pprof", false, "enable pprof endpoints")
serverFlags.DurationVar(&serverRequestTimeout, "request-timeout", 5*time.Second, "request timeout")
serverFlags.DurationVar(&serverShutdownTimeout, "shutdown-timeout", 6*time.Second, "shutdown timeout")
Expand Down Expand Up @@ -425,7 +427,13 @@ func main() {
return err
}

return pwcompose.Up(string(preparedCompose), composeUpInstanceKey, logger)
ctx := context.Background()
cli, err := client.NewEnvClient()
if err != nil {
return errcode.ErrInitDockerClient.Wrap(err)
}

return pwcompose.Up(ctx, string(preparedCompose), composeUpInstanceKey, composeUpForceRecreate, cli, logger)
},
}

Expand Down
2 changes: 1 addition & 1 deletion go/gen.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dbea8ca

Please sign in to comment.