-
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
0 parents
commit d76daf3
Showing
5 changed files
with
65 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,17 @@ | ||
--- | ||
name: CI | ||
|
||
on: push | ||
|
||
jobs: | ||
run-linters: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install shellcheck | ||
run: sudo apt update && sudo apt install shellcheck --yes | ||
|
||
- name: Run shellcheck | ||
run: shellcheck 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,7 @@ | ||
FROM alpine:3.17 | ||
|
||
RUN apk --update add bash | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
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,14 @@ | ||
# Check manifest path | ||
|
||
Check `manifest_path` value in Kubernetes deployment manifest annotations, in case the value found is a path that doesn't exist it will break the job. | ||
|
||
This action will assume that the deployment manifest will use the word `manifest` in their paths. | ||
|
||
## Usage | ||
|
||
```yaml | ||
- name: Check manifest paths in deployment files | ||
uses: resuelve/check-manifest-path-action@master | ||
``` | ||
Enjoy 🎉 |
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,5 @@ | ||
--- | ||
name: "Check manifest_path value in Kubernetes deployment manifest annotations" | ||
runs: | ||
using: "docker" | ||
image: "Dockerfile" |
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,22 @@ | ||
#!/bin/bash | ||
|
||
# used to count all the errors | ||
acc=0 | ||
|
||
for file in $(find . -iname "*.yml" | grep deployment); do | ||
# we use xargs to trim result value, otherwise it will be ' "value"' | ||
manifest_path=$(grep "manifest_path" "$file" | cut -f2 -d ":" | xargs) | ||
if [ "$manifest_path" != "" ]; then | ||
if [ ! -f "$manifest_path" ]; then | ||
echo "$file has defined $manifest_path but this path doesn't exist" | ||
acc=$((acc + 1)) | ||
fi | ||
|
||
else | ||
echo "$file doesn't have a manifest_path configured" | ||
fi | ||
done | ||
|
||
if [ "$acc" -gt "0" ]; then | ||
exit 1 | ||
fi |