-
Notifications
You must be signed in to change notification settings - Fork 3
Inject COMMIT_SHA and BUILD_DATE at build time for /api/version #396
Copy link
Copy link
Open
Labels
complexity/lowLow complexity - straightforward implementationLow complexity - straightforward implementationconfidence/highHigh confidence - well understood, low risk of issuesHigh confidence - well understood, low risk of issuesenhancementNew feature or requestNew feature or requestopenNew or unrefined work. Collaborative grooming allowed.New or unrefined work. Collaborative grooming allowed.priority/mediumNormal priority - standard workflowNormal priority - standard workflowseverity/mediumMedium severity - limited impact or workaround existsMedium severity - limited impact or workaround exists
Metadata
Metadata
Assignees
Labels
complexity/lowLow complexity - straightforward implementationLow complexity - straightforward implementationconfidence/highHigh confidence - well understood, low risk of issuesHigh confidence - well understood, low risk of issuesenhancementNew feature or requestNew feature or requestopenNew or unrefined work. Collaborative grooming allowed.New or unrefined work. Collaborative grooming allowed.priority/mediumNormal priority - standard workflowNormal priority - standard workflowseverity/mediumMedium severity - limited impact or workaround existsMedium severity - limited impact or workaround exists
Background
The `/api/version` endpoint (added in #300) returns `commit_sha` and `build_date` fields, but they currently always return `"unknown"` because no build-time injection is in place:
```python
"commit_sha": os.environ.get("COMMIT_SHA", "unknown"),
"build_date": os.environ.get("BUILD_DATE", "unknown"),
```
Problem
Without CI/CD injecting these values, operators cannot use `/api/version` to verify which exact commit is running in an environment — defeating part of the feature's operational value.
Proposed Solution
Inject `COMMIT_SHA` and `BUILD_DATE` as environment variables during CI/CD pipeline execution (e.g. GitHub Actions):
```yaml
env:
COMMIT_SHA: ${{ github.sha }}
BUILD_DATE: ${{ github.event.head_commit.timestamp }}
```
For Docker deployments, pass them as build args or runtime env vars.
Acceptance Criteria
Related
Deferred from #300 (explicitly out of scope for that PR).