Skip to content

Commit 0b88a8f

Browse files
committed
fix: version stamping and heartbeat error visibility
APP_VERSION env var at runtime; --set-build-env-vars never reached the Docker ARG. Heartbeat catch now logs to console.error for diagnosis.
1 parent ee1bc69 commit 0b88a8f

4 files changed

Lines changed: 17 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ jobs:
128128
--region $REGION \
129129
--project $PROJECT_ID \
130130
--allow-unauthenticated \
131-
--set-env-vars="^|^CONFIG_REPO_OWNER=grove-platform|CONFIG_REPO_NAME=github-copier|CONFIG_REPO_BRANCH=main|PEM_NAME=CODE_COPIER_PEM|WEBHOOK_SECRET_NAME=webhook-secret|MONGO_URI_SECRET_NAME=mongo-uri|WEBSERVER_PATH=/events|MAIN_CONFIG_FILE=.copier/main.yaml|USE_MAIN_CONFIG=true|DEPRECATION_FILE=deprecated_examples.json|COMMITTER_NAME=GitHub Copier App|COMMITTER_EMAIL=bot@mongodb.com|GOOGLE_CLOUD_PROJECT_ID=github-copy-code-examples|COPIER_LOG_NAME=code-copier-log|AUDIT_ENABLED=true|METRICS_ENABLED=true|OPERATOR_UI_ENABLED=true|OPERATOR_AUTH_REPO=grove-platform/github-copier|OPERATOR_REPO_SLUG=grove-platform/github-copier|LLM_PROVIDER=anthropic|LLM_BASE_URL=https://grove-gateway-prod.azure-api.net/grove-foundry-prod/anthropic|LLM_MODEL=claude-haiku-4-5|ANTHROPIC_API_KEY_SECRET_NAME=anthropic-api-key|GITHUB_APP_ID=${{ secrets.APP_ID }}|INSTALLATION_ID=${{ secrets.INSTALLATION_ID }}" \
131+
--set-env-vars="^|^CONFIG_REPO_OWNER=grove-platform|CONFIG_REPO_NAME=github-copier|CONFIG_REPO_BRANCH=main|PEM_NAME=CODE_COPIER_PEM|WEBHOOK_SECRET_NAME=webhook-secret|MONGO_URI_SECRET_NAME=mongo-uri|WEBSERVER_PATH=/events|MAIN_CONFIG_FILE=.copier/main.yaml|USE_MAIN_CONFIG=true|DEPRECATION_FILE=deprecated_examples.json|COMMITTER_NAME=GitHub Copier App|COMMITTER_EMAIL=bot@mongodb.com|GOOGLE_CLOUD_PROJECT_ID=github-copy-code-examples|COPIER_LOG_NAME=code-copier-log|AUDIT_ENABLED=true|METRICS_ENABLED=true|OPERATOR_UI_ENABLED=true|OPERATOR_AUTH_REPO=grove-platform/github-copier|OPERATOR_REPO_SLUG=grove-platform/github-copier|LLM_PROVIDER=anthropic|LLM_BASE_URL=https://grove-gateway-prod.azure-api.net/grove-foundry-prod/anthropic|LLM_MODEL=claude-haiku-4-5|ANTHROPIC_API_KEY_SECRET_NAME=anthropic-api-key|APP_VERSION=${{ steps.version.outputs.tag }}|GITHUB_APP_ID=${{ secrets.APP_ID }}|INSTALLATION_ID=${{ secrets.INSTALLATION_ID }}" \
132132
--set-build-env-vars="VERSION=${{ steps.version.outputs.tag }}" \
133133
--tag="${{ steps.version.outputs.traffic_tag }}" \
134134
--max-instances=10 \

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- **Version always showing "dev"**`--set-build-env-vars` does not propagate to Docker `ARG` values in Cloud Run's buildless deploy path. App now reads `APP_VERSION` env var at startup as a runtime fallback; CI deploy sets it via `--set-env-vars`.
12+
- **Disconnected chip diagnosis** — heartbeat `catch` handler now logs the fetch error to `console.error` so the root cause is visible in DevTools when the chip appears.
13+
914
## [v0.4.1] - 2026-05-02
1015

1116
### Fixed

app.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,18 @@ import (
1919
// go build -ldflags "-X main.version=v1.0.0"
2020
//
2121
// When not set (local dev builds), it defaults to "dev".
22+
// Cloud Run: pass APP_VERSION in --set-env-vars as a runtime fallback since
23+
// --set-build-env-vars does not automatically reach Docker ARG values.
2224
var version = "dev"
2325

26+
func init() {
27+
if version == "dev" {
28+
if v := os.Getenv("APP_VERSION"); v != "" {
29+
version = v
30+
}
31+
}
32+
}
33+
2434
func main() {
2535
// Parse command line flags
2636
var envFile string

services/web/operator/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ <h3>Keyboard shortcuts</h3>
912912

913913
/* Heartbeat (#6) */
914914
var _connected=true;
915-
function startHeartbeat(){if(!COP_ORIGIN)return;setInterval(function(){fetch(appURL('/operator/api/status')).then(function(r){if(!_connected){_connected=true;$('tbConn').hidden=true;toast('Reconnected to server','info');}}).catch(function(){if(_connected){_connected=false;$('tbConn').hidden=false;toast('Connection lost to server','error');}});},60000);}
915+
function startHeartbeat(){if(!COP_ORIGIN)return;setInterval(function(){fetch(appURL('/operator/api/status')).then(function(r){if(!_connected){_connected=true;$('tbConn').hidden=true;toast('Reconnected to server','info');}}).catch(function(e){console.error('[heartbeat] fetch failed:',e);if(_connected){_connected=false;$('tbConn').hidden=false;toast('Connection lost to server','error');}});},60000);}
916916

917917
/* Server status */
918918
function checkServerStatus(){

0 commit comments

Comments
 (0)