Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add hemlfile and cloudformation linters #53

Merged
merged 9 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ end_of_line = lf
# editorconfig-tools is unable to ignore longs strings or urls
max_line_length = null

[{*.yaml, *.yml}]
[{*.yaml,*.yml,*.json}]
indent_size = 2
34 changes: 34 additions & 0 deletions .github/workflows/lint_cloudformation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: cloudformation lint

on:
workflow_call:
inputs:
path:
description: Path to lint
required: false
type: string
default: ./deploy/cloudformation/**/*.yaml
ignoreChecks:
description: Codes to ignore (equivalent to --ignore-checks option)
required: false
type: string
# By default ignore warning about package, as it is part of the deploy_cloudformation workflow anyway
default: W3002

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: clone repository
uses: actions/checkout@v3

- name: install cfn-lint
run: pip install cfn-lint==${CFN_LINT_VERSION}
env:
# renovate: datasource=github-releases depName=aws-cloudformation/cfn-lint
CFN_LINT_VERSION: v0.76.1

- name: lint
run: |
cfn-lint ${{ inputs.path }} \
--ignore-checks ${{ inputs.ignoreChecks }}
52 changes: 52 additions & 0 deletions .github/workflows/lint_helmfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: lint helmfile

on:
workflow_call:
inputs:
helmfilePath:
description: Path to helmfile.yaml
required: true
type: string
helmfileEnvironment:
description: Helmfile environment
required: false
type: string
helmfileOtherArgs:
description: Other helmfile parameters
required: false
type: string
envVariables:
description: Space separated list of environment variables to be set during helmfile sync
required: false
type: string
# example:
# envVariables: >
# FOO=bar
# BAR=foo

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: clone repository
uses: actions/checkout@v3

- name: install helmfile
run: |
mkdir -p $HOME/.local/bin
curl -fsSL -o helmfile.tar.gz https://github.com/helmfile/helmfile/releases/download/v${{ env.HELMFILE_VERSION }}/helmfile_${{ env.HELMFILE_VERSION }}_linux_amd64.tar.gz
tar -C $HOME/.local/bin/ -xf ./helmfile.tar.gz
chmod +x $HOME/.local/bin/helmfile
echo "$HOME/.local/bin" >> $GITHUB_PATH
env:
# renovate: datasource=github-releases depName=helmfile/helmfile
HELMFILE_VERSION: '0.147.0'

- name: lint
run: |
export $(echo ${{ inputs.envVariables }})
HELMFILE_PARAMS="-f ${{ inputs.helmfilePath }}"
[ ! -z ${{ inputs.helmfileEnvironment }} ] && HELMFILE_PARAMS+=" -e ${{ inputs.helmfileEnvironment }}"
[ ! -z ${{ inputs.helmfileOtherArgs }} ] && HELMFILE_PARAMS+=" ${{ inputs.helmfileOtherArgs }}"
helmfile $HELMFILE_PARAMS lint

13 changes: 12 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,16 @@
"groupSlug": "all",
"automerge": true
}
],
"regexManagers": [
{
"fileMatch": [
"*.yaml$"
],
"matchStrings": [
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?( registryUrl=(?<registryUrl>.*?))?\\s.*?_VERSION=(?<currentValue>.*)\\s"
],
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
}
]
}
}