Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 51f5e9c

Browse files
committed
Refactoring the Container struct…
… and thus Service too (with some other stuff). Overall the struct is way lighter, less intelligent *and* make way less call. A `Container` now holds only a client, name, id and an actual `types.ContainerJSON` docker container struct. - This removes service and `Project`/`events.Notifier`. - There is several way to create a `Container`: - Create an actual container with `CreateContainer` - Create a container from an existing one, with either `New` or `NewInspected`. - Thus, removing any `Create*` method (use `CreateContainer` instead). - Move *service* related method into services (`Recreate`, `Delete`, `OutOfSync`, anything related to `Create`). - Remove `findExisting` and calls, the same with `withContainer` which are not needed anymore. - Create a `service_create.go` file with service container creation code (because it was a lot) - Update `Service` methods to use this updated `Container` struct. - Makes `Scale` on service less flaky but not doing it in parallel (for now at least) There is some improvements to come next : - `Container` could (and should) be on its own `docker/container` package. - `Service` will have to be refactor next (by removing dependencies on project). - Move `Service` into its on `docker/service` package and split `service.go` into several smaller files. Signed-off-by: Vincent Demeester <[email protected]>
1 parent d1876c1 commit 51f5e9c

File tree

7 files changed

+507
-558
lines changed

7 files changed

+507
-558
lines changed

cli/app/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ func ProjectScale(p project.APIProject, c *cli.Context) error {
303303

304304
err := p.Scale(context.Background(), c.Int("timeout"), servicesScale)
305305
if err != nil {
306-
return cli.NewExitError(err.Error(), 1)
306+
return cli.NewExitError(err.Error(), 0)
307307
}
308308
return nil
309309
}

0 commit comments

Comments
 (0)