Skip to content

Commit feb133b

Browse files
author
mcdonnnj
committed
2 parents c370b2f + e79569c commit feb133b

File tree

6 files changed

+288
-101
lines changed

6 files changed

+288
-101
lines changed

.github/CODEOWNERS

+14
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,17 @@
88
# These folks own any files in the .github directory at the root of
99
# the repository and any of its subdirectories.
1010
/.github/ @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj
11+
12+
# These folks own all linting configuration files.
13+
/.ansible-lint @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj
14+
/.bandit.yml @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj
15+
/.flake8 @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj
16+
/.isort.cfg @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj
17+
/.mdl_config.yaml @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj
18+
/.pre-commit-config.yaml @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj
19+
/.prettierignore @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj
20+
/.yamllint @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj
21+
/requirements.txt @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj
22+
/requirements-dev.txt @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj
23+
/requirements-test.txt @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj
24+
/setup-env @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj

.github/workflows/build.yml

+51-24
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,31 @@
22
name: build
33

44
on:
5-
push:
5+
merge_group:
6+
types:
7+
- checks_requested
68
pull_request:
9+
push:
710
repository_dispatch:
8-
types: [apb]
11+
types:
12+
- apb
13+
14+
# Set a default shell for any run steps. The `-Eueo pipefail` sets errtrace,
15+
# nounset, errexit, and pipefail. The `-x` will print all commands as they are
16+
# run. Please see the GitHub Actions documentation for more information:
17+
# https://docs.github.com/en/actions/using-jobs/setting-default-values-for-jobs
18+
defaults:
19+
run:
20+
shell: bash -Eueo pipefail -x {0}
921

1022
env:
1123
CURL_CACHE_DIR: ~/.cache/curl
1224
PIP_CACHE_DIR: ~/.cache/pip
1325
PRE_COMMIT_CACHE_DIR: ~/.cache/pre-commit
1426
RUN_TMATE: ${{ secrets.RUN_TMATE }}
27+
TERRAFORM_DOCS_REPO_BRANCH_NAME: improvement/support_atx_closed_markdown_headers
28+
TERRAFORM_DOCS_REPO_DEPTH: 1
29+
TERRAFORM_DOCS_REPO_URL: https://github.com/mcdonnnj/terraform-docs.git
1530

