Skip to content

Commit

Permalink
Merge pull request #4 from lucianposton/master
Browse files Browse the repository at this point in the history
Use bash in entrypoint
  • Loading branch information
ibiqlik authored Feb 24, 2020
2 parents 26e96b3 + 4d720f5 commit 420199a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM python:3-alpine

RUN pip install yamllint && \
apk add bash && \
rm -rf ~/.cache/pip

ADD entrypoint.sh /entrypoint.sh
Expand Down
28 changes: 16 additions & 12 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
#!/bin/sh -l
#!/bin/bash -l

echo "======================"
echo "= Linting YAML files ="
echo "======================"

# Use the current directory by default
export INPUT_FILE_OR_DIR=${INPUT_FILE_OR_DIR:-.}

STRICT=""
if [ "$INPUT_STRICT" == "true" ]; then
STRICT="-s"
if [[ -n "$INPUT_CONFIG_FILE" ]]; then
options+=(-c "$INPUT_CONFIG_FILE")
fi

if [ ! -z "$INPUT_CONFIG_FILE" ]; then
CONFIG_FILE="-c $INPUT_CONFIG_FILE"
if [[ -n "$INPUT_CONFIG_DATA" ]]; then
options+=(-d "$INPUT_CONFIG_DATA")
fi

if [ ! -z "$INPUT_CONFIG_DATA" ]; then
CONFIG_DATA="-d $INPUT_CONFIG_DATA"
options+=(-f "$INPUT_FORMAT")

if [[ "$INPUT_STRICT" == "true" ]]; then
options+=(-s)
fi

yamllint $CONFIG_FILE $CONFIG_DATA -f $INPUT_FORMAT $STRICT $INPUT_FILE_OR_DIR
# Enable globstar so ** globs recursively
shopt -s globstar
# Use the current directory by default
options+=(${INPUT_FILE_OR_DIR:-.})
shopt -u globstar

yamllint "${options[@]}"

0 comments on commit 420199a

Please sign in to comment.