-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add support for autoformatting YAML and spell checking via pre…
…-commit hooks (#1874)
- Loading branch information
1 parent
9cb185d
commit f8f3d41
Showing
57 changed files
with
400 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: pre-commit | ||
name: Pre-commit | ||
|
||
on: | ||
pull_request: | ||
|
@@ -10,41 +10,19 @@ on: | |
- '**.yaml' | ||
|
||
env: | ||
TERRAFORM_VERSION: 1.3.10 | ||
TERRAFORM_DOCS_VERSION: v0.16.0 | ||
TFSEC_VERSION: v1.22.0 | ||
TF_PLUGIN_CACHE_DIR: ${{ github.workspace }}/.terraform.d/plugin-cache | ||
TFLINT_VERSION: v0.42.1 | ||
TFLINT_VERSION: v0.50.2 | ||
|
||
concurrency: | ||
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
collectInputs: | ||
name: Collect workflow inputs | ||
runs-on: ubuntu-latest | ||
outputs: | ||
directories: ${{ steps.dirs.outputs.directories }} | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@v2 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: Checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
|
||
- name: Get root directories | ||
id: dirs | ||
uses: clowdhaus/terraform-composite-actions/[email protected] | ||
|
||
preCommitMinVersions: | ||
pre-commit: | ||
name: Min TF pre-commit | ||
needs: collectInputs | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }} | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@v2 | ||
|
@@ -62,7 +40,7 @@ jobs: | |
with: | ||
filters: | | ||
src: | ||
- '${{ matrix.directory }}/*.tf' | ||
- '*.tf' | ||
- name: Config Terraform plugin cache | ||
if: steps.changes.outputs.src== 'true' | ||
|
@@ -76,18 +54,10 @@ jobs: | |
key: ${{ runner.os }}-terraform-${{ hashFiles('**/.terraform.lock.hcl') }} | ||
restore-keys: ${{ runner.os }}-terraform- | ||
|
||
- name: Terraform min/max versions | ||
uses: clowdhaus/[email protected] | ||
if: steps.changes.outputs.src== 'true' | ||
id: minMax | ||
with: | ||
directory: ${{ matrix.directory }} | ||
|
||
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }} | ||
uses: clowdhaus/terraform-composite-actions/[email protected] | ||
if: steps.changes.outputs.src== 'true' | ||
with: | ||
terraform-version: ${{ steps.minMax.outputs.maxVersion }} | ||
terraform-version: ${{ env.TERRAFORM_VERSION }} | ||
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }} | ||
tflint-version: ${{ env.TFLINT_VERSION }} | ||
args: '--files ${{ matrix.directory }}/*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,44 @@ | ||
repos: | ||
- repo: https://github.com/streetsidesoftware/cspell-cli | ||
rev: v8.3.0 | ||
hooks: | ||
- id: cspell | ||
args: [--exclude, 'ADOPTERS.md', --exclude, '.pre-commit-config.yaml', --exclude, '.gitignore', --exclude, '*.drawio', --exclude, 'mkdocs.yml', --exclude, '.helmignore', --exclude, '.github/workflows/*', --exclude, 'patterns/istio-multi-cluster/*', --exclude, 'patterns/blue-green-upgrade/*'] | ||
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks | ||
rev: v2.12.0 | ||
hooks: | ||
- id: pretty-format-yaml | ||
args: [--autofix, --indent, '2', --offset, '2', --preserve-quotes] | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
args: ['--markdown-linebreak-ext=md'] | ||
- id: end-of-file-fixer | ||
- id: check-merge-conflict | ||
- id: detect-private-key | ||
- id: detect-aws-credentials | ||
args: ['--allow-missing-credentials'] | ||
args: [--allow-missing-credentials] | ||
- repo: https://github.com/antonbabenko/pre-commit-terraform | ||
rev: v1.86.0 | ||
hooks: | ||
- id: terraform_fmt | ||
- id: terraform_docs | ||
args: | ||
- '--args=--lockfile=false' | ||
- --args=--lockfile=false | ||
- id: terraform_tflint | ||
args: | ||
- '--args=--only=terraform_deprecated_interpolation' | ||
- '--args=--only=terraform_deprecated_index' | ||
- '--args=--only=terraform_unused_declarations' | ||
- '--args=--only=terraform_comment_syntax' | ||
- '--args=--only=terraform_documented_outputs' | ||
- '--args=--only=terraform_documented_variables' | ||
- '--args=--only=terraform_typed_variables' | ||
- '--args=--only=terraform_module_pinned_source' | ||
- '--args=--only=terraform_naming_convention' | ||
- '--args=--only=terraform_required_version' | ||
- '--args=--only=terraform_required_providers' | ||
- '--args=--only=terraform_unused_required_providers' | ||
- '--args=--only=terraform_workspace_remote' | ||
- --args=--only=terraform_deprecated_interpolation | ||
- --args=--only=terraform_deprecated_index | ||
- --args=--only=terraform_unused_declarations | ||
- --args=--only=terraform_comment_syntax | ||
- --args=--only=terraform_documented_outputs | ||
- --args=--only=terraform_documented_variables | ||
- --args=--only=terraform_typed_variables | ||
- --args=--only=terraform_module_pinned_source | ||
- --args=--only=terraform_naming_convention | ||
- --args=--only=terraform_required_version | ||
- --args=--only=terraform_required_providers | ||
- --args=--only=terraform_unused_required_providers | ||
- --args=--only=terraform_workspace_remote | ||
- id: terraform_validate | ||
exclude: (docs|modules) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dictionaryDefinitions: | ||
- name: bpWords | ||
path: ./docs/cSpell_dict.txt | ||
addWords: true | ||
dictionaries: | ||
- bpWords |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
acmpca | ||
acmca_arn | ||
addrs | ||
adot | ||
agones | ||
akuity | ||
algbw | ||
ALLOWVOLUMEEXPANSION | ||
amazonlinux | ||
apigatewayv2 | ||
apiextensions | ||
apiversion | ||
applicationset | ||
appsets | ||
argocd | ||
argoproj | ||
athenaaccess | ||
athenacurcfn | ||
autoscaler | ||
awscli | ||
awscliv2 | ||
awslabs | ||
awspca | ||
awspcaclusterissuers | ||
basepath | ||
billingreports | ||
bootstrappers | ||
boto | ||
bottlerocket | ||
busbw | ||
cacerts | ||
cainjector | ||
chdir | ||
cidrsubnet | ||
ciliumnetworkpolicy | ||
clusterip | ||
clusterissuer | ||
clusterrole | ||
clusterrolebinding | ||
clusterwide | ||
cncf | ||
compat | ||
configmap | ||
concat | ||
containerd | ||
coredns | ||
cuda | ||
customresourcedefinition | ||
crossplane | ||
crds | ||
curlimages | ||
cwlogs | ||
daemonset | ||
dcgm | ||
distro | ||
ecrpublic | ||
ecsdemo | ||
ecsfrontend | ||
elbv | ||
eksctl | ||
eksvpc | ||
emrcontainers | ||
errexit | ||
eventbridge | ||
externaldns | ||
externalsecrets | ||
externalsnat | ||
fargate | ||
fileexists | ||
finalizer | ||
finalizers | ||
flblogs | ||
fluentbit | ||
gameserver | ||
gameservers | ||
gavinbunney | ||
gitops | ||
helloworld | ||
heptio | ||
identitystore | ||
iedn | ||
iezn | ||
ingressgateway | ||
instanceids | ||
ipam | ||
irsa | ||
istio | ||
istiod | ||
istioing | ||
jsonencode | ||
karpenter | ||
kiali | ||
kubeconfig | ||
kubecost | ||
kubeflow | ||
kubelet | ||
kyverno | ||
libfabric | ||
logtag | ||
loglevel | ||
makefiles | ||
maxport | ||
minport | ||
mkdocs | ||
mktemp | ||
mountpoint | ||
mpijob | ||
mpijobs | ||
mtls | ||
nccl | ||
netcat | ||
nics | ||
nodegroup | ||
nodeport | ||
nvme | ||
oidc | ||
persistentvolume | ||
pkce | ||
pubkey | ||
privateca | ||
privatelink | ||
prometheusservice | ||
proto | ||
readyz | ||
reclaimpolicy | ||
redop | ||
replicaset | ||
rdmap | ||
rolearn | ||
rollouts | ||
rootdir | ||
rpfilter | ||
secretpassword | ||
secretstore | ||
secretuser | ||
selfsigned | ||
serviceaccount | ||
SHA512WITHRSA | ||
sleepdocs | ||
ssoadmin | ||
storageclass | ||
storageclasses | ||
tcpdump | ||
templatefile | ||
tfstate | ||
tfvars | ||
tolist | ||
toset | ||
velero | ||
VOLUMEBINDINGMODE | ||
vpclattice | ||
webfront | ||
wontfix | ||
yamlencode | ||
xlarge | ||
xonotic | ||
xrds | ||
xvda | ||
xvdb | ||
zipkin | ||
zipmap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.