Skip to content

Commit 7ee7336

Browse files
Maintenance (#7)
* enables GitHub Code Scanning * linting and maintenance --------- Co-authored-by: Jenna Goldstrich <[email protected]>
1 parent 7e52eff commit 7ee7336

24 files changed

+15749
-14094
lines changed

.copywrite.hcl

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
schema_version = 1
2+
3+
project {
4+
header_ignore = [
5+
"dist/index.js"
6+
]
7+
}

.github/ISSUE_TEMPLATE/bug.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Bug
3+
about: A bug or problem with this Action
4+
labels: bug
5+
---
6+
7+
<!-- Please provide a general summary of the issue in the Title above -->
8+
9+
# Expected Behavior
10+
11+
<!-- Explain what you expect to happen -->
12+
13+
## Current Behavior
14+
15+
<!-- Explain what actually happens -->
16+
17+
## Steps to Reproduce
18+
19+
<!-- Explain how to reproduce the problem -->
20+
<!-- If relevant, include code, screenshots or links -->
21+
22+
## Environment
23+
24+
1.) Link to a Gist of your Workflow configuration:
25+
26+
2.) Any other relevant environment information:
27+
28+
```sh
29+
30+
```
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "GitHub Action: Self-Test"
2+
3+
on:
4+
push:
5+
6+
env:
7+
PRODUCT_VERSION: "0.0.1-techpreview.3"
8+
PRODUCT_HASH: "3b4163b"
9+
10+
jobs:
11+
setup-nomad-pack:
12+
name: Test `setup-nomad-pack`
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
19+
- name: Setup `nomad-pack` (using local GitHub Action)
20+
uses: "./"
21+
id: setup
22+
with:
23+
version: ${{ env.PRODUCT_VERSION }}
24+
25+
- name: Print `$PATH` for `nomad-pack`
26+
run: which nomad-pack
27+
28+
- name: Print `nomad-pack` version
29+
run: nomad-pack version
30+
31+
- name: Validate `nomad-pack` version is accurate
32+
run: "nomad-pack version | grep --silent 'Nomad Pack v${{ env.PRODUCT_VERSION }} (${{ env.PRODUCT_HASH }})'"
33+
34+
- name: Run `nomad-pack render`
35+
run: nomad-pack render --auto-approve "./test/"
36+
37+
- name: Setup `nomad-pack` with an invalid version (using local GitHub Action)
38+
uses: "./"
39+
id: invalid_version
40+
with:
41+
version: "invalid_version"
42+
continue-on-error: true
43+
44+
- name: Validate invalid version failed
45+
if: steps.invalid_version.outcome == 'success'
46+
run: echo "Installing an invalid version expected to fail but did not" && exit 1
47+
48+
# Testing against `latest` doesn't work with pre-release versions, so this is temporarily disabled:
49+
# - name: Setup `nomad-pack` with `latest` version (using local GitHub Action)
50+
# uses: "./"
51+
# id: latest_version
52+
# with:
53+
# version: "latest"
54+
55+
- name: Print `nomad-pack` version
56+
run: nomad-pack version

.github/workflows/snyk.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ jobs:
88
snyk:
99
runs-on: ubuntu-latest
1010

11+
permissions:
12+
security-events: write
13+
actions: read
14+
contents: read
15+
1116
strategy:
1217
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast
1318
fail-fast: false
@@ -28,8 +33,8 @@ jobs:
2833
# see https://github.com/snyk/actions/tree/master/node#uploading-snyk-scan-results-to-github-code-scanning
2934
args: --policy-path=.snyk --sarif-file-output=snyk.sarif --org=${{ secrets.SNYK_ORG }}
3035

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
36+
# see https://github.com/github/codeql-action/tree/main/upload-sarif
37+
- name: Upload Snyk IaC results to GitHub Code Scanning
38+
uses: github/codeql-action/upload-sarif@v2
39+
with:
40+
sarif_file: snyk.sarif

.github/workflows/typescript.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
node-version:
17-
- 16.x
17+
- 18.x
1818

1919
steps:
2020
- name: Checkout Repository
@@ -29,10 +29,7 @@ jobs:
2929
cache: 'npm'
3030

3131
- name: Install NPM Packages
32-
run: npm install
33-
34-
- name: Format TypeScript code
35-
run: npm run-script fmt
32+
run: npm ci
3633

3734
- name: Build TypeScript code
38-
run: npm run-script build
35+
run: npm run build

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
lib/
21
node_modules/

.release-it.json

-34
This file was deleted.

.snyk

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ ignore:
66
'snyk:lic:npm:hashicorp:js-releases:MPL-2.0':
77
- '@hashicorp/js-releases':
88
reason: acceptable license
9-
expires: 2023-12-31T00:00:00.000Z
10-
created: 2022-08-16T00:00:00.000Z
9+
expires: 2024-12-31T00:00:00.000Z
10+
created: 2023-01-01T00:00:00.000Z
1111

1212
# see https://security.snyk.io/vuln/snyk:lic:npm:openpgp:LGPL-3.0
1313
'snyk:lic:npm:openpgp:LGPL-3.0':
1414
- '@hashicorp/js-releases > openpgp':
1515
reason: acceptable license
16-
expires: 2023-12-31T00:00:00.000Z
17-
created: 2022-08-16T00:00:00.000Z
16+
expires: 2024-12-31T00:00:00.000Z
17+
created: 2023-01-01T00:00:00.000Z
1818

1919
patch: {}

README.md

+32-20
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
1-
# GitHub Action: setup-nomad-pack
1+
# GitHub Action: `setup-nomad-pack`
22

