Git and Code Logs: Connect Commits to Deployments
Connect repository history, build attempts, artifacts, and release outcomes into an explainable trail of software changes.
Plan code and delivery events that preserve build attempts, artifact identity, deployment outcomes, and safe diagnostic detail.
Code logging spans development tools, test runners, build systems, and released applications. The most useful shared thread is change identity: which source and configuration produced an artifact, and where that artifact ran. Keep this concise provenance separate from verbose console output so an investigation does not depend on finding one line inside a large build transcript.
Give each workflow run and attempt an identity, then describe job starts and terminal results. Separate skipped work, cancellations, failures, and successful execution. For parallel jobs, keep the dimensions that affect the output, such as target architecture or runtime version. Record queue delay separately from time spent executing a task.
Preserve failed attempts after a successful rerun. They may explain unstable tests or manual intervention. Keep the exact source revision and pipeline configuration version with the run rather than reconstructing them later from a moving branch label.
Record an artifact digest and connect it to the build attempt that produced it. Carry that identity through promotion and deployment. If an environment requires a new build, create a new record for the new output. A matching source commit does not, by itself, establish that independently produced artifacts are identical.
Model rollout requests, approvals, completions, and rollbacks as distinct events. Connect the deployment identity to service startup records to examine what actually ran. The commit-to-deployment guide provides a practical investigation sequence.
Compiler output, test failures, and generated code can contain sensitive paths, fixtures, or configuration values. Use synthetic data and a documented field allowlist. Treat repository-controlled text as data, and encode it safely in log viewers and exports. Avoid collecting complete source files simply because a tool can emit them.
For AI-assisted workflows, connect a tool execution with its review and resulting source change without retaining confidential prompts unnecessarily. The agent logging topic covers tool-call context. Use the recommended fields below as a foundation for your own delivery event contract.
Illustrative field suggestions for your own event contract. Adapt the names, values, and collection rules to your system.
| Field | What it helps explain |
|---|---|
source_commit_id | Exact source revision used by the build. |
workflow_run_id | Workflow identity within its documented scope. |
run_attempt | Distinguishes retries or reruns of the same workflow. |
artifact_digest | Content digest of the output selected for release. |
deployment_id | Identity of a rollout or other environment change. |
outcome | Explicit execution or rollout result. |