Prompt
How do I track deployment changes for compliance in CI/CD?
Latest observation
To track deployment changes for compliance in CI/CD, you want an end-to-end audit trail that answers:
- What changed?
- Who approved it?
- Who deployed it?
- When did it go live?
- What exact version/config/artifact is in production?
Here’s a practical approach.
1) Use version control as the source of truth
Keep all deployable code and infrastructure definitions in Git:
- Application code
- Helm charts / Kubernetes manifests
- Terraform / CloudFormation / Pulumi
- Pipeline definitions
- Policy-as-code rules
Require:
- Pull requests for changes
- Required reviews
- Signed commits/tags if your compliance model needs stronger provenance
2) Make every deployment uniquely identifiable
Each deployment should reference immutable identifiers, such as:
- Git commit SHA
- Artifact digest/hash
- Container image digest, not just a tag
- Build number / pipeline run ID
- Environment name
- Release version
Avoid relying only on mutable tags like latest.
3) Record change metadata at each stage
Capture and store:
- Commit ID
- Author and approver names
- PR link
- Build ID
- Test results
- Artifact checksum/digest
- Deployment timestamp
- Target environment
- Deployer identity
- Change ticket / risk ID / CAB approval if required
This can be stored in:
- CI/CD system logs
- Change management system
- Deployment database
- CMDB
- Artifact repository metadata
4) Gate deployments with approvals and policy checks
For compliance, include checks such as:
- Mandatory peer review
- Security scans
- SAST/DAST/dependency scanning
- License checks
- IaC policy checks
- Manual approval for production
- Segregation of duties if required
Log who approved what and when.
5) Keep immutable build artifacts
Build once, deploy many:
- Produce a signed artifact or container image
- Store it in an immutable registry/repository
- Promote the same artifact through dev/test/stage/prod
This prevents “it worked in staging but prod had a different build” problems.
6) Create deployment audit logs
Your CI/CD tool should emit structured logs/events for:
- Pipeline triggered
- Source revision built
- Tests executed
- Artifact published
- Deployment started/completed/failed
- Rollback events
Send logs to a centralized, tamper-resistant logging system:
- SIEM
- Cloud audit logs
- Append-only storage
- WORM retention if required
7) Link deployments to infrastructure changes
If infrastructure can change independently, track:
- IaC plan/apply output
- Drift detection results
- State file versioning
- Cloud audit events for manual changes
This helps prove whether a production change came from the pipeline or from an ad hoc admin action.
8) Maintain environment inventories
For each environment, record:
- Current application version
- Current infrastructure version
- Config version
- Secrets version references
- Last deployment date/time
- Owner and approver
This can be automated with deployment manifests or a release registry.
9) Use change management integration
If your compliance process requires formal change tickets:
- Auto-create or link a change request
- Attach evidence from CI/CD
- Record approvals and deployment results
- Close the ticket only after successful deployment verification
10) Retain evidence
For audits, keep:
- Pipeline run logs
- Approval records
- Test reports
- Scan reports
- Artifact hashes
- Deployment manifests
- Rollback records
- Access logs
Set retention periods based on regulatory requirements.
A simple compliance-friendly deployment record
A good record might look like this:
{
"deployment_id": "dep-2026-10-19-001",
"environment": "prod",
"service": "payments-api",
"git_commit": "a1b2c3d4",
"artifact_digest": "sha256:9f2e...",
"pipeline_run_id": "build-84521",
"requested_by": "jane.doe",
"approved_by": ["sam.review", "security.ops"],
"change_ticket": "CHG-10492",
"deployed_at": "2026-10-19T14:22:31Z",
"deployed_by": "ci-cd-bot",
"status": "success"
}
Recommended tooling pattern
A common setup is:
- Git for source control
- CI/CD platform for pipeline logs and approvals
- Artifact registry for immutable artifacts
- IaC tool for infrastructure history
- Central log/SIEM for audit retention
- Change management system for formal approvals
Best practices summary
- Deploy immutable, versioned artifacts
- Record commit, artifact, approver, and deployer
- Centralize and retain logs
- Enforce approvals and policy checks
- Integrate with change management
- Detect and log drift/manual changes
- Make records easy to query during audits
If you want, I can also give you:
- a template audit checklist,
- a sample CI/CD implementation, or
- a tool-specific example for Jenkins, GitHub Actions, GitLab CI, Azure DevOps, or Argo CD.