3-
The `hashicorp/setup-nomad-pack` Action sets up the `nomad-pack` CLI in your GitHub Actions workflow by adding the binary to `PATH`.
3+
The `hashicorp/setup-nomad-pack` Action sets up the [Nomad Pack](https://developer.hashicorp.com/nomad/tutorials/nomad-pack/nomad-pack-intro) CLI in your GitHub Actions workflow by adding the `nomad-pack` binary to `PATH`.
4+
5+
[![GitHub Action: Self-Test](https://github.com/hashicorp/setup-nomad-pack/actions/workflows/actions-self-test.yml/badge.svg?branch=main)](https://github.com/hashicorp/setup-nomad-pack/actions/workflows/actions-self-test.yml)
46

57
## Table of Contents
68

7-
- [GitHub Action: setup-nomad-pack](#github-action-setup-nomad-pack)
8-
- [Table of Contents](#table-of-contents)
9-
- [Requirements](#requirements)
10-
- [Usage](#usage)
11-
- [Author Information](#author-information)
12-
- [License](#license)
9+
<!-- TOC -->
10+
* [GitHub Action: `setup-nomad-pack`](#github-action--setup-nomad-pack)
11+
* [Table of Contents](#table-of-contents)
12+
* [Requirements](#requirements)
13+
* [Usage](#usage)
14+
* [Inputs](#inputs)
15+
* [Outputs](#outputs)
16+
* [Author Information](#author-information)
17+
* [License](#license)
18+
<!-- TOC -->
1319

1420
## Requirements
1521

1622
This GitHub Actions supports all commands that are available in the `nomad-pack` CLI.
1723

1824
The `run`, `destroy`, `info`, and `status` commands require access to a Nomad cluster, as defined through the environment variable `NOMAD_ADDR`.
1925

20-
Other [environment variables](https://www.nomadproject.io/docs/commands#environment-variables) (such as `NOMAD_TOKEN`) may be set as normal and will be picked up accordingly.
26+
Other [environment variables](https://developer.hashicorp.com/nomad/docs/commands#environment-variables) (such as `NOMAD_TOKEN`) may be set as normal and will be picked up accordingly.
2127

2228
## Usage
2329

@@ -26,7 +32,7 @@ Other [environment variables](https://www.nomadproject.io/docs/commands#environm
2632
- Set the `NOMAD_ADDR` to the IP-address or hostname of a Nomad cluster that is routable for GitHub Actions Runners.
2733
- Set the `NOMAD_TOKEN` to a token with appropriate permissions to carry out Pack-specific operations on a Nomad cluster.
2834

29-
Optionally, set any and all [environment variables](https://www.nomadproject.io/docs/commands#environment-variables) as required for your Nomad cluster.
35+
Optionally, set any and all [environment variables](https://developer.hashicorp.com/nomad/docs/commands#environment-variables) as required for your Nomad cluster.
3036

3137
> **Warning**
3238
> Running services such as Nomad on a publicly accessible port without authentication is a decidedly bad idea.
@@ -44,6 +50,9 @@ name: nomad-pack
4450
on:
4551
- push
4652

53+
env:
54+
PRODUCT_VERSION: "0.0.1-techpreview.3"
55+
4756
jobs:
4857
setup-nomad-pack:
4958
runs-on: ubuntu-latest
@@ -53,31 +62,34 @@ jobs:
5362
uses: actions/checkout@v3
5463

5564
- name: Setup `nomad-pack`
56-
# TODO: define `v1`
57-
uses: hashicorp/[email protected]
65+
uses: hashicorp/[email protected]
5866
id: setup
5967
with:
60-
version: "0.0.1-techpreview2" # or `latest`
68+
version: ${{ env.PRODUCT_VERSION }}
6169

62-
- name: Run `nomad-pack info` for `simple_service`
70+
- name: Run `nomad-pack info` for `./test`
6371
id: info
64-
run: "nomad-pack info ./packs/simple_service"
72+
run: "nomad-pack render ./test"
6573

66-
- name: Run `nomad-pack run` for `simple_service`
74+
- name: Run `nomad-pack run` for `./test`
6775
id: run
68-
run: "nomad-pack run ./packs/simple_service"
76+
run: "nomad-pack run ./test"
6977
env:
7078
NOMAD_ADDR: "${{ secrets.NOMAD_ADDR }}"
7179
NOMAD_TOKEN: "${{ secrets.NOMAD_TOKEN }}"
7280
continue-on-error: true
81+
82+
- name: Run `nomad-pack version`
83+
id: version
84+
run: "nomad-pack version"
7385
```
7486
7587
In the above example, the following definitions have been set.
7688
7789
- 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).
78-
- The origin of this GitHub Action has been set as `hashicorp/setup-nomad-pack@0.9.2`. For newer versions, see the [Releases](https://github.com/hashicorp/setup-nomad-pack/releases).
79-
- The version of `nomad-pack` to set up has been set as `0.0.1-techpreview2`. For a complete list, see [releases.hashicorp.com](https://releases.hashicorp.com/nomad-pack/).
80-
- The pack to deploy has been set as `./packs/simple_service`
90+
- The origin of this GitHub Action has been set as `hashicorp/setup-nomad-pack@1.0.0`. For newer versions, see the [Releases](https://github.com/hashicorp/setup-nomad-pack/releases).
91+
- The version of `nomad-pack` to set up has been set as `0.0.1-techpreview.3`. For a complete list, see [releases.hashicorp.com](https://releases.hashicorp.com/nomad-pack/).
92+
- The pack to interact with has been set to `./test`
8193

8294
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.
8395

0 commit comments

Comments
 (0)