1631
jobs:
1732
diagnostics:
@@ -27,7 +42,7 @@ jobs:
2742
egress-policy: audit
2843
- id: github-status
2944
name: Check GitHub status
30-
uses: crazy-max/ghaction-github-status@v3
45+
uses: crazy-max/ghaction-github-status@v4
3146
- id: dump-context
3247
name: Dump context
3348
uses: crazy-max/ghaction-dump-context@v2
@@ -45,20 +60,20 @@ jobs:
4560
uses: cisagov/setup-env-github-action@develop
4661
- uses: actions/checkout@v4
4762
- id: setup-python
48-
uses: actions/setup-python@v4
63+
uses: actions/setup-python@v5
4964
with:
50-
python-version: "3.11"
65+
python-version: ${{ steps.setup-env.outputs.python-version }}
5166
# We need the Go version and Go cache location for the actions/cache step,
5267
# so the Go installation must happen before that.
5368
- id: setup-go
54-
uses: actions/setup-go@v4
69+
uses: actions/setup-go@v5
5570
with:
5671
# There is no expectation for actual Go code so we disable caching as
5772
# it relies on the existence of a go.sum file.
5873
cache: false
59-
go-version: "1.20"
60-
- name: Lookup Go cache directory
61-
id: go-cache
74+
go-version: ${{ steps.setup-env.outputs.go-version }}
75+
- id: go-cache
76+
name: Lookup Go cache directory
6277
run: |
6378
echo "dir=$(go env GOCACHE)" >> $GITHUB_OUTPUT
6479
- uses: actions/cache@v3
@@ -69,6 +84,10 @@ jobs:
6984
packer${{ steps.setup-env.outputs.packer-version }}-\
7085
tf${{ steps.setup-env.outputs.terraform-version }}-"
7186
with:
87+
key: "${{ env.BASE_CACHE_KEY }}\
88+
${{ hashFiles('**/requirements-test.txt') }}-\
89+
${{ hashFiles('**/requirements.txt') }}-\
90+
${{ hashFiles('**/.pre-commit-config.yaml') }}"
7291
# Note that the .terraform directory IS NOT included in the
7392
# cache because if we were caching, then we would need to use
7493
# the `-upgrade=true` option. This option blindly pulls down the
@@ -80,10 +99,6 @@ jobs:
8099
${{ env.PRE_COMMIT_CACHE_DIR }}
81100
${{ env.CURL_CACHE_DIR }}
82101
${{ steps.go-cache.outputs.dir }}
83-
key: "${{ env.BASE_CACHE_KEY }}\
84-
${{ hashFiles('**/requirements-test.txt') }}-\
85-
${{ hashFiles('**/requirements.txt') }}-\
86-
${{ hashFiles('**/.pre-commit-config.yaml') }}"
87102
restore-keys: |
88103
${{ env.BASE_CACHE_KEY }}
89104
- name: Setup curl cache
@@ -101,34 +116,46 @@ jobs:
101116
${{ env.CURL_CACHE_DIR }}/"${PACKER_ZIP}"
102117
sudo mv /usr/local/bin/packer /usr/local/bin/packer-default
103118
sudo ln -s /opt/packer/packer /usr/local/bin/packer
104-
- uses: hashicorp/setup-terraform@v2
119+
- uses: hashicorp/setup-terraform@v3
105120
with:
106121
terraform_version: ${{ steps.setup-env.outputs.terraform-version }}
107122
- name: Install go-critic
108123
env:
109124
PACKAGE_URL: github.com/go-critic/go-critic/cmd/gocritic
110125
PACKAGE_VERSION: ${{ steps.setup-env.outputs.go-critic-version }}
111126
run: go install ${PACKAGE_URL}@${PACKAGE_VERSION}
127+
- name: Install goimports
128+
env:
129+
PACKAGE_URL: golang.org/x/tools/cmd/goimports
130+
PACKAGE_VERSION: ${{ steps.setup-env.outputs.goimports-version }}
131+
run: go install ${PACKAGE_URL}@${PACKAGE_VERSION}
112132
- name: Install gosec
113133
env:
114134
PACKAGE_URL: github.com/securego/gosec/v2/cmd/gosec
115135
PACKAGE_VERSION: ${{ steps.setup-env.outputs.gosec-version }}
116136
run: go install ${PACKAGE_URL}@${PACKAGE_VERSION}
117-
- name: Install shfmt
118-
env:
119-
PACKAGE_URL: mvdan.cc/sh/v3/cmd/shfmt
120-
PACKAGE_VERSION: ${{ steps.setup-env.outputs.shfmt-version }}
121-
run: go install ${PACKAGE_URL}@${PACKAGE_VERSION}
122137
- name: Install staticcheck
123138
env:
124139
PACKAGE_URL: honnef.co/go/tools/cmd/staticcheck
125140
PACKAGE_VERSION: ${{ steps.setup-env.outputs.staticcheck-version }}
126141
run: go install ${PACKAGE_URL}@${PACKAGE_VERSION}
127-
- name: Install Terraform-docs
128-
env:
129-
PACKAGE_URL: github.com/terraform-docs/terraform-docs
130-
PACKAGE_VERSION: ${{ steps.setup-env.outputs.terraform-docs-version }}
131-
run: go install ${PACKAGE_URL}@${PACKAGE_VERSION}
142+
# TODO: https://github.com/cisagov/skeleton-generic/issues/165
143+
# We are temporarily using @mcdonnnj's forked branch of terraform-docs
144+
# until his PR: https://github.com/terraform-docs/terraform-docs/pull/745
145+
# is approved. This temporary fix will allow for ATX header support when
146+
# terraform-docs is run during linting.
147+
- name: Clone ATX headers branch from terraform-docs fork
148+
run: |
149+
git clone \
150+
--branch $TERRAFORM_DOCS_REPO_BRANCH_NAME \
151+
--depth $TERRAFORM_DOCS_REPO_DEPTH \
152+
--single-branch \
153+
$TERRAFORM_DOCS_REPO_URL /tmp/terraform-docs
154+
- name: Build and install terraform-docs binary
155+
run: |
156+
go build \
157+
-C /tmp/terraform-docs \
158+
-o $(go env GOPATH)/bin/terraform-docs
132159
- name: Install dependencies
133160
run: |
134161
python -m pip install --upgrade pip setuptools wheel

.github/workflows/sync-labels.yml

+24
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,38 @@ permissions:
1111
contents: read
1212

1313
jobs:
14+
diagnostics:
15+
name: Run diagnostics
16+
runs-on: ubuntu-latest
17+
steps:
18+
# Note that a duplicate of this step must be added at the top of
19+
# each job.
20+
- id: harden-runner
21+
name: Harden the runner
22+
uses: step-security/harden-runner@v2
23+
with:
24+
egress-policy: audit
25+
- id: github-status
26+
name: Check GitHub status
27+
uses: crazy-max/ghaction-github-status@v3
28+
- id: dump-context
29+
name: Dump context
30+
uses: crazy-max/ghaction-dump-context@v2
1431
labeler:
32+
needs:
33+
- diagnostics
1534
permissions:
1635
# actions/checkout needs this to fetch code
1736
contents: read
1837
# crazy-max/ghaction-github-labeler needs this to manage repository labels
1938
issues: write
2039
runs-on: ubuntu-latest
2140
steps:
41+
- id: harden-runner
42+
name: Harden the runner
43+
uses: step-security/harden-runner@v2
44+
with:
45+
egress-policy: audit
2246
- uses: actions/checkout@v4
2347
- name: Sync repository labels
2448
if: success()

.pre-commit-config.yaml

+40-25
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ default_language_version:
55

