Skip to content

Commit

Permalink
feat: add pre-commit checks
Browse files Browse the repository at this point in the history
  • Loading branch information
josmo committed Feb 22, 2024
1 parent 4fd9bec commit 31b662a
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 60 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/lint-tf.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/lint-yaml.yaml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: pre-commit
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install pre-commit
run: pip install pre-commit
- name: pre-commit
run: pre-commit run --all-files --show-diff-on-failure
43 changes: 43 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
- id: forbid-submodules
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
args: [--strict, -c=.yamllint]
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.11.0
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ['@commitlint/config-conventional']
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.85.0
hooks:
- id: terraform_fmt
- id: terraform_wrapper_module_for_each
# - id: terraform_validate
- id: terraform_docs
args:
- '--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_standard_module_structure'
# - '--args=--only=terraform_workspace_remote'
2 changes: 1 addition & 1 deletion .tflint.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ plugin "aws" {
enabled = true
version = "0.30.0"
source = "github.com/terraform-linters/tflint-ruleset-aws"
}
}
17 changes: 0 additions & 17 deletions Makefile

This file was deleted.

1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']};
3 changes: 1 addition & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
![TF Lint](https://github.com/pelotech/foundation/actions/workflows/lint-tf.yaml/badge.svg)
![YAML Lint](https://github.com/pelotech/foundation/actions/workflows/lint-yaml.yaml/badge.svg)
![pre-commit](https://github.com/pelotech/foundation/actions/workflows/pre-commit.yaml/badge.svg)
![Publish-Kustomizations](https://github.com/pelotech/foundation/actions/workflows/publish-kustomizations.yaml/badge.svg)


Expand Down
2 changes: 0 additions & 2 deletions gitops/base-install/replacements/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,3 @@ replacements:
name: cert-manager
fieldPaths:
- spec.source.helm.valuesObject.serviceAccount.annotations.[eks.amazonaws.com/role-arn]


1 change: 0 additions & 1 deletion gitops/components/crossplane/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ patches:
value:
namespace: crossplane-system
server: https://kubernetes.default.svc
1 change: 0 additions & 1 deletion gitops/components/crossplane/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ spec:
targetRevision: 1.14.5
helm:
releaseName: crossplane

1 change: 0 additions & 1 deletion gitops/components/s3-csi/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ replacements:
name: s3-csi
fieldPaths:
- spec.source.helm.valuesObject.node.serviceAccount.annotations.[eks.amazonaws.com/role-arn]

1 change: 0 additions & 1 deletion gitops/components/s3-csi/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ spec:
annotations:
eks.amazonaws.com/role-arn: S3_CSI_ROLE_ARN
eks.amazonaws.com/sts-regional-endpoints: "true"

1 change: 0 additions & 1 deletion gitops/components/whereabouts/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ patches:
- op: add
path: /spec/sourceRepos/-
value: registry-1.docker.io/bitnamicharts
3 changes: 3 additions & 0 deletions terraform/example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ provider "aws" {
region = "us-west-2"
}
data "aws_caller_identity" "current" {}
output "account_id" {
value = data.aws_caller_identity.current.account_id
}
resource "aws_ebs_encryption_by_default" "us_west_2" {
enabled = true
}
Expand Down

0 comments on commit 31b662a

Please sign in to comment.