Merge pull request #7248 from oceyral/oceyral/feat/add_user_data
Add "custom_data" key to packer manifest post-processor
This commit is contained in:
commit
6cac03044f
|
@ -16,6 +16,7 @@ type Artifact struct {
|
|||
ArtifactFiles []ArtifactFile `json:"files"`
|
||||
ArtifactId string `json:"artifact_id"`
|
||||
PackerRunUUID string `json:"packer_run_uuid"`
|
||||
CustomData map[string]string `json:"custom_data"`
|
||||
}
|
||||
|
||||
func (a *Artifact) BuilderId() string {
|
||||
|
|
|
@ -20,6 +20,7 @@ type Config struct {
|
|||
|
||||
OutputPath string `mapstructure:"output"`
|
||||
StripPath bool `mapstructure:"strip_path"`
|
||||
CustomData map[string]string `mapstructure:"custom_data"`
|
||||
ctx interpolate.Context
|
||||
}
|
||||
|
||||
|
@ -75,6 +76,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, source packer.Artifact) (packe
|
|||
artifact.ArtifactFiles = append(artifact.ArtifactFiles, af)
|
||||
}
|
||||
artifact.ArtifactId = source.Id()
|
||||
artifact.CustomData = p.config.CustomData
|
||||
artifact.BuilderType = p.config.PackerBuilderType
|
||||
artifact.BuildName = p.config.PackerBuildName
|
||||
artifact.BuildTime = time.Now().Unix()
|
||||
|
|
|
@ -38,11 +38,12 @@ post-processors such as Docker and Artifice.
|
|||
to `packer-manifest.json`.
|
||||
- `strip_path` (boolean) Write only filename without the path to the manifest
|
||||
file. This defaults to false.
|
||||
- `custom_data` (map of strings) Arbitrary data to add to the manifest.
|
||||
|
||||
### Example Configuration
|
||||
|
||||
You can simply add `{"type":"manifest"}` to your post-processor section. Below
|
||||
is a more verbose example:
|
||||
is a more complete example:
|
||||
|
||||
``` json
|
||||
{
|
||||
|
@ -50,7 +51,10 @@ is a more verbose example:
|
|||
{
|
||||
"type": "manifest",
|
||||
"output": "manifest.json",
|
||||
"strip_path": true
|
||||
"strip_path": true,
|
||||
"custom_data": {
|
||||
"my_custom_data": "example"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -72,7 +76,10 @@ An example manifest file looks like:
|
|||
}
|
||||
],
|
||||
"artifact_id": "Container",
|
||||
"packer_run_uuid": "6d5d3185-fa95-44e1-8775-9e64fe2e2d8f"
|
||||
"packer_run_uuid": "6d5d3185-fa95-44e1-8775-9e64fe2e2d8f",
|
||||
"custom_data": {
|
||||
"my_custom_data": "example"
|
||||
}
|
||||
}
|
||||
],
|
||||
"last_run_uuid": "6d5d3185-fa95-44e1-8775-9e64fe2e2d8f"
|
||||
|
@ -114,7 +121,10 @@ The above manifest was generated with this packer.json:
|
|||
{
|
||||
"type": "manifest",
|
||||
"output": "manifest.json",
|
||||
"strip_path": true
|
||||
"strip_path": true,
|
||||
"custom_data": {
|
||||
"my_custom_data": "example"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue