2020-02-23 23:02:01 +00:00
|
|
|
package container
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/nektos/act/pkg/common"
|
|
|
|
)
|
|
|
|
|
|
|
|
// NewDockerVolumeRemoveExecutor function
|
|
|
|
func NewDockerVolumeRemoveExecutor(volume string, force bool) common.Executor {
|
|
|
|
return func(ctx context.Context) error {
|
|
|
|
logger := common.Logger(ctx)
|
|
|
|
logger.Debugf("%sdocker volume rm %s", logPrefix, volume)
|
|
|
|
|
|
|
|
if common.Dryrun(ctx) {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-05-04 04:15:42 +00:00
|
|
|
cli, err := GetDockerClient(ctx)
|
2020-02-23 23:02:01 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return cli.VolumeRemove(ctx, volume, force)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|