Skip to content

Commit ae6b3ed

Browse files
JenGoldstrichksatirliaklkv
authored
Install Packer as a binary in user's path instead of being an interface for users to run Packer commands (#63)
* updates Actions config * updates docs * Remove unused code that was moved to the core library, update to hashicorp version of GHA-Core, which is currently still private Co-authored-by: Kerim Satirli <[email protected]> Co-authored-by: Alexey Kulakov <[email protected]>
1 parent 8c999b2 commit ae6b3ed

21 files changed

+25327
-280
lines changed

.github/workflows/code-quality.yml

Lines changed: 0 additions & 88 deletions
This file was deleted.

.github/workflows/repository-management.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/snyk.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: "Security Scan: Snyk Code"
3+
4+
on:
5+
push:
6+
7+
jobs:
8+
snyk:
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast
13+
fail-fast: false
14+
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 1
20+
21+
# see https://github.com/snyk/actions/tree/master/node
22+
- name: Lint Code with Snyk
23+
uses: snyk/actions/node@master
24+
env:
25+
# see https://github.com/snyk/actions#getting-your-snyk-token
26+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
27+
with:
28+
# see https://github.com/snyk/actions/tree/master/node#uploading-snyk-scan-results-to-github-code-scanning
29+
args: --policy-path=.snyk --sarif-file-output=snyk.sarif --org=${{ secrets.SNYK_ORG }}
30+
31+
# # see https://github.com/github/codeql-action/tree/main/upload-sarif
32+
# - name: Upload Snyk IaC results to GitHub Code Scanning
33+
# uses: github/codeql-action/upload-sarif@v2
34+
# with:
35+
# sarif_file: snyk.sarif

.github/workflows/superlinter.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: "Code Quality: Super-Linter"
3+
4+
on:
5+
push:
6+
7+
jobs:
8+
superlinter:
9+
name: Super-Linter
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v3
14+
with:
15+
# Full git history is needed to get a proper list of changed files within `super-linter`
16+
fetch-depth: 0
17+
18+
- name: Lint Code with Super-Linter
19+
uses: github/super-linter@v4
20+
env:
21+
VALIDATE_ALL_CODEBASE: true
22+
DEFAULT_BRANCH: "main"
23+
DISABLE_ERRORS: false
24+
JAVASCRIPT_DEFAULT_STYLE: "prettier"
25+
VALIDATE_JSON: true
26+
VALIDATE_MD: true

.github/workflows/test.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
9+
jobs:
10+
setup-packer:
11+
runs-on: ubuntu-latest
12+
name: Test setup-packer
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
## TODO: should use whatever current branch is, not hardcoded brnach
18+
- name: Setup `packer` from renamed action
19+
uses: hashicorp/setup-packer@main
20+
id: setup
21+
with:
22+
version: "1.8.1"
23+
24+
- name: Print `$PATH`
25+
run: which packer
26+
27+
- name: Print packer version
28+
run: packer version
29+
30+
- name: Validate Packer version is latest (1.8.1)
31+
run: if packer version | grep -q "Packer v1.8.1"; then echo "passed"; else exit 1; fi;
32+
33+
- name: Run `packer` init
34+
run: packer init "${{ github.action_path }}./test/hello-world.pkr.hcl"
35+
36+
- name: Try to setup packer for an invalid verison
37+
uses: hashicorp/setup-packer@main
38+
id: ranch
39+
with:
40+
version: "ranch"
41+
continue-on-error: true
42+
43+
- name: Validate invalid version failed
44+
if: steps.ranch.outcome == 'success'
45+
run: echo "Installing an invalid version expected to fail but did not" && exit 1
46+
47+
- name: Try to setup packer for a verison that has yet to be released
48+
uses: hashicorp/setup-packer@main
49+
id: packer3
50+
with:
51+
version: "3.0.0"
52+
continue-on-error: true
53+
54+
- name: Validate invalid version failed
55+
if: steps.packer3.outcome == 'success'
56+
run: echo "Installing a non existant expected to fail but did not" && exit 1
57+
58+
- name: No version defaults to latest
59+
uses: hashicorp/setup-packer@main
60+
id: latest
61+
62+
## TODO, don't hardcode version
63+
- name: Validate Packer version is latest (currently hardcoded, need to refactor)
64+
run: if packer version | grep -q "Packer v1.8.4"; then echo "passed"; else exit 1; fi;
65+
66+
- name: Print packer version
67+
run: packer version
68+
69+
- name: Run `packer` init
70+
run: packer init "${{ github.action_path }}./test/hello-world.pkr.hcl"

.github/workflows/typescript.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: "Code Quality: TypeScript"
3+
4+
on:
5+
push:
6+
7+
jobs:
8+
nodejs:
9+
name: Node.js
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast
14+
fail-fast: false
15+
matrix:
16+
node-version:
17+
- 18.x
18+
19+
steps:
20+
- name: Checkout Repository
21+
uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 1
24+
25+
- name: Set up Node.js
26+
uses: actions/setup-node@v3
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
cache: 'npm'
30+
31+
- name: Install NPM Packages
32+
run: npm ci
33+
34+
- name: Build TypeScript code
35+
run: npm run build

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# TODO: generate dist folder in CI
2+
# dist/
3+
node_modules/

.prettierrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"arrowParens": "avoid",
3+
"bracketSpacing": false,
4+
"parser": "typescript",
5+
"printWidth": 80,
6+
"semi": true,
7+
"singleQuote": false,
8+
"tabWidth": 2,
9+
"trailingComma": "es5",
10+
"useTabs": false
11+
}

.release-it.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"git": {
3+
"changelog": "git log --pretty=format:\"* %s (%h)\" ${from}...${to}",
4+
"commit": true,
5+
"commitArgs": ["-S"],
6+
"commitMessage": "Release v${version}",
7+
"requireBranch": false,
8+
"requireCleanWorkingDir": true,
9+
"requireCommits": true,
10+
"requireUpstream": true,
11+
"addUntrackedFiles": false,
12+
"push": true,
13+
"tag": true,
14+
"tagAnnotation": "Release v${version}"
15+
},
16+
17+
"github": {
18+
"autoGenerate": true,
19+
"draft": true,
20+
"host": null,
21+
"release": false,
22+
"releaseName": "Release v${version}",
23+
"releaseNotes": true,
24+
"skipChecks": true,
25+
"timeout": 0,
26+
"web": true
27+
},
28+
29+
"hooks": {},
30+
31+
"npm": {
32+
"publish": false
33+
}
34+
}

.snyk

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: v1.25.0
2+
3+
# see https://docs.snyk.io/snyk-cli/test-for-vulnerabilities/the-.snyk-file?q=
4+
ignore:
5+
# see https://security.snyk.io/vuln/snyk:lic:npm:hashicorp:js-releases:MPL-2.0]
6+
'snyk:lic:npm:hashicorp:js-releases:MPL-2.0':
7+
- '@hashicorp/js-releases':
8+
reason: acceptable license
9+
expires: 2023-12-31T00:00:00.000Z
10+
created: 2022-08-16T00:00:00.000Z
11+
12+
# see https://security.snyk.io/vuln/snyk:lic:npm:openpgp:LGPL-3.0
13+
'snyk:lic:npm:openpgp:LGPL-3.0':
14+
- '@hashicorp/js-releases > openpgp':
15+
reason: acceptable license
16+
expires: 2023-12-31T00:00:00.000Z
17+
created: 2022-08-16T00:00:00.000Z
18+
19+
patch: {}

0 commit comments

Comments
 (0)