Skip to content

Update dependency open-policy-agent/opa to v1.5.1 #892

Update dependency open-policy-agent/opa to v1.5.1

Update dependency open-policy-agent/opa to v1.5.1 #892

name: Run gatekeeper-k8s-integrationtests.sh
on: [push, pull_request]
# Declare default permissions as read only.
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
kind:
runs-on: ubuntu-latest
env:
# renovate: datasource=pypi depName=yq
YQ_VERSION: 3.4.3
# renovate: datasource=github-releases depName=plexsystems/konstraint
KONSTRAINT_VERSION: v0.42.0
steps:
- name: Harden Runner
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
- name: Setup yq (pypi.org/project/yq/)
run: |
pip3 install yq==${YQ_VERSION}
- name: Setup Bats
uses: bats-core/bats-action@42fcc8700f773c075a16a90eb11674c0318ad507 # 3.0.1
- name: Setup Conftest
uses: princespaghetti/setup-conftest@d75fd184422abf484802a0fefc0453f2cda20f95 # v1.1.23
- name: Setup oc
uses: redhat-actions/openshift-tools-installer@144527c7d98999f2652264c048c7a9bd103f8a82 # v1
with:
oc: "4"
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
- name: Setup konstraint
run: go install github.com/plexsystems/konstraint@${KONSTRAINT_VERSION}
- name: Find test data to validate
shell: bash
id: data
run: |
echo "files=$(find policy/* -regex '.*test_data\/integration\/.*$' | xargs)" >> "$GITHUB_OUTPUT"
- name: Validate integration test data via kubeconform
uses: docker://ghcr.io/yannh/kubeconform:v0.7.0@sha256:85dbef6b4b312b99133decc9c6fc9495e9fc5f92293d4ff3b7e1b30f5611823c
env:
# renovate: datasource=github-releases depName=garethahealy/openshift-json-schema
OCP_SCHEMA_VERSION: "4.17.0"
with:
args: -summary -kubernetes-version ${{ env.OCP_SCHEMA_VERSION }} -schema-location "https://raw.githubusercontent.com/garethahealy/openshift-json-schema/main/{{ .NormalizedKubernetesVersion }}/schemas/{{ .ResourceKind }}{{ .KindSuffix }}.json" ${{ steps.data.outputs.files }}
- name: Create k8s Kind Cluster
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
- name: Check kind cluster up
run: kubectl cluster-info
- name: Deploy Gatekeeper
run: |
_test/deploy-gatekeeper.sh deploy_gatekeeper
_test/deploy-gatekeeper.sh patch_namespaceselector
- name: Deploy Constraints
run: _test/deploy-gatekeeper.sh deploy_constraints
- name: Run k8s Integration Tests
run: _test/gatekeeper-k8s-integrationtests.sh
- name: Get pods and events if tests failed
if: ${{ failure() }}
run: |
echo "## nodes:"
kubectl get nodes
echo "## namespaces:"
kubectl get namespaces
echo "## deployments:"
kubectl get deployments --all-namespaces
echo "## pods:"
kubectl get pods --all-namespaces
echo "## events:"
kubectl get events --all-namespaces
echo "## api-versions:"
kubectl api-versions
echo "## describe deployment/gatekeeper-audit:"
kubectl describe deployment/gatekeeper-audit -n gatekeeper-system
echo "## logs deployment/gatekeeper-audit:"
kubectl logs deployment/gatekeeper-audit -n gatekeeper-system
echo "## describe deployment/gatekeeper-controller-manager:"
kubectl describe deployment/gatekeeper-controller-manager -n gatekeeper-system
echo "## logs deployment/gatekeeper-controller-manager:"
kubectl logs deployment/gatekeeper-controller-manager -n gatekeeper-system