GithubHelp home page GithubHelp logo

isabella232 / packer-github-actions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from collins-w/packer-github-actions

0.0 0.0 0.0 29 KB

Run HashiCorp Packer as part of your Workflow

Home Page: https://github.com/marketplace/actions/packer-github-actions

License: Apache License 2.0

Dockerfile 39.27% Shell 60.73%

packer-github-actions's Introduction

GitHub Action: Packer

GitHub Action for running Packer commands.

Table of Contents

Usage

Add the Action to your GitHub Workflow like so:

---

name: Packer

on:
  push:

jobs:
  packer:
    runs-on: ubuntu-latest
    name: packer

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2

      # fix backwards incompatibilities in template
      - name: Fix Template
        uses: collins-w/[email protected]
        with:
          command: fix

      # validate templates
      - name: Validate Template
        uses: collins-w/[email protected]
        with:
          command: validate
          arguments: -syntax-only
          target: packer.pkr.hcl

      # build artifact
      - name: Build Artifact
        uses: collins-w/[email protected]
        with:
          command: build
          arguments: "-color=false -on-error=abort"
          target: packer.pkr.hcl
        env:
          PACKER_LOG: 1

      # additional steps to process artifacts

Inputs

Name Description Required Default
command command to execute yes
arguments arguments for command no
target file(s) or directory to target no .

command

command supports the following subset of Packer CLI commands:

  • init to download Packer plugin binaries
  • build to generate a set of artifacts from a template
  • fix to find and correct backwards incompatible stanzas in a template
  • validate to validate the syntax and configuration of a template

Other CLI commands (console, inspect and version) are technically supported, but have limited utility in a GitHub Actions Workflow, due to their interactive nature.

arguments

arguments supports all options available for the respective command.

The arguments must be provided as a single string. Multiple arguments should be concatenated like so: -color=false -on-error=abort

target

target supports a string consisting of one or more file or directory paths:

   # single file
   target: artifacts.pkr.hcl

   # multiple files, separated by whitespace
   target: artifacts.pkr.hcl packer.pkr.hcl

   # working directory
   target: .

The Action will iterate over each file and run each command, separately.

Detailed logs

Packer has an option to enable more detailed logs by setting the PACKER_LOG environment variable. Any value other than "" (empty string) and "0", will cause detailed logs to appear on stderr.

To set PACKER_LOG=1, simply define the environment variable in the step configuration like:

  # build artifact
  - name: Build Artifact
    uses: collins-w/[email protected]
    with:
      command: build
      arguments: "-color=false -on-error=abort"
      target: packer.pkr.hcl
    env:
      PACKER_LOG: 1

Notes

  • To enable debug logging, create a secret named ACTIONS_STEP_DEBUG with the value true. See here for more information.

Author Information

This module is maintained by the contributors listed on GitHub.

Development of this module was sponsored by Operate Happy.

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.

packer-github-actions's People

Contributors

collins-w avatar ksatirli avatar sylviamoss avatar attesch avatar frankjl avatar devsecfranklin avatar jasoniamaunixadmin avatar palfrey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.