Distribution and Testing¶
Versioning, testing, optimization, and distribution of the policy-platform container.
Versioning Strategy¶
Semantic Versioning¶
Policy-platform follows semantic versioning:
Version components:
- Major (v2.x.x): Breaking changes (tool upgrades, policy structure changes)
- Minor (vx.1.x): New policy repos added, new tools
- Patch (vx.x.3): Policy updates, bug fixes
Tagging Strategy¶
# Tag with version
docker tag policy-platform:latest policy-platform:v1.0.2
# Tag with commit SHA
docker tag policy-platform:latest policy-platform:sha-abc123
# Push all tags
docker push policy-platform:v1.0.2
docker push policy-platform:sha-abc123
docker push policy-platform:latest
Always Tag with Version AND SHA
Version tags for humans (v1.0.2). SHA tags for auditability (sha-abc123). Both enable rollbacks.
Testing the Container¶
Smoke Test¶
# Verify tools installed
docker run --rm policy-platform:latest kyverno version
docker run --rm policy-platform:latest pluto version
docker run --rm policy-platform:latest helm version
# Verify policies present
docker run --rm policy-platform:latest ls -R /repos/
Integration Test¶
# Test complete validation workflow
docker run --rm -v $(pwd):/workspace policy-platform:latest bash -c '\
helm template app /repos/backend-applications/charts/app \
-f /repos/backend-applications/charts/app/values.yaml \
| kyverno apply /repos/security-policy/ --resource -'
CI Test Pipeline¶
- step:
name: Test Container
script:
- docker run policy-platform:${BUILD_NUMBER} kyverno version
- docker run policy-platform:${BUILD_NUMBER} pluto version
- docker run policy-platform:${BUILD_NUMBER} ls /repos/security-policy/
Size Optimization¶
Multi-Stage Build Benefits¶
# Build tools in separate stages
FROM alpine:3.22.1 AS builder
RUN apk add build-base
# Final image only has binaries
FROM alpine:3.22.1
COPY --from=builder /usr/local/bin/kyverno /usr/local/bin/
Layer Optimization¶
# Combine RUN commands to reduce layers
RUN apk add curl bash && \
curl -sSL ...kyverno.tar.gz | tar -xz && \
curl -sSL ...pluto.tar.gz | tar -xz
Image Size Comparison¶
Distribution¶
Registry Options¶
Google Artifact Registry:
GitHub Container Registry:
Docker Hub (public images):
Use Private Registries
Policy-platform contains proprietary policies. Use private registries (GCR, ACR, GHCR) with authentication.
Registry Authentication¶
CI authentication:
Updating the Container¶
Update Workflow¶
- Update policy repo dependencies
- Increment version in
VERSIONfile - Rebuild container
- Run tests
- Tag and push
- Update deployments
Example:
# Update VERSION file
echo "v1.0.3" > VERSION
# Build
docker build -t policy-platform:$(cat VERSION) .
# Test
docker run policy-platform:$(cat VERSION) kyverno version
# Push
docker push policy-platform:$(cat VERSION)
Automated Updates¶
# Bitbucket schedule
pipelines:
custom:
weekly-rebuild:
- step:
name: Rebuild Policy Platform
script:
- docker build -t policy-platform:latest .
- docker push policy-platform:latest
Security Scanning¶
Trivy Scan¶
# Scan for vulnerabilities
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
aquasec/trivy image policy-platform:latest
CI Integration¶
- step:
name: Security Scan
script:
- docker run aquasec/trivy image policy-platform:${BUILD_NUMBER}
Fail build on critical vulnerabilities:
Next Steps¶
- Maintenance - Troubleshooting and best practices
- Operations - Day-to-day policy management
- CI Integration - Using policy-platform in CI