Skip to content

Commit

Permalink
Update pre-commit linters (#19)
Browse files Browse the repository at this point in the history
* update pre-commit linters
* Fix or ignore new linter errors
* playbook contains "community.general.sudoers" which requires
  installing additional_dependencies. That however does not
  work with pre-commit SAS service therefore we have to disable
  that linter in the SAS service and run it with github actions.
  • Loading branch information
zaro0508 authored Sep 30, 2024
1 parent 97784a9 commit 58106b3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
15 changes: 15 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
exclude_paths:
- temp
- .github
- .pre-commit-config.yaml
parseable: true
quiet: true
skip_list:
- "no-changed-when"
- "package-latest"
- "name[play]"
- "name[casing]"
- "fqcn[action]"
- "fqcn[action-core]"
use_default_rules: true
verbosity: 1
6 changes: 4 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: pre-commit/[email protected]
- name: Setup `packer`
uses: hashicorp/setup-packer@main
Expand All @@ -24,6 +22,8 @@ jobs:
- name: packer validate
run: |
pushd src
packer plugins install github.com/hashicorp/amazon
packer plugins install github.com/hashicorp/ansible
packer validate -var AmiImageName=validate template.json
deploy:
name: Deploy to AWS org-sagebase-imagecentral
Expand Down Expand Up @@ -54,4 +54,6 @@ jobs:
- name: Build and Upload AMI
run: |
pushd src
packer plugins install github.com/hashicorp/amazon
packer plugins install github.com/hashicorp/ansible
AWS_DEFAULT_REGION=${{ env.AWS_REGION }} packer build -force -var AmiImageName=${{ env.AMI_IMAGE_NAME }} template.json
10 changes: 7 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
ci:
skip: [ansible-lint]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand All @@ -9,7 +12,8 @@ repos:
- id: pretty-format-json
args: [--autofix]
- repo: https://github.com/ansible/ansible-lint
rev: v6.16.2
rev: v24.9.2
hooks:
- id: ansible-lint
files: src/.*\.(yaml|yml)$
additional_dependencies:
- ansible

0 comments on commit 58106b3

Please sign in to comment.