Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintenance #96

Merged
merged 31 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0e32064
bumps `actions/checkout` to `v4`
ksatirli Apr 23, 2024
2c9a0c9
bumps base Packer versions to `1.10`
ksatirli Apr 23, 2024
33e4114
docs update
ksatirli Apr 23, 2024
638438e
package-lock maintenance
ksatirli Apr 23, 2024
e1044aa
updates examples
ksatirli Apr 23, 2024
f6d1bc6
updates deps
ksatirli Apr 23, 2024
ffa64be
linting
ksatirli Apr 23, 2024
f80c3d5
experimental clean up of dependencies
ksatirli Apr 24, 2024
5114bca
moves `ncc` to `devDependencies`
ksatirli Apr 24, 2024
ce9fa87
bumps versions of development actions
ksatirli Apr 24, 2024
f69e57e
assign product name as variable to make for easier re-use
ksatirli Apr 24, 2024
19bd57b
updates example Packer file with new key `bucket_labels` instead of `…
ksatirli Apr 24, 2024
ece50a5
adds external plugin for testing
ksatirli Apr 24, 2024
5bb698c
linting
ksatirli Apr 24, 2024
14d6465
adds action for compliance purposes
ksatirli Apr 24, 2024
1ccf9f3
updates copywrite config
ksatirli Apr 24, 2024
89c4baa
linting
ksatirli Apr 24, 2024
614fa19
compliance linting
ksatirli Apr 24, 2024
ac7f8e7
adds Dependabot configuration
ksatirli Apr 24, 2024
c909bd1
bumps `github-actions-core` to `v1.0.0-rc1`
ksatirli Apr 24, 2024
c531483
expands README and removes outdated changelog
ksatirli Apr 24, 2024
3bad4be
switches Amazon plugin to Hashicups plugin
ksatirli May 2, 2024
b609c4e
adds `run-script` for `copywrite`
ksatirli May 3, 2024
4cc4cd7
cleans up dependencies
ksatirli May 3, 2024
b10d46f
cleans up dependencies
ksatirli May 3, 2024
754b5cb
linting
ksatirli May 3, 2024
9088f36
install `ncc` globally instead of via `devDeps`
ksatirli May 3, 2024
8170726
install packages globally
ksatirli May 3, 2024
ccde294
linting
ksatirli May 3, 2024
7692f8c
linting
ksatirli May 3, 2024
9616de9
linting
ksatirli May 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .copywrite.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
schema_version = 1

project {
header_ignore = [
"dist/index.js"
license = "Apache-2.0"
copyright_holder = "HashiCorp, Inc."
copyright_year = 2022

header_ignore = [
"dist/*",
"node_modules/",
]
}
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"

# Dependabot only updates HashiCorp GHAs, external GHAs are managed by internal tooling (tsccr)
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
allow:
- dependency-name: "hashicorp/*"
4 changes: 2 additions & 2 deletions .github/workflows/actions-self-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ on:
push:

env:
PRODUCT_VERSION: "1.8.6"
PRODUCT_VERSION: "1.10.0"
ksatirli marked this conversation as resolved.
Show resolved Hide resolved

jobs:
setup-packer:
name: Test `setup-packer`
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3

- name: Setup `packer` (using local GitHub Action)
uses: "./"
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/compliance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: "HashiCorp: Compliance"

on:
push:

permissions:
contents: read

jobs:
copywrite:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0

- uses: hashicorp/setup-copywrite@867a1a2a064a0626db322392806428f7dc59cb3e # v1.1.2

- run: copywrite headers --plan

- run: copywrite license --plan
2 changes: 1 addition & 1 deletion .github/workflows/superlinter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
fetch-depth: 1

- name: Set up Node.js
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
Expand Down
15 changes: 0 additions & 15 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2020 HashiCorp, Inc.
Copyright (c) 2022 HashiCorp, Inc.

ksatirli marked this conversation as resolved.
Show resolved Hide resolved
Apache License
Version 2.0, January 2004
Expand Down
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ The `hashicorp/setup-packer` Action sets up the [Packer](https://www.packer.io)
## Table of Contents

<!-- TOC -->
* [GitHub Action: `setup-packer`](#github-action--setup-packer)
* [GitHub Action: `setup-packer`](#github-action-setup-packer)
* [Table of Contents](#table-of-contents)
* [Requirements](#requirements)
* [Usage](#usage)
* [Inputs](#inputs)
* [Outputs](#outputs)
* [Integrating with HCP Packer](#Integrating-with-HCP-Packer)
* [Integrating with HCP Packer](#integrating-with-hcp-packer)
* [Author Information](#author-information)
* [License](#license)
<!-- TOC -->
Expand All @@ -28,7 +28,7 @@ Other [environment variables](https://developer.hashicorp.com/packer/docs/comman

## Usage

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

```yaml
name: packer
Expand All @@ -37,15 +37,15 @@ on:
push:

