feat: add JD01 YAML-first deployment support
This commit is contained in:
@@ -446,21 +446,27 @@ export function refreshYamlLaneScript(spec: AgentRunLaneSpec): string {
|
||||
`application=${shQuote(spec.gitops.argoApplication)}`,
|
||||
"kubectl -n \"$namespace\" annotate application \"$application\" argocd.argoproj.io/refresh=hard --overwrite >/tmp/agentrun-refresh-output.txt",
|
||||
"kubectl -n \"$namespace\" get application \"$application\" -o json >/tmp/agentrun-refresh-app.json",
|
||||
"NAMESPACE=\"$namespace\" APPLICATION=\"$application\" node <<'NODE'",
|
||||
"const fs = require('node:fs');",
|
||||
"let app = {};",
|
||||
"try { app = JSON.parse(fs.readFileSync('/tmp/agentrun-refresh-app.json', 'utf8')); } catch {}",
|
||||
"console.log(JSON.stringify({",
|
||||
" ok: true,",
|
||||
" namespace: process.env.NAMESPACE,",
|
||||
" application: process.env.APPLICATION,",
|
||||
" revision: app.status?.sync?.revision ?? null,",
|
||||
" syncStatus: app.status?.sync?.status ?? null,",
|
||||
" healthStatus: app.status?.health?.status ?? null,",
|
||||
" observedAt: new Date().toISOString(),",
|
||||
" valuesPrinted: false",
|
||||
"}));",
|
||||
"NODE",
|
||||
"NAMESPACE=\"$namespace\" APPLICATION=\"$application\" python3 - <<'PY'",
|
||||
"import datetime, json, os",
|
||||
"try:",
|
||||
" with open('/tmp/agentrun-refresh-app.json', 'r', encoding='utf-8') as fh:",
|
||||
" app = json.load(fh)",
|
||||
"except Exception:",
|
||||
" app = {}",
|
||||
"status = app.get('status') or {}",
|
||||
"sync = status.get('sync') or {}",
|
||||
"health = status.get('health') or {}",
|
||||
"print(json.dumps({",
|
||||
" 'ok': True,",
|
||||
" 'namespace': os.environ.get('NAMESPACE'),",
|
||||
" 'application': os.environ.get('APPLICATION'),",
|
||||
" 'revision': sync.get('revision'),",
|
||||
" 'syncStatus': sync.get('status'),",
|
||||
" 'healthStatus': health.get('status'),",
|
||||
" 'observedAt': datetime.datetime.now(datetime.timezone.utc).isoformat().replace('+00:00', 'Z'),",
|
||||
" 'valuesPrinted': False,",
|
||||
"}, ensure_ascii=False))",
|
||||
"PY",
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user