Skip to content

Commit

Permalink
Inital commit 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
erickgnavar committed Dec 5, 2023
0 parents commit a46f28a
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
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
7 changes: 7 additions & 0 deletions Dockerfile
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"]
14 changes: 14 additions & 0 deletions README.md
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: Update deployment container image
uses: resuelve/check-manifest-path-action@master
```

Enjoy 🎉
5 changes: 5 additions & 0 deletions action.yml
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"
22 changes: 22 additions & 0 deletions entrypoint.sh
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

0 comments on commit a46f28a

Please sign in to comment.