This repository has been archived by the owner on Oct 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Richard Steinbrück
committed
Apr 14, 2020
1 parent
aabb4c6
commit 3e47a62
Showing
3 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM golang:alpine3.11 | ||
|
||
LABEL name="prometheus-operator-lint-action" | ||
LABEL repository="http://github.com/p1nkun1c0rns/prometheus-operator-lint-action" | ||
LABEL homepage="http://github.com/p1nkun1c0rns/prometheus-operator-lint-action" | ||
LABEL maintainer="Richard Steinbrueck <[email protected]>" | ||
|
||
ENV GO111MODULE on | ||
ENV PO_LINT_VERSION 0.38.0 | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
# hadolint ignore=DL3018 | ||
RUN apk add --no-cache \ | ||
git | ||
|
||
RUN go get -u github.com/coreos/prometheus-operator/cmd/po-lint@v${PO_LINT_VERSION} | ||
|
||
ENTRYPOINT [ "/entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: 'Prometheus Operator Lint Action' | ||
author: 'Richard Steinbrueck' | ||
description: 'Run po-lint on your yaml files' | ||
inputs: | ||
path: | ||
description: 'Path to scan for files within the directory (and nested directories)' | ||
required: false | ||
default: './' | ||
file_extension: | ||
description: '' | ||
required: false | ||
default: '*.yaml' | ||
exclude: | ||
description: 'should be a substring of the folder path you want to exclude' | ||
required: false | ||
default: '' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.path }} | ||
- ${{ inputs.file_extension }} | ||
- ${{ inputs.exclude }} | ||
branding: | ||
icon: 'terminal' | ||
color: 'red' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh | ||
|
||
INPUT_PATH=$1 | ||
INPUT_FILES=$2 | ||
INPUT_EXCLUDE=$3 | ||
|
||
echo "Linting '${INPUT_FILES}' files in directory '${INPUT_PATH}'..." | ||
had_errors=0 | ||
for file in $(find ${INPUT_PATH} -name ${INPUT_FILES}); do | ||
# Exclude Grafana dashboards | ||
if echo "${file}" | grep -q ${INPUT_EXCLUDE} | ||
then | ||
echo "skip -> ${file}" | ||
continue | ||
fi | ||
|
||
po-lint "${file}" | ||
retval=$? | ||
if [ $retval -ne 0 ]; then | ||
had_errors=1 | ||
fi | ||
done | ||
exit ${had_errors} |