From d83d2b0273b66d0fc3b16fba5a26087106eb068e Mon Sep 17 00:00:00 2001 From: Gennady Lipenkov Date: Thu, 9 Jul 2020 17:43:11 +0300 Subject: [PATCH] Update documentation --- .../yandex-export/post-processor.go | 6 +- website/pages/docs/builders/yandex.mdx | 59 +++++++++++++++++++ .../yandex-export/Config-required.mdx | 4 +- 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/post-processor/yandex-export/post-processor.go b/post-processor/yandex-export/post-processor.go index 745fd4951..6aa1252b8 100644 --- a/post-processor/yandex-export/post-processor.go +++ b/post-processor/yandex-export/post-processor.go @@ -29,10 +29,8 @@ type Config struct { // List of paths to Yandex Object Storage where exported image will be uploaded. // Please be aware that use of space char inside path not supported. - // Example value `[ - // "s3://bucket-name/image-blob.qcow2", - // ]` // Also this param support [build](/docs/templates/engine) template function. + // Check available template data for [Yandex](/docs/builders/yandex#build-template-data) builder. Paths []string `mapstructure:"paths" required:"true"` // The folder ID that will be used to launch a temporary instance. // Alternatively you may set value by environment variable YC_FOLDER_ID. @@ -231,8 +229,6 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact state.Put("driver", driver) state.Put("sdk", driver.SDK()) state.Put("ui", ui) - // no used - gd := &builder.GeneratedData{State: state} // Build the steps. steps := []multistep.Step{ diff --git a/website/pages/docs/builders/yandex.mdx b/website/pages/docs/builders/yandex.mdx index d71224f43..8e7a7eb3c 100644 --- a/website/pages/docs/builders/yandex.mdx +++ b/website/pages/docs/builders/yandex.mdx @@ -73,3 +73,62 @@ can be configured for this builder. ### Optional: @include 'builder/yandex/Config-not-required.mdx' + + +## Build template data + +In configuration directives the following variables are available: + +- `ImageID` - ID of the built image. +- `ImageName` - Name of the built image. +- `ImageFamily` - Family of the built image. +- `ImageDescription` - Description of the built image. +- `ImageFolderID` - Folder ID where the built image is stored. +- `SourceImageID` - The source image ID (for example `fd8fjtn3mj2kfe7h6f0r`) used to build the image. +- `SourceImageName` - The source image name (for example `ubuntu-1604-lts-1579200746`) used to build the image. +- `SourceImageDescription` - The source image description (for example `ubuntu 16.04 lts`). +- `SourceImageFamily` - The source image family (for example `ubuntu-1604-lts`). +- `SourceImageFolderID` - The folder ID where source image located (for example `standard-images`). + + +## Build Shared Information Variables + +This builder generates data that are shared with provisioner and post-processor via build function of +[template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/from-1.5/contextual-variables) +for HCL2. + +The generated variables available for this builder see above + +Usage example: + + + + +```json +"post-processors": [ + { + "type": "manifest", + "output": "manifest.json", + "strip_path": true, + "custom_data": { + "source_image_id": "{{ build `SourceImageID` }}" + } + } +] +``` + + + + +```hcl +post-processor "manifest" { + output = "manifest.json" + strip_path = true + custom_data = { + source_image_id = "${build.SourceImageID}" + } +} +``` + + + diff --git a/website/pages/partials/post-processor/yandex-export/Config-required.mdx b/website/pages/partials/post-processor/yandex-export/Config-required.mdx index 89a9720f1..13c6311e7 100644 --- a/website/pages/partials/post-processor/yandex-export/Config-required.mdx +++ b/website/pages/partials/post-processor/yandex-export/Config-required.mdx @@ -2,10 +2,8 @@ - `paths` ([]string) - List of paths to Yandex Object Storage where exported image will be uploaded. Please be aware that use of space char inside path not supported. - Example value `[ - "s3://bucket-name/image-blob.qcow2", - ]` Also this param support [build](/docs/templates/engine) template function. + Check available template data for [Yandex](/docs/builders/yandex#build-template-data) builder. - `folder_id` (string) - The folder ID that will be used to launch a temporary instance. Alternatively you may set value by environment variable YC_FOLDER_ID.