Skip to content

Commit

Permalink
Returns error when platform option is specified when running a bootst…
Browse files Browse the repository at this point in the history
…rap build
  • Loading branch information
jonathanmccormack committed Nov 25, 2024
1 parent 0b7f053 commit a835519
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions builder/docker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ type Config struct {
WindowsContainer bool `mapstructure:"windows_container" required:"false"`
// Set platform if server is multi-platform capable
//
// If using `build`, this field will be ignored, as the `platform` option for
// this operation will instead have precedence.
// 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 dockerhub to pull a private base container. For
Expand Down Expand Up @@ -224,7 +223,7 @@ func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
}

if c.Platform != "" {
warnings = append(warnings, "when running a bootstrap build, the `platform` option is ignored and is replaced by `build.platform`")
errs = packersdk.MultiErrorAppend(errs, errors.New("when running a bootstrap build, the `platform` option cannot be specified (use `build.platform` instead)"))
}
c.Platform = c.BuildConfig.Platform
} else {
Expand Down
3 changes: 1 addition & 2 deletions docs-partials/builder/docker/Config-not-required.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@

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

If using `build`, this field will be ignored, as the `platform` option for
this operation will instead have precedence.
This cannot be used at the same time as `build`; instead, use `build.platform`

- `login` (bool) - This is used to login to dockerhub to pull a private base container. For
pushing to dockerhub, see the docker post-processors
Expand Down

0 comments on commit a835519

Please sign in to comment.