66
repos:
77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v4.4.0
8+
rev: v4.5.0
99
hooks:
1010
- id: check-case-conflict
1111
- id: check-executables-have-shebangs
@@ -33,32 +33,39 @@ repos:
3333

3434
# Text file hooks
3535
- repo: https://github.com/igorshubovych/markdownlint-cli
36-
rev: v0.36.0
36+
rev: v0.39.0
3737
hooks:
3838
- id: markdownlint
3939
args:
4040
- --config=.mdl_config.yaml
4141
- repo: https://github.com/pre-commit/mirrors-prettier
42-
rev: v3.0.3
42+
# This is the last version of v3 available from the mirror. We should hold
43+
# here until v4, which is currently in alpha, is more stable.
44+
rev: v3.1.0
4345
hooks:
4446
- id: prettier
47+
# This is the latest version of v3 available from NPM. The pre-commit
48+
# mirror does not pull tags for old major versions once a new major
49+
# version tag is published.
50+
additional_dependencies:
51+
4552
- repo: https://github.com/adrienverge/yamllint
46-
rev: v1.32.0
53+
rev: v1.35.1
4754
hooks:
4855
- id: yamllint
4956
args:
5057
- --strict
5158

5259
# GitHub Actions hooks
5360
- repo: https://github.com/python-jsonschema/check-jsonschema
54-
rev: 0.26.3
61+
rev: 0.28.0
5562
hooks:
5663
- id: check-github-actions
5764
- id: check-github-workflows
5865

5966
# pre-commit hooks
6067
- repo: https://github.com/pre-commit/pre-commit
61-
rev: v3.4.0
68+
rev: v3.6.2
6269
hooks:
6370
- id: validate_manifest
6471

@@ -80,76 +87,84 @@ repos:
8087
- id: go-vet-repo-mod
8188
# GoSec
8289
- id: go-sec-repo-mod
83-
90+
# goimports
91+
- id: go-imports-repo
92+
args:
93+
# Write changes to files
94+
- -w
8495
# Nix hooks
8596
- repo: https://github.com/nix-community/nixpkgs-fmt
8697
rev: v1.3.0
8798
hooks:
8899
- id: nixpkgs-fmt
89100

90101
# Shell script hooks
91-
- repo: https://github.com/cisagov/pre-commit-shfmt
92-
rev: v0.0.2
102+
- repo: https://github.com/scop/pre-commit-shfmt
103+
rev: v3.7.0-4
93104
hooks:
94105
- id: shfmt
95106
args:
107+
# List files that will be formatted
108+
- --list
109+
# Write result to file instead of stdout
110+
- --write
96111
# Indent by two spaces
97-
- -i
98-
- '2'
112+
- --indent
113+
- "2"
99114
# Binary operators may start a line
100-
- -bn
115+
- --binary-next-line
101116
# Switch cases are indented
102-
- -ci
117+
- --case-indent
103118
# Redirect operators are followed by a space
104-
- -sr
105-
- repo: https://github.com/detailyang/pre-commit-shell
106-
rev: 1.0.5
119+
- --space-redirects
120+
- repo: https://github.com/shellcheck-py/shellcheck-py
121+
rev: v0.9.0.6
107122
hooks:
108-
- id: shell-lint
123+
- id: shellcheck
109124

110125
# Python hooks
111126
- repo: https://github.com/PyCQA/bandit
112-
rev: 1.7.5
127+
rev: 1.7.7
113128
hooks:
114129
- id: bandit
115130
args:
116131
- --config=.bandit.yml
117132
- repo: https://github.com/psf/black-pre-commit-mirror
118-
rev: 23.9.1
133+
rev: 24.2.0
119134
hooks:
120135
- id: black
121136
- repo: https://github.com/PyCQA/flake8
122-
rev: 6.1.0
137+
rev: 7.0.0
123138
hooks:
124139
- id: flake8
125140
additional_dependencies:
126141
- flake8-docstrings
127142
- repo: https://github.com/PyCQA/isort
128-
rev: 5.12.0
143+
rev: 5.13.2
129144
hooks:
130145
- id: isort
131146
- repo: https://github.com/pre-commit/mirrors-mypy
132-
rev: v1.5.1
147+
rev: v1.8.0
133148
hooks:
134149
- id: mypy
135150
additional_dependencies:
136151
- types-PyYAML
137152
- types-requests
138153
- repo: https://github.com/asottile/pyupgrade
139-
rev: v3.10.1
154+
rev: v3.15.1
140155
hooks:
141156
- id: pyupgrade
142157

143158
# Ansible hooks
144159
- repo: https://github.com/ansible/ansible-lint
145-
rev: v6.19.0
160+
rev: v24.2.0
146161
hooks:
147162
- id: ansible-lint
148163
# files: molecule/default/playbook.yml
149164

150165
# Terraform hooks
151166
- repo: https://github.com/antonbabenko/pre-commit-terraform
152-
rev: v1.83.2
167+
rev: v1.88.0
153168
hooks:
154169
- id: terraform_fmt
155170
- id: terraform_validate

0 commit comments

Comments
 (0)