Prerequisites: Complete Lab 2: Flows and Trails before starting this lab.
Learning goals
- Understand what attestations are and why they matter for compliance
- Attest a JAR file and Docker image as artifacts
- Attach JUnit test results as attestations
- Attach a Software Bill of Materials (SBOM) as an attestation
- Integrate all attestation commands into your CI/CD pipeline
Introduction
Attestations are how you record facts about your software supply chain in Kosli. They are immutable pieces of evidence that prove certain activities occurred — like tests passing, security scans completing, or artifacts being built. Kosli supports several attestation types:- Built-in:
artifact,generic,junit,snyk,sonar,pull_request,jira - Custom: Types you define yourself with
kosli create attestation-type
Artifact fingerprints
Kosli identifies artifacts by their SHA256 fingerprint. This uniquely identifies the artifact regardless of where it’s stored or what it’s named. The CLI can calculate fingerprints for:--artifact-type file— JAR files, binaries--artifact-type dir— source code, build outputs--artifact-type docker— images from local Docker daemon--artifact-type oci— images from container registries
Exercise
Attest the application artifact (JAR)
In The
.github/workflows/full-pipeline.yaml, find the Build job and add this step after the “Build application” step:--name application gives this artifact a logical name in your Flow. This name is used to attach further attestations (like tests) to this specific artifact.See kosli attest artifact for full flag reference.Attest JUnit test results
Still in the Kosli automatically parses the JUnit XML to determine pass/fail status. See
Build job, add this step after the test step:kosli attest junit.Attest the Docker image
In the Using
Docker-image job, add these steps after the “push docker” step:--artifact-type oci tells Kosli to fetch the image manifest directly from the registry, without needing Docker installed locally. This is more reliable in CI.Generate and attest an SBOM
Your workflow already generates an SBOM using Anchore. Add this step to the The SBOM attestation is linked to the
Docker-image job after the “Generate SBOM” step:docker-image artifact via the docker-image.sbom name. Kosli stores the SBOM file in its Evidence Vault.Push and verify
- Artifacts: JAR file and Docker image with fingerprints
- Attestations: Unit tests attached to
application, SBOM attached todocker-image - Timeline: When each attestation was recorded
Optional: attest vulnerability scans
Optional: attest vulnerability scans
Your workflow already runs Trivy security scans. You can extend this lab by attesting the scan results as a generic attestation:In production you’d parse Trivy results and set
--compliant based on severity thresholds.Verification checklist
- Workflow updated with attestation steps
- All attestation steps pass in the workflow
- Artifacts visible in the Kosli Trail with fingerprints
- JUnit test results attached to the
applicationartifact - SBOM attached to the
docker-imageartifact
If anything didn’t go to plan, refer to the reference solution at
pipelines/03-complete.yaml in the labs repository.