(ctx context.Context, projectName string)
| 202 | } |
| 203 | |
| 204 | func (d *Deployer) removeProjectVolumes(ctx context.Context, projectName string) error { |
| 205 | vols, err := d.cli.VolumeList(ctx, client.VolumeListOptions{ |
| 206 | Filters: make(client.Filters).Add("label", labelComposeProject+"="+projectName), |
| 207 | }) |
| 208 | if err != nil { |
| 209 | return fmt.Errorf("listing volumes: %w", err) |
| 210 | } |
| 211 | g, gctx := errgroup.WithContext(ctx) |
| 212 | g.SetLimit(5) |
| 213 | for _, v := range vols.Items { |
| 214 | g.Go(func() error { |
| 215 | if _, err := d.cli.VolumeRemove(gctx, v.Name, client.VolumeRemoveOptions{Force: false}); err != nil { |
| 216 | log.Warn().Err(err).Str("volume", v.Name).Msg("Failed to remove volume") |
| 217 | return err |
| 218 | } |
| 219 | log.Info().Str("volume", v.Name).Msg("Removed volume") |
| 220 | return nil |
| 221 | }) |
| 222 | } |
| 223 | return g.Wait() |
| 224 | } |
| 225 | |
| 226 | func (d *Deployer) removeProjectContainers(ctx context.Context, projectName string, status chan<- StatusUpdate) error { |
| 227 | containers, err := d.cli.ContainerList(ctx, client.ContainerListOptions{ |
no test coverage detected