-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI job to lint Kubernetes manifests
Signed-off-by: GitHub <[email protected]>
- Loading branch information
1 parent
b6e0041
commit b7029d2
Showing
2 changed files
with
44 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,28 @@ | ||
name: "CI - Kubernetes" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
name: "Lint manifests" | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: "Checkout code" | ||
uses: actions/checkout@v3 | ||
|
||
- id: manifest-files | ||
name: "Find manifest files" | ||
run: | | ||
echo "manifests<<EOF" >> $GITHUB_OUTPUT | ||
python scripts/find_manifests.py >> $GITHUB_OUTPUT | ||
echo "EOF" >> $GITHUB_OUTPUT | ||
- uses: azure/k8s-lint@v1 | ||
with: | ||
manifests: ${{ steps.manifest-files.outputs.manifests }} |
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,16 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
potential_manifests = Path(".").glob("**/*.yaml") | ||
|
||
likely_manifests = [] | ||
|
||
for file in potential_manifests: | ||
if "apiVersion:" in file.read_text(): | ||
# File is likely a k8s manifests | ||
|
||
# Ignore manifests that start with _ | ||
if not file.stem.startswith("_"): | ||
likely_manifests.append(str(file)) | ||
|
||
print("\n".join(likely_manifests)) |