From fd683daa227862b12d39898ea10830f1d4b8cad6 Mon Sep 17 00:00:00 2001 From: sylviamoss Date: Wed, 5 Aug 2020 19:41:58 +0200 Subject: [PATCH] update checksum post-processor docs --- post-processor/checksum/post-processor.go | 1 - .../checksum/post-processor.hcl2spec.go | 2 - .../pages/docs/post-processors/checksum.mdx | 46 +++++++++++-------- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/post-processor/checksum/post-processor.go b/post-processor/checksum/post-processor.go index 3ad171e47..a518b265e 100644 --- a/post-processor/checksum/post-processor.go +++ b/post-processor/checksum/post-processor.go @@ -24,7 +24,6 @@ import ( type Config struct { common.PackerConfig `mapstructure:",squash"` - Keep bool `mapstructure:"keep_input_artifact"` ChecksumTypes []string `mapstructure:"checksum_types"` OutputPath string `mapstructure:"output"` ctx interpolate.Context diff --git a/post-processor/checksum/post-processor.hcl2spec.go b/post-processor/checksum/post-processor.hcl2spec.go index fcb388a36..d58b89aec 100644 --- a/post-processor/checksum/post-processor.hcl2spec.go +++ b/post-processor/checksum/post-processor.hcl2spec.go @@ -16,7 +16,6 @@ type FlatConfig struct { PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"` PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"` PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"` - Keep *bool `mapstructure:"keep_input_artifact" cty:"keep_input_artifact" hcl:"keep_input_artifact"` ChecksumTypes []string `mapstructure:"checksum_types" cty:"checksum_types" hcl:"checksum_types"` OutputPath *string `mapstructure:"output" cty:"output" hcl:"output"` } @@ -40,7 +39,6 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "packer_on_error": &hcldec.AttrSpec{Name: "packer_on_error", Type: cty.String, Required: false}, "packer_user_variables": &hcldec.AttrSpec{Name: "packer_user_variables", Type: cty.Map(cty.String), Required: false}, "packer_sensitive_variables": &hcldec.AttrSpec{Name: "packer_sensitive_variables", Type: cty.List(cty.String), Required: false}, - "keep_input_artifact": &hcldec.AttrSpec{Name: "keep_input_artifact", Type: cty.Bool, Required: false}, "checksum_types": &hcldec.AttrSpec{Name: "checksum_types", Type: cty.List(cty.String), Required: false}, "output": &hcldec.AttrSpec{Name: "output", Type: cty.String, Required: false}, } diff --git a/website/pages/docs/post-processors/checksum.mdx b/website/pages/docs/post-processors/checksum.mdx index 813570c36..1bb216336 100644 --- a/website/pages/docs/post-processors/checksum.mdx +++ b/website/pages/docs/post-processors/checksum.mdx @@ -1,18 +1,10 @@ --- description: > The checksum post-processor computes specified checksum for the artifact list - - from an upstream builder or post-processor. All downstream post-processors - will - + from an upstream builder or post-processor. All downstream post-processors will see the new artifacts. The primary use-case is compute checksum for artifacts - - allows to verify it later. So firstly this post-processor get artifact, - compute - - it checksum and pass to next post-processor original artifacts and checksum - - files. + allows to verify it later. So firstly this post-processor get artifact, compute + it checksum and pass to next post-processor original artifacts and checksum files. layout: docs page_title: Checksum - Post-Processors sidebar_title: Checksum @@ -36,24 +28,42 @@ a third-party post-processor. ## Basic example -The example below is fully functional. + + ```json { - "type": "checksum" + "type": "checksum", + "checksum_types": ["sha1", "sha256"], + "output": "packer_{{.BuildName}}_{{.ChecksumType}}.checksum" } ``` + + + +```hcl +post-processor "checksum" { + checksum_types = ["sha1", "sha256"] + output = "packer_{{.BuildName}}_{{.ChecksumType}}.checksum" +} +``` + + + + ## Configuration Reference Optional parameters: - `checksum_types` (array of strings) - An array of strings of checksum types - to compute. Allowed values are md5, sha1, sha224, sha256, sha384, sha512. - -- `keep_input_artifact` (boolean) - Unlike most post-processors, setting - `keep_input_artifact` will have no effect; the checksum post-processor - always saves the artifact that it is calculating the checksum for. + to compute. If empty, Defaults to md5. Allowed values are: + * md5 + * sha1 + * sha224 + * sha256 + * sha384 + * sha512 - `output` (string) - Specify filename to store checksums. This defaults to `packer_{{.BuildName}}_{{.BuilderType}}_{{.ChecksumType}}.checksum`. For