diff --git a/README.md b/README.md
index 5597445..fe2f249 100644
--- a/README.md
+++ b/README.md
@@ -150,12 +150,13 @@ that required paid sponsorship upon exceeding a free limit.
### `prepare` stage
-| Argument | Default | Description |
-|-----------------|-------------|--------------------------------------------------------------------------------------|
-| `--concurrency` | 1 | Maximum number of concurrently running Tart VMs to calculate the `auto` resources |
-| `--cpu` | no override | Override default image CPU configuration (number of CPUs or `auto`1) |
-| `--memory` | no override | Override default image memory configuration (size in megabytes or `auto`1) |
-| `--dir` | | `--dir` arguments to pass to `tart run`, can be specified multiple times |
+| Argument | Default | Description |
+|------------------|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `--concurrency` | 1 | Maximum number of concurrently running Tart VMs to calculate the `auto` resources |
+| `--cpu` | no override | Override default image CPU configuration (number of CPUs or `auto`1) |
+| `--memory` | no override | Override default image memory configuration (size in megabytes or `auto`1) |
+| `--dir` | | `--dir` arguments to pass to `tart run`, can be specified multiple times |
+| `--auto-prune` | true | Whether to enable or disable the Tart's auto-pruning mechanism (sets the `TART_NO_AUTO_PRUNE` environment variable for Tart command invocations under the hood) |
1: automatically distributes all host resources according to the concurrency level (for example, VM gets all of the host CPU and RAM assigned when `--concurrency` is 1, and half of that when `--concurrency` is 2)
diff --git a/internal/commands/prepare/prepare.go b/internal/commands/prepare/prepare.go
index 537cec6..5769266 100644
--- a/internal/commands/prepare/prepare.go
+++ b/internal/commands/prepare/prepare.go
@@ -24,6 +24,7 @@ var concurrency uint64
var cpuOverrideRaw string
var memoryOverrideRaw string
var customDirectoryMounts []string
+var autoPrune bool
func NewCommand() *cobra.Command {
command := &cobra.Command{
@@ -40,6 +41,9 @@ func NewCommand() *cobra.Command {
"Override default image memory configuration (size in megabytes or \"auto\")")
command.PersistentFlags().StringArrayVar(&customDirectoryMounts, "dir", []string{},
"\"--dir\" arguments to pass to \"tart run\", can be specified multiple times")
+ command.PersistentFlags().BoolVar(&autoPrune, "auto-prune", true,
+ "Whether to enable or disable the Tart's auto-pruning mechanism (sets the "+
+ "TART_NO_AUTO_PRUNE environment variable for Tart command invocations under the hood)")
return command
}
@@ -55,6 +59,14 @@ func runPrepareVM(cmd *cobra.Command, args []string) error {
return err
}
+ // Auto-prune is enabled by default in Tart,
+ // so we only need to act when it's set to "false"
+ if !autoPrune {
+ if err := os.Setenv("TART_NO_AUTO_PRUNE", "true"); err != nil {
+ return err
+ }
+ }
+
gitLabEnv, err := gitlab.InitEnv()
if err != nil {
return err