Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving ANSIBLE Lint and YAML Lint docker-compose with a Test Pipeline #198

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ansible-linter-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: ANSIBLE Lint

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: ansible-lint
run: |
pip install ansible-lint

- name: Lint Ansible playbooks
run: |
find ansible/ -name '*.y*ml' -exec ansible-lint -p {} \+

39 changes: 39 additions & 0 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Docker Compose Validation

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Validate Docker Compose File
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Download Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose

- name: Validate Docker Compose File
run: |
set -e

# Validate Docker Compose file
find . -name 'docker-compose.y*ml' -exec docker-compose -f {} config \;

- name: Validate Docker Compose File for incorrect image tags
run: |
set -e
# Find all Docker Compose files and check for incorrect image tags
if find . -name 'docker-compose.y*ml' -exec grep -q '::' {} \;; then
echo "Error: Docker Compose file contains incorrect image tags"
exit 1
fi
28 changes: 28 additions & 0 deletions .github/workflows/kube-linter-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: KubeLinter

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install KubeLinter
run: |
curl -sSLo kubelinter.tar.gz https://github.com/stackrox/kube-linter/releases/latest/download/kube-linter-linux.tar.gz
tar xvzf kubelinter.tar.gz kube-linter
sudo mv kube-linter /usr/local/bin/
rm kubelinter.tar.gz

- name: Run KubeLinter
run: |
find kubernetes/ -name '*.y*ml' -exec kube-linter lint --add-all-built-in {} \+
28 changes: 28 additions & 0 deletions .github/workflows/yaml-linter-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: YAML Lint

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install yamllint
run: |
sudo apt-get update
sudo apt-get install -y yamllint

- name: Lint YAML files
run: |
find . -type f -name '*.yaml' -o -name '*.yml' ! -path "./ansible/*" -exec yamllint {} \+