Skip to content

Commit

Permalink
Merge pull request #1 from equisoft-actions/dev/hadolint-action
Browse files Browse the repository at this point in the history
Create action
  • Loading branch information
meriouma authored Feb 2, 2022
2 parents e370af0 + e630e47 commit 02b2291
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 'Hadolint'
description: 'Run Hadolint Dockerfile linting tool'

inputs:
dockerfile:
required: true
description: 'The path to the Dockerfile to lint'
default: 'Dockerfile'
format:
required: false
description: |
The output format for the results (default: sarif)
[tty | json | sarif | checkstyle | codeclimate | gitlab_codeclimate | codacy]
default: 'sarif'
failure-threshold:
required: false
description: |
Fail only if rules with severity above this threshold are violated.
One of [error | warning | info (default) | style | ignore]
default: 'info'
working-directory:
required: true
description: Working directory
ignore:
required: false
description: 'A space separated string of rules to ignore'
default: ''

runs:
using: composite
steps:
- name: Lint Dockerfile
id: scan
shell: bash
run: |
mkdir -p ${{ inputs.working-directory }}/build/quality/
docker run --rm -i \
-e HADOLINT_FORMAT=${{ inputs.format }} \
-e HADOLINT_FAILURE_THRESHOLD=${{ inputs.failure-threshold }} \
-e HADOLINT_IGNORE=${{ inputs.ignore }} \
hadolint/hadolint < ${{ inputs.dockerfile }} \
2>&1 | tee ${{ inputs.working-directory }}/build/quality/hadolint.sarif
result=$?
echo "::set-output name=status::$result"
if [ $result -ne 0 ]; then
exit $result
fi
- name: Upload results
uses: actions/upload-artifact@v2
if: always()
with:
name: hadolint.sarif
retention-days: ${{ inputs.report-retention-days }}
path: ${{ inputs.working-directory }}/build/quality/hadolint.sarif

0 comments on commit 02b2291

Please sign in to comment.