env:
PRODUCT_VERSION: "1.8.6" # or: "latest"
PRODUCT_VERSION: "1.10.0" # or: "latest"
ksatirli marked this conversation as resolved.
Show resolved Hide resolved

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

- name: Setup `packer`
uses: hashicorp/setup-packer@main
Expand All @@ -66,8 +66,8 @@ 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](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows).
- The origin of this GitHub Action has been set as `hashicorp/setup-packer@main`. For newer versions, see the [Releases](https://github.com/hashicorp/setup-packer/releases).
- The version of `packer` to set up has been set as `1.8.6`. For a complete list, see [releases.hashicorp.com](https://releases.hashicorp.com/packer/).
- The Packer manifest to interact with has been set as `./image.pkr.hcl`
- The version of `packer` to set up has been set as `1.10.0`. For a complete list, see [releases.hashicorp.com](https://releases.hashicorp.com/packer/).
ksatirli marked this conversation as resolved.
Show resolved Hide resolved
- 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](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-self-hosted-runners) runners.

Expand All @@ -79,18 +79,24 @@ This section contains a list of all inputs that may be set for this Action.

- `version` - The version of `packer` to install. Defaults to `latest` if unset.

> [!NOTE]
> To retrieve the `latest` version, this GitHub Action polls the HashiCorp [Releases API](https://api.releases.hashicorp.com/v1/releases/packer) and finds the latest released version of Packer that isn't marked as a pre-release (`is_prerelease`).

## Outputs

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

- `version` - The version of `packer` that was installed.

## Integrating with HCP Packer

To integrate with HCP Packer, add your HCP Client ID and HCP Client secret as environment variables to the Packer build call.

We add an `HCP_PACKER_BUILD_FINGERPRINT` in this example that is based on the workflow run ID, that way it is always unique

We recommend storing these in [GitHub Actions Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) (as opposed to plain-text). See the [HCP Packer Getting Started tutorial](https://developer.hashicorp.com/packer/tutorials/hcp-get-started/hcp-push-image-metadata)
We recommend storing these in [GitHub Actions Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) (as opposed to plain-text).

For more information on using HCP Packer, see the [Getting Started tutorial](https://developer.hashicorp.com/packer/tutorials/hcp-get-started/hcp-push-image-metadata).

```yaml
name: hcp-packer
Expand All @@ -104,15 +110,18 @@ jobs:
name: Run Packer
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup `packer`
uses: hashicorp/setup-packer@main
id: setup
with:
version: "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"
Expand Down
340 changes: 278 additions & 62 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

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

7 changes: 5 additions & 2 deletions examples/hcp-packer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,24 @@ jobs:
name: Run Packer
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup `packer`
uses: hashicorp/setup-packer@main
id: setup
with:
version: "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"

- name: Build Artifact
run: packer build -color=false -on-error=abort image.pkr.hcl
run: "packer build -color=false -on-error=abort image.pkr.hcl"
env:
HCP_CLIENT_ID: ${{ secrets.HCP_CLIENT_ID }}
HCP_CLIENT_SECRET: ${{ secrets.HCP_CLIENT_SECRET }}
Expand Down
4 changes: 2 additions & 2 deletions examples/packer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
name: Run Packer
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup `packer`
uses: hashicorp/setup-packer@main
id: setup
with:
version: "1.8.6" # or latest
version: "1.10.0" # or latest
ksatirli marked this conversation as resolved.
Show resolved Hide resolved

- name: Run `packer init`
id: init
Expand Down
Loading
Loading