Merge pull request #5475 from ChrisLundquist/lxd-publish-properties
[Lxd] publish properties
This commit is contained in:
commit
bdb2509735
|
@ -12,10 +12,11 @@ import (
|
|||
|
||||
type Config struct {
|
||||
common.PackerConfig `mapstructure:",squash"`
|
||||
OutputImage string `mapstructure:"output_image"`
|
||||
ContainerName string `mapstructure:"container_name"`
|
||||
CommandWrapper string `mapstructure:"command_wrapper"`
|
||||
Image string `mapstructure:"image"`
|
||||
OutputImage string `mapstructure:"output_image"`
|
||||
ContainerName string `mapstructure:"container_name"`
|
||||
CommandWrapper string `mapstructure:"command_wrapper"`
|
||||
Image string `mapstructure:"image"`
|
||||
PublishProperties map[string]string `mapstructure:"publish_properties"`
|
||||
InitTimeout time.Duration
|
||||
|
||||
ctx interpolate.Context
|
||||
|
|
|
@ -32,6 +32,10 @@ func (s *stepPublish) Run(state multistep.StateBag) multistep.StepAction {
|
|||
"publish", name, "--alias", config.OutputImage,
|
||||
}
|
||||
|
||||
for k, v := range config.PublishProperties {
|
||||
publish_args = append(publish_args, fmt.Sprintf("%s=%s", k, v))
|
||||
}
|
||||
|
||||
ui.Say("Publishing container...")
|
||||
stdoutString, err := LXDCommand(publish_args...)
|
||||
if err != nil {
|
||||
|
|
|
@ -31,11 +31,15 @@ Below is a fully functioning example.
|
|||
"name": "lxd-xenial",
|
||||
"image": "ubuntu-daily:xenial",
|
||||
"output_image": "ubuntu-xenial"
|
||||
"publish_properties": {
|
||||
"description": "Trivial repackage with Packer"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Configuration Reference
|
||||
|
||||
### Required:
|
||||
|
@ -56,5 +60,11 @@ Below is a fully functioning example.
|
|||
- `output_image` (string) - The name of the output artifact. Defaults to
|
||||
`name`.
|
||||
|
||||
- `command_wrapper` (string) - lets you prefix all builder commands, such as
|
||||
- `command_wrapper` (string) - Lets you prefix all builder commands, such as
|
||||
with `ssh` for a remote build host. Defaults to `""`.
|
||||
|
||||
- `publish_properties` (map[string]string) - Pass key values to the publish
|
||||
step to be set as properties on the output image. This is most helpful to
|
||||
set the description, but can be used to set anything needed.
|
||||
See https://stgraber.org/2016/03/30/lxd-2-0-image-management-512/
|
||||
for more properties.
|
||||
|
|
Loading…
Reference in New Issue