Skip to content

Commit

Permalink
Merge pull request #9715 from hashicorp/checksum_pp_hcl_example
Browse files Browse the repository at this point in the history
Update checksum post-processor docs with hcl2 example
  • Loading branch information
SwampDragons committed Aug 5, 2020
2 parents 3f61498 + fd683da commit de5c587
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
1 change: 0 additions & 1 deletion post-processor/checksum/post-processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions post-processor/checksum/post-processor.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 28 additions & 18 deletions website/pages/docs/post-processors/checksum.mdx
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -36,24 +28,42 @@ a third-party post-processor.

## Basic example

The example below is fully functional.
<Tabs>
<Tab heading="JSON">

```json
{
"type": "checksum"
"type": "checksum",
"checksum_types": ["sha1", "sha256"],
"output": "packer_{{.BuildName}}_{{.ChecksumType}}.checksum"
}
```

</Tab>
<Tab heading="HCL2">

```hcl
post-processor "checksum" {
checksum_types = ["sha1", "sha256"]
output = "packer_{{.BuildName}}_{{.ChecksumType}}.checksum"
}
```

</Tab>
</Tabs>

## 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
Expand Down

0 comments on commit de5c587

Please sign in to comment.