Add /version endpoint to all products + BUILD_SHA/BUILD_TIME in Dockerfiles
Some checks failed
CI — P2 Drift (Go + Node) / saas (push) Successful in 34s
CI — P2 Drift (Go + Node) / build-push (push) Failing after 4s
CI — P3 Alert / build-push (push) Failing after 3s
CI — P6 Run / saas (push) Successful in 23s
CI — P4 Portal / build-push (push) Failing after 2s
CI — P2 Drift (Go + Node) / agent (push) Successful in 17s
CI — P3 Alert / test (push) Successful in 21s
CI — P5 Cost / test (push) Successful in 24s
CI — P4 Portal / test (push) Successful in 38s
CI — P5 Cost / build-push (push) Failing after 3s
CI — P6 Run / build-push (push) Failing after 2s

This commit is contained in:
2026-03-02 13:53:15 +00:00
parent c4ec43cb76
commit 5bad2481ae
12 changed files with 30 additions and 5 deletions

View File

@@ -12,4 +12,8 @@ COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
EXPOSE 3000
ARG BUILD_SHA=dev
ARG BUILD_TIME=unknown
ENV BUILD_SHA=$BUILD_SHA
ENV BUILD_TIME=$BUILD_TIME
CMD ["node", "dist/index.js"]

View File

@@ -32,6 +32,7 @@ async function start() {
// Health (before auth)
app.get('/health', async () => ({ status: 'ok' }));
app.get('/version', async () => ({ version: process.env.BUILD_SHA || 'dev', built: process.env.BUILD_TIME || 'unknown' }));
// Auth routes (signup/login)
registerAuthRoutes(app, config.jwtSecret, pool);

View File

@@ -11,4 +11,8 @@ COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
EXPOSE 3000
ARG BUILD_SHA=dev
ARG BUILD_TIME=unknown
ENV BUILD_SHA=$BUILD_SHA
ENV BUILD_TIME=$BUILD_TIME
CMD ["node", "dist/index.js"]

View File

@@ -19,7 +19,8 @@ await app.register(helmet);
registerAuth(app, config.JWT_SECRET, pool);
app.get('/health', async () => ({ status: 'ok', service: 'dd0c-alert' }));
app.get('/health', async () => ({ status: 'ok', service: 'dd0c-alert' } /* v:c4ec43c */));
app.get('/version', async () => ({ version: process.env.BUILD_SHA || 'dev', built: process.env.BUILD_TIME || 'unknown' }));
registerAuthRoutes(app, config.JWT_SECRET, pool);
registerWebhookRoutes(app);

View File

@@ -11,4 +11,8 @@ COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
EXPOSE 3000
ARG BUILD_SHA=dev
ARG BUILD_TIME=unknown
ENV BUILD_SHA=$BUILD_SHA
ENV BUILD_TIME=$BUILD_TIME
CMD ["node", "dist/index.js"]

View File

@@ -18,7 +18,8 @@ await app.register(helmet);
registerAuth(app, config.JWT_SECRET, pool);
app.get('/health', async () => ({ status: 'ok', service: 'dd0c-portal' }));
app.get('/health', async () => ({ status: 'ok', service: 'dd0c-portal' } /* v:c4ec43c */));
app.get('/version', async () => ({ version: process.env.BUILD_SHA || 'dev', built: process.env.BUILD_TIME || 'unknown' }));
registerAuthRoutes(app, config.JWT_SECRET, pool);
registerServiceRoutes(app);

View File

@@ -11,4 +11,8 @@ COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
EXPOSE 3000
ARG BUILD_SHA=dev
ARG BUILD_TIME=unknown
ENV BUILD_SHA=$BUILD_SHA
ENV BUILD_TIME=$BUILD_TIME
CMD ["node", "dist/index.js"]

View File

@@ -17,7 +17,8 @@ await app.register(cors, { origin: config.CORS_ORIGIN });
registerAuth(app, config.JWT_SECRET, pool);
app.get('/health', async () => ({ status: 'ok', service: 'dd0c-cost' }));
app.get('/health', async () => ({ status: 'ok', service: 'dd0c-cost' } /* v:c4ec43c */));
app.get('/version', async () => ({ version: process.env.BUILD_SHA || 'dev', built: process.env.BUILD_TIME || 'unknown' }));
registerAuthRoutes(app, config.JWT_SECRET, pool);
registerIngestionRoutes(app);

View File

@@ -11,4 +11,8 @@ COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
EXPOSE 3000
ARG BUILD_SHA=dev
ARG BUILD_TIME=unknown
ENV BUILD_SHA=$BUILD_SHA
ENV BUILD_TIME=$BUILD_TIME
CMD ["node", "dist/index.js"]

View File

@@ -19,6 +19,7 @@ await app.register(helmet);
registerAuth(app, config.JWT_SECRET, pool);
app.get('/health', async () => ({ status: 'ok', service: 'dd0c-run' }));
app.get('/version', async () => ({ version: process.env.BUILD_SHA || 'dev', built: process.env.BUILD_TIME || 'unknown' }));
registerAuthRoutes(app, config.JWT_SECRET, pool);
registerRunbookRoutes(app);

View File

@@ -54,7 +54,7 @@ for img in "${TARGETS[@]}"; do
tag="${REGISTRY}/${img}:latest"
echo -e "${YELLOW}▸ Building ${img}${NC}"
if docker build -t "$tag" "$SCRIPT_DIR/$ctx" --no-cache; then
if docker build -t "$tag" --build-arg BUILD_SHA=$(git rev-parse --short HEAD) --build-arg BUILD_TIME=$(date -u +%Y%m%dT%H%M%S) "$SCRIPT_DIR/$ctx" --no-cache; then
echo -e "${YELLOW} Pushing ${tag}${NC}"
if docker push "$tag"; then
echo -e " ${GREEN}${NC} ${img}"

View File

@@ -53,7 +53,7 @@ for prefix in "${!SERVICES[@]}"; do
IFS=: read -r img ctx <<< "${SERVICES[$prefix]}"
TAG="${REGISTRY}/${img}:latest"
echo "$(date -u '+%H:%M:%S') Building $img..."
if docker build -t "$TAG" "./$ctx" --no-cache && docker push "$TAG"; then
if docker build -t "$TAG" --build-arg BUILD_SHA=$(git rev-parse --short HEAD) --build-arg BUILD_TIME=$(date -u +%Y%m%dT%H%M%S) "./$ctx" --no-cache && docker push "$TAG"; then
echo "$(date -u '+%H:%M:%S')$img pushed"
((REBUILT++)) || true
else