mirror of
https://github.com/hadolint/hadolint-action.git
synced 2024-08-16 10:09:53 +02:00
Merge pull request #34 from itamargiv/feature/recursive-dir-check
Feature: Recursive dir check - Lint multiple files
This commit is contained in:
commit
fdf6f4b6d2
3 changed files with 19 additions and 3 deletions
|
@ -26,6 +26,8 @@ steps:
|
||||||
| Name | Description | Default |
|
| Name | Description | Default |
|
||||||
|------------------ |------------------------------------------ |----------------- |
|
|------------------ |------------------------------------------ |----------------- |
|
||||||
| dockerfile | The path to the Dockerfile to be tested | ./Dockerfile |
|
| dockerfile | The path to the Dockerfile to be tested | ./Dockerfile |
|
||||||
|
| recursive | Search for specified dockerfile | false |
|
||||||
|
| | recursively, from the project root | |
|
||||||
| format | The output format. One of [tty \| json \| | tty |
|
| format | The output format. One of [tty \| json \| | tty |
|
||||||
| | checkstyle \| codeclimate \| | |
|
| | checkstyle \| codeclimate \| | |
|
||||||
| | gitlab_codeclimate] | |
|
| | gitlab_codeclimate] | |
|
||||||
|
|
|
@ -6,6 +6,10 @@ inputs:
|
||||||
required: false
|
required: false
|
||||||
description: 'The path to the Dockerfile to lint'
|
description: 'The path to the Dockerfile to lint'
|
||||||
default: 'Dockerfile'
|
default: 'Dockerfile'
|
||||||
|
recursive:
|
||||||
|
required: false
|
||||||
|
description: 'Search for specified dockerfile recursively, from the project root'
|
||||||
|
default: 'false'
|
||||||
format:
|
format:
|
||||||
required: false
|
required: false
|
||||||
description: |
|
description: |
|
||||||
|
@ -39,6 +43,7 @@ runs:
|
||||||
env:
|
env:
|
||||||
HADOLINT_CONFIG: ${{ inputs.config }}
|
HADOLINT_CONFIG: ${{ inputs.config }}
|
||||||
HADOLINT_IGNORE: ${{ inputs.ignore }}
|
HADOLINT_IGNORE: ${{ inputs.ignore }}
|
||||||
|
HADOLINT_RECURSIVE: ${{ inputs.recursive }}
|
||||||
branding:
|
branding:
|
||||||
icon: 'layers'
|
icon: 'layers'
|
||||||
color: 'purple'
|
color: 'purple'
|
||||||
|
|
15
hadolint.sh
15
hadolint.sh
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
# The problem-matcher definition must be present in the repository
|
# The problem-matcher definition must be present in the repository
|
||||||
# checkout (outside the Docker container running hadolint). We create
|
# checkout (outside the Docker container running hadolint). We create
|
||||||
|
@ -27,5 +27,14 @@ for i in $HADOLINT_IGNORE; do
|
||||||
HADOLINT_IGNORE_CMDLINE="${HADOLINT_IGNORE_CMDLINE} --ignore=${i}"
|
HADOLINT_IGNORE_CMDLINE="${HADOLINT_IGNORE_CMDLINE} --ignore=${i}"
|
||||||
done
|
done
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
if [ "$HADOLINT_RECURSIVE" = "true" ]; then
|
||||||
hadolint $HADOLINT_IGNORE_CMDLINE $HADOLINT_CONFIG "$@"
|
shopt -s globstar
|
||||||
|
|
||||||
|
filename="${!#}"
|
||||||
|
flags="${@:1:$#-1}"
|
||||||
|
|
||||||
|
hadolint $HADOLINT_IGNORE_CMDLINE $HADOLINT_CONFIG $flags **/$filename
|
||||||
|
else
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
hadolint $HADOLINT_IGNORE_CMDLINE $HADOLINT_CONFIG "$@"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue