Wire up deployment metadata: build commit, number, and server start time; v2.0.30
Publish Container / docker (push) Successful in 14m11s
Publish Container / docker (push) Successful in 14m11s
- Dockerfile: expose BUILD_COMMIT and BUILD_NUMBER env vars from build args (was COMMIT_SHA only; server was reading BUILD_COMMIT so it always fell through to null) - CI: pass github.run_number as BUILD_NUMBER build arg - state.js: record serverStartedAt at module load so deployedAt always shows when the current container instance came up, even without an env var - admin-content.js: fall back COMMIT_SHA → BUILD_COMMIT for older images, use state.serverStartedAt when DEPLOYED_AT env var not set Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
4002f1ee93
commit
65623ce0eb
5 files changed
+9
-4
No files matched your search
@@ -63,3 +63,4 @@ jobs:
|
|||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
build-args: |
|
build-args: |
|
||||||
COMMIT_SHA=${{ github.sha }}
|
COMMIT_SHA=${{ github.sha }}
|
||||||
|
BUILD_NUMBER=${{ github.run_number }}
|
||||||
+3
-1
@@ -12,7 +12,9 @@ ENV NODE_ENV=production
|
|||||||
ENV PORT=4173
|
ENV PORT=4173
|
||||||
|
|
||||||
ARG COMMIT_SHA=unknown
|
ARG COMMIT_SHA=unknown
|
||||||
ENV COMMIT_SHA=${COMMIT_SHA}
|
ARG BUILD_NUMBER=unknown
|
||||||
|
ENV BUILD_COMMIT=${COMMIT_SHA}
|
||||||
|
ENV BUILD_NUMBER=${BUILD_NUMBER}
|
||||||
|
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "siteforge",
|
"name": "siteforge",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "2.0.29",
|
"version": "2.0.30",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -227,9 +227,9 @@ export function register(app) {
|
|||||||
|
|
||||||
app.get('/api/admin-ops/status', requireAdminAuth, (_req, res) => {
|
app.get('/api/admin-ops/status', requireAdminAuth, (_req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
buildCommit: process.env.BUILD_COMMIT ?? null,
|
buildCommit: process.env.BUILD_COMMIT ?? process.env.COMMIT_SHA ?? null,
|
||||||
buildNumber: process.env.BUILD_NUMBER ?? null,
|
buildNumber: process.env.BUILD_NUMBER ?? null,
|
||||||
deployedAt: process.env.DEPLOYED_AT ?? null,
|
deployedAt: process.env.DEPLOYED_AT ?? state.serverStartedAt,
|
||||||
cachePurge: state.lastCachePurgeStatus,
|
cachePurge: state.lastCachePurgeStatus,
|
||||||
deployHook: state.lastDeployHookStatus,
|
deployHook: state.lastDeployHookStatus,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import {
|
|||||||
} from './config.js'
|
} from './config.js'
|
||||||
|
|
||||||
export const state = {
|
export const state = {
|
||||||
|
serverStartedAt: new Date().toISOString(),
|
||||||
|
|
||||||
cachedSiteContent: null,
|
cachedSiteContent: null,
|
||||||
cachedDraftSiteContent: null,
|
cachedDraftSiteContent: null,
|
||||||
publishState: { ...DEFAULT_PUBLISH_STATE },
|
publishState: { ...DEFAULT_PUBLISH_STATE },
|
||||||
|
|||||||
Reference in new issue
Block a user