Skip to content

Commit

Permalink
Disallows setting build.platform
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmccormack committed Nov 26, 2024
1 parent eb0b430 commit e7757cd
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 16 deletions.
4 changes: 0 additions & 4 deletions .web-docs/components/builder/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,6 @@ You must specify (only) one of `commit`, `discard`, or `export_path`.
containers, because our normal docker bindings do not work for them.

- `platform` (string) - Set platform if server is multi-platform capable

This cannot be used at the same time as `build`; instead, use `build.platform`

- `login` (bool) - This is used to login to a private docker repository (e.g., dockerhub)
to build or pull a private base container. For pushing to a private
Expand Down Expand Up @@ -396,8 +394,6 @@ source "docker" "example" {
- `arguments` (map[string]string) - A mapping of additional build args to provide. The key of
the object is the argument name, the value is the argument value.

- `platform` (string) - Set platform if server is multi-platform capable

- `pull` (boolean) - Pull the image when building the base docker image.

Note: defaults to true, to disable this, explicitly set it to false.
Expand Down
6 changes: 2 additions & 4 deletions builder/docker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ type Config struct {
// containers, because our normal docker bindings do not work for them.
WindowsContainer bool `mapstructure:"windows_container" required:"false"`
// Set platform if server is multi-platform capable
//
// This cannot be used at the same time as `build`; instead, use `build.platform`
Platform string `mapstructure:"platform" required:"false"`

// This is used to login to a private docker repository (e.g., dockerhub)
Expand Down Expand Up @@ -224,9 +222,9 @@ func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
}

if c.Platform != "" {
errs = packersdk.MultiErrorAppend(errs, errors.New("when running a bootstrap build, the `platform` option cannot be specified (use `build.platform` instead)"))
c.BuildConfig.Platform = c.Platform
}
c.Platform = c.BuildConfig.Platform

} else {
// Default Pull if it wasn't set
hasPull := false
Expand Down
3 changes: 1 addition & 2 deletions builder/docker/dockerfile_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ type DockerfileBootstrapConfig struct {
// the object is the argument name, the value is the argument value.
Arguments map[string]string `mapstructure:"arguments" required:"false"`

// Set platform if server is multi-platform capable
Platform string `mapstructure:"platform" required:"false"`
Platform string `mapstructure-to-hcl2:",skip"`

// Pull the image when building the base docker image.
//
Expand Down
2 changes: 0 additions & 2 deletions builder/docker/dockerfile_config.hcl2spec.go

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

2 changes: 0 additions & 2 deletions docs-partials/builder/docker/Config-not-required.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@
containers, because our normal docker bindings do not work for them.

- `platform` (string) - Set platform if server is multi-platform capable

This cannot be used at the same time as `build`; instead, use `build.platform`

- `login` (bool) - This is used to login to a private docker repository (e.g., dockerhub)
to build or pull a private base container. For pushing to a private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
- `arguments` (map[string]string) - A mapping of additional build args to provide. The key of
the object is the argument name, the value is the argument value.

- `platform` (string) - Set platform if server is multi-platform capable

- `pull` (boolean) - Pull the image when building the base docker image.

Note: defaults to true, to disable this, explicitly set it to false.
Expand Down

0 comments on commit e7757cd

Please sign in to comment.