Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to configure --concurrency for pulling #111

Merged
merged 2 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .web-docs/components/builder/tart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Below we'll go through available options of this Packer plugin.
### Optional Configuration

- `allow_insecure` (boolean) — When cloning the image, connect to the OCI registry via an insecure HTTP protocol.
- `pull_concurrency` (boolean) — Amount of layers to pull concurrently from an OCI registry when pulling the image. Default is 4 for Tart 2.0.0+.
- `cpu_count` (number) - Amount of virtual CPUs to use for the new VM. Overrides `tart create` default value when using `from_ipsw` and `from_iso` and VM settings when using `vm_base_name`.
- `create_grace_time` (duration string | ex: "1h5m2s") — Time to wait after finishing the installation process. Can be used to work around the issue when Virtualization.Framework's installation process is still running in the background for some time after `tart create` had already finished.
- `disk_size_gb` — Disk size in GB to use for the new VM. Overrides `tart create` default value when using `from_ipsw` and `from_iso` and VM settings when using `vm_base_name`.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Packer Plugin Tart

The `Tart` multi-component plugin can be used with HashiCorp [Packer](https://www.packer.io)
to create custom macOS images. For the full list of available features for this plugin see [docs](https://developer.hashicorp.com/packer/plugins/builders/tart).
to create custom macOS images. For the full list of available features for this plugin see [docs](https://developer.hashicorp.com/packer/integrations/cirruslabs/tart/latest/components/builder/tart).

## Installation

Expand Down
11 changes: 6 additions & 5 deletions builder/tart/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ type Config struct {
commonsteps.HTTPConfig `mapstructure:",squash"`
CommunicatorConfig communicator.Config `mapstructure:",squash"`

FromIPSW string `mapstructure:"from_ipsw"`
FromISO []string `mapstructure:"from_iso"`
VMBaseName string `mapstructure:"vm_base_name"`
VMName string `mapstructure:"vm_name"`
AllowInsecure bool `mapstructure:"allow_insecure"`
FromIPSW string `mapstructure:"from_ipsw"`
FromISO []string `mapstructure:"from_iso"`
VMBaseName string `mapstructure:"vm_base_name"`
VMName string `mapstructure:"vm_name"`
AllowInsecure bool `mapstructure:"allow_insecure"`
PullConcurrency uint16 `mapstructure:"pull_concurrency"`

CpuCount uint8 `mapstructure:"cpu_count"`
CreateGraceTime time.Duration `mapstructure:"create_grace_time"`
Expand Down
2 changes: 2 additions & 0 deletions builder/tart/builder.hcl2spec.go

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

4 changes: 4 additions & 0 deletions builder/tart/step_clone_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ func (s *stepCloneVM) Run(ctx context.Context, state multistep.StateBag) multist
cmdArgs = append(cmdArgs, "--insecure")
}

if config.PullConcurrency > 0 {
cmdArgs = append(cmdArgs, "--concurrency", fmt.Sprintf("%d", config.PullConcurrency))
}

if _, err := TartExec(ctx, cmdArgs...); err != nil {
err := fmt.Errorf("Error cloning VM: %s", err)
state.Put("error", err)
Expand Down
1 change: 1 addition & 0 deletions docs/builders/tart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Below we'll go through available options of this Packer plugin.
### Optional Configuration

- `allow_insecure` (boolean) — When cloning the image, connect to the OCI registry via an insecure HTTP protocol.
- `pull_concurrency` (boolean) — Amount of layers to pull concurrently from an OCI registry when pulling the image. Default is 4 for Tart 2.0.0+.
- `cpu_count` (number) - Amount of virtual CPUs to use for the new VM. Overrides `tart create` default value when using `from_ipsw` and `from_iso` and VM settings when using `vm_base_name`.
- `create_grace_time` (duration string | ex: "1h5m2s") — Time to wait after finishing the installation process. Can be used to work around the issue when Virtualization.Framework's installation process is still running in the background for some time after `tart create` had already finished.
- `disk_size_gb` — Disk size in GB to use for the new VM. Overrides `tart create` default value when using `from_ipsw` and `from_iso` and VM settings when using `vm_base_name`.
Expand Down
Loading