Skip to content

Commit

Permalink
add linters and checkers
Browse files Browse the repository at this point in the history
  • Loading branch information
krixapolinario committed Nov 4, 2024
1 parent dfc5d6f commit dd9cb26
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 60 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/checkers.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: checkers
# name: checkers

on:
push:
branches:
- iac
# on:
# push:
# branches:
# - iac

Check failure on line 7 in .github/workflows/checkers.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[trailing-spaces]

Trailing spaces
permissions: read-all
# permissions: read-all

jobs:
tfsec:
runs-on: ubuntu-latest
steps:
- name : Check out Git Repository
uses: actions/checkout@v2
- name: Run Tfsec
uses: aquasecurity/[email protected]
# jobs:
# tfsec:
# runs-on: ubuntu-latest
# steps:
# - name : Check out Git Repository
# uses: actions/checkout@v2
# - name: Run Tfsec
# uses: aquasecurity/[email protected]

Check failure on line 17 in .github/workflows/checkers.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[new-line-at-end-of-file]

No new line character at the end of file
56 changes: 49 additions & 7 deletions .github/workflows/iac.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,71 @@
name: IaC

on:
workflow_run:
workflows: ["linters", "checkers"]
types:
- completed
push:
branches:
- iac

permissions:
contents: read

jobs:
ansible-lint:
name: Ansible Lint
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./ansible
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Run ansible-lint
uses: ansible/ansible-lint@main

Check failure on line 24 in .github/workflows/iac.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[trailing-spaces]

Trailing spaces
terraform-lint:
name: Terraform Lint
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./terraform
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Setup TFLint
uses: terraform-linters/setup-tflint@v4
with:
tflint_version: v0.52.0
- name: Show version
run: tflint --version
- name: Init TFLint
run: tflint --init
- name: Run TFLint
run: tflint -f compact

terraform-sec:
runs-on: ubuntu-latest
steps:
- name : Check out Git Repository

Check failure on line 49 in .github/workflows/iac.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[colons]

Too many spaces before colon
uses: actions/checkout@v2
- name: Run Tfsec
uses: aquasecurity/[email protected]

terraform:
name: Terraform
runs-on: ubuntu-latest
environment: production

needs:

Check failure on line 58 in .github/workflows/iac.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[trailing-spaces]

Trailing spaces
- ansible-lint
- terraform-lint
- terraform-sec
defaults:
run:
shell: bash
working-directory: ./terraform

steps:
- name: Checkout

Check failure on line 67 in .github/workflows/iac.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[indentation]

Wrong indentation: expected 6 but found 4
uses: actions/checkout@v4

- name: Setup SSH

Check failure on line 69 in .github/workflows/iac.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[trailing-spaces]

Trailing spaces
shell: bash
run: |
Expand Down
78 changes: 39 additions & 39 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
name: linters
# name: linters

on:
push:
branches:
- iac
# on:
# push:
# branches:
# - iac

permissions: read-all
# permissions: read-all

jobs:
ansible-lint:
name: Ansible Lint
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./ansible
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Run ansible-lint
uses: ansible/ansible-lint@main
# jobs:
# ansible-lint:
# name: Ansible Lint
# runs-on: ubuntu-latest
# defaults:
# run:
# shell: bash
# working-directory: ./ansible
# steps:
# - name: Checkout source code
# uses: actions/checkout@v4
# - name: Run ansible-lint
# uses: ansible/ansible-lint@main

tflint:
name: Terraform Lint
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./terraform
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Setup TFLint
uses: terraform-linters/setup-tflint@v4
with:
tflint_version: v0.52.0
- name: Show version
run: tflint --version
- name: Init TFLint
run: tflint --init
- name: Run TFLint
run: tflint -f compact
# tflint:
# name: Terraform Lint
# runs-on: ubuntu-latest
# defaults:
# run:
# shell: bash
# working-directory: ./terraform
# steps:
# - name: Checkout source code
# uses: actions/checkout@v4
# - name: Setup TFLint
# uses: terraform-linters/setup-tflint@v4
# with:
# tflint_version: v0.52.0
# - name: Show version
# run: tflint --version
# - name: Init TFLint
# run: tflint --init
# - name: Run TFLint
# run: tflint -f compact

0 comments on commit dd9cb26

Please sign in to comment.