Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
hashicorp

GitHub Action

Setup HashiCorp Packer

v2.0.0

Setup HashiCorp Packer

hashicorp

Setup HashiCorp Packer

A GitHub Action to install a specific version of HashiCorp Packer and add it to PATH

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Setup HashiCorp Packer

uses: hashicorp/[email protected]

Learn more about this action in hashicorp/setup-packer

Choose a version

GitHub Action: setup-packer

The hashicorp/setup-packer Action sets up the packer CLI in your GitHub Actions workflow by adding the binary to PATH.

Table of Contents

Requirements

This GitHub Actions supports all commands that are available in the packer CLI.

The build command may require access to provider-specific credentials.

Other environment variables (such as PACKER_LOG) may be set as normal and will be picked up accordingly.

Usage

1.) Create a GitHub Actions Workflow file (e.g.: .github/workflows/packer.yml):

name: packer

on:
  - push

jobs:
  packer:
    runs-on: ubuntu-latest
    name: Run Packer
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Setup `packer`
        uses: hashicorp/setup-packer@main
        id: setup
        with:
          version: "1.8.3" # or `latest`

      - name: Run `packer init`
        id: init
        run: "packer init ./image.pkr.hcl"

      - name: Run `packer validate`
        id: validate
        run: "packer validate ./image.pkr.hcl"

In the above example, the following definitions have been set.

  • The event trigger has been set to push. For a complete list, see Events that trigger workflows.
  • The origin of this GitHub Action has been set as hashicorp/setup-packer@main. For newer versions, see the Releases.
  • The version of packer to set up has been set as 1.8.3. For a complete list, see releases.hashicorp.com.
  • The Packer manifest to interact with has been set as ./image.pkr.hcl

These definitions may require updating to suit your deployment, such as specifying self-hosted runners.

Additionally, you may configure outputs to consume return values from the Action's operations.

Inputs

This section contains a list of all inputs that may be set for this Action.

  • version - (required) The version of packer to install. Defaults to latest.

Outputs

This section contains a list of all outputs that can be consumed from this Action.

  • version - The version of packer that was installed.

Author Information

This GitHub Action is maintained by the contributors listed on GitHub.

The original code of this repository is based on work done by Matthew Sanabria as part of the setup-packer GitHub Action.

License

Licensed under the Apache License, Version 2.0 (the "License").

You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" basis, without WARRANTIES or conditions of any kind, either express or implied.

See the License for the specific language governing permissions and limitations under the License.