homebrew-core/Formula/kube-linter.rb

53 lines
1.5 KiB
Ruby

class KubeLinter < Formula
desc "Static analysis tool for Kubernetes YAML files and Helm charts"
homepage "https://github.com/stackrox/kube-linter"
url "https://github.com/stackrox/kube-linter.git",
tag: "0.1.4",
revision: "12db88411cafedbe9d6870d57a45c0927d27a760"
license "Apache-2.0"
head "https://github.com/stackrox/kube-linter.git"
bottle do
cellar :any_skip_relocation
sha256 "2036d2265ffca6ed1fd00af1fdf59fd1b55547e5d3611901ba86b96316d97f67" => :big_sur
sha256 "262886a27d45e35393a579d4add002a5badbef49b14f06b9b4706fdd2e173c01" => :catalina
sha256 "fedfd6ca49c4b2da0458143eb582ed29bb6807b72fc5ae58dbc364d028efa259" => :mojave
end
depends_on "go" => :build
def install
system "make", "build"
bin.install ".gobin/kube-linter"
end
test do
(testpath/"pod.yaml").write <<~EOS
apiVersion: v1
kind: Pod
metadata:
name: homebrew-demo
spec:
securityContext:
runAsUser: 1000
runAsGroup: 3000
fsGroup: 2000
containers:
- name: homebrew-test
image: busybox
resources:
limits:
memory: "128Mi"
cpu: "500m"
requests:
memory: "64Mi"
cpu: "250m"
securityContext:
readOnlyRootFilesystem: true
EOS
# Lint pod.yaml for default errors
assert_match "No lint errors found!", shell_output("#{bin}/kube-linter lint pod.yaml 2>&1").chomp
end
end