Add security scanning to your pipeline before building the image:
Install the Trivy scanner task:
Build the container image with Kaniko
To build the image use the enhanced Kaniko Task with multi-architecture support:
Image Signing with Cosign
Add image signing to ensure supply chain security:
Create the Cosign signing task:
SLSA Provenance Generation
Generate SLSA provenance for supply chain attestation:
Create the SLSA provenance task:
Run your Pipeline
You are ready to install the Tasks and run the pipeline.
Install the git-clone, trivy-scanner, kaniko, cosign-sign, and slsa-provenance Tasks:
Apply the Secret with your Docker credentials.
Apply the Pipeline:
Create the PipelineRun:
This creates a PipelineRun with a unique name each time:
Use the PipelineRun name from the output of the previous step to monitor the Pipeline execution:
After a few seconds, the output confirms that the image was built and pushed successfully:
Full Code Samples (2025)
Complete Secure Pipeline
Production PipelineRun
Docker Credentials Secret
Cosign Keys Secret
Container Registry Authentication
For different registry providers, configure your Docker credentials accordingly:
Docker Hub
AWS ECR
Google Container Registry
Azure Container Registry
Advanced Features
Multi-Architecture Builds
For building multi-platform images, update the Kaniko task:
Cache Optimization
Enable advanced caching for faster builds:
This guide provides a complete, production-ready pipeline with modern security practices, including vulnerability scanning, image signing, and SLSA provenance generation that meets 2025 DevSecOps standards.