Skip to content

Commit

Permalink
fix: enable conftest testing
Browse files Browse the repository at this point in the history
  • Loading branch information
eshepelyuk committed Mar 11, 2021
1 parent b5d52ac commit 9dc89e7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ jobs:
name: Continous integration
runs-on: ubuntu-18.04
steps:
- name: checkout
uses: actions/checkout@v2
- uses: actions/checkout@v2
- uses: azure/setup-helm@v1
with:
version: "3.3.4"
Expand All @@ -27,10 +26,10 @@ jobs:
helm lint . --strict
helm lint . --strict -f test/linter/values-lint.yaml
helm dep up test/linter/subchart && helm lint test/linter/subchart --strict
# - name: conftest
# run: |
# conftest --version
# helm template . | conftest test --policy test/conftest/policy/ test --output table -
- name: conftest
run: |
helm template . > /tmp/cmak.yaml
conftest test /tmp/cmak.yaml -p test/conftest -o table --all-namespaces
- name: start k8s with k3d
uses: AbsaOSS/[email protected]
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main
package main.deployment

deny[msg] {
input.kind == "Deployment"
not input.spec.selector.matchLabels["app.kubernetes.io/name"]
not input.spec.selector.matchLabels["app.kubernetes.io/instance"]

msg := "Containers must provide app.kubernetes.io/name and app.kubernetes.io/instance labels for pod selectors"
msg := "Containers must provide predefined labels for pod selectors"
}
6 changes: 6 additions & 0 deletions test/conftest/ingress.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package main.ingress

deny[msg] {
input.kind == "Ingress"
msg := "Ingress must not be created by default"
}

0 comments on commit 9dc89e7

Please sign in to comment.