From a7d249d8ab978a236e68bcd1ac2e8295bcada928 Mon Sep 17 00:00:00 2001 From: cytopia Date: Sat, 27 Mar 2021 14:16:58 +0100 Subject: [PATCH] Add linting for K8s files --- .github/workflows/kubernetes.yml | 48 ++++++++++++++++++++++++++++++++ README.md | 2 ++ k8s/Makefile | 16 +++++++++++ 3 files changed, 66 insertions(+) create mode 100644 .github/workflows/kubernetes.yml create mode 100644 k8s/Makefile diff --git a/.github/workflows/kubernetes.yml b/.github/workflows/kubernetes.yml new file mode 100644 index 0000000..5502daf --- /dev/null +++ b/.github/workflows/kubernetes.yml @@ -0,0 +1,48 @@ +--- + +# ------------------------------------------------------------------------------------------------- +# Job Name +# ------------------------------------------------------------------------------------------------- +name: kubernetes + + +# ------------------------------------------------------------------------------------------------- +# When to run +# ------------------------------------------------------------------------------------------------- +on: + # Runs on Pull Requests + pull_request: + + # Runs on master Branch and Tags + push: + branches: + - master + tags: + - '[0-9]+.[0-9]+*' + + +# ------------------------------------------------------------------------------------------------- +# What to run +# ------------------------------------------------------------------------------------------------- +jobs: + kubernetes: + name: Kubernetes + runs-on: ubuntu-latest + steps: + + # ------------------------------------------------------------ + # Checkout repository + # ------------------------------------------------------------ + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + # ------------------------------------------------------------ + # Tests + # ------------------------------------------------------------ + - name: Lint K8s files + shell: bash + run: | + cd k8s/ + make lint diff --git a/README.md b/README.md index a964bb1..0292dd7 100644 --- a/README.md +++ b/README.md @@ -278,6 +278,8 @@ For more information see [Terraform module](aws/). ### Kubernetes +[![Kubernetes](https://github.com/cytopia/docker-dvwa/actions/workflows/kubernetes.yml/badge.svg)](https://github.com/cytopia/docker-dvwa/actions/workflows/kubernetes.yml) + This repository ships Kubernetes deployments to run DVWA on K8s or minikube. ```bash diff --git a/k8s/Makefile b/k8s/Makefile new file mode 100644 index 0000000..169b238 --- /dev/null +++ b/k8s/Makefile @@ -0,0 +1,16 @@ +ifneq (,) +.error This Makefile requires GNU Make. +endif + +.PHONY: help lint_lint_files _lint_k8s _pull-tf _pull-tf-docs + +CURRENT_DIR = $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) + +help: + @echo "lint Static source code analysis" + +lint: + @$(MAKE) --no-print-directory _lint_k8s + +_lint_k8s: + docker run --rm -v $(CURRENT_DIR):/data cytopia/kubeval *.yml