Refresh Argo for runtime lanes
This commit is contained in:
@@ -1870,16 +1870,17 @@ git config --global user.email "hwlab-g14-gitops-bot@users.noreply.github.com"
|
||||
catalog_path="$(params.catalog-path)"
|
||||
runtime_path="$(params.runtime-path)"
|
||||
|
||||
argo_hard_refresh_v02() {
|
||||
if [ "$lane" != "v02" ]; then return 0; fi
|
||||
node <<'NODE'
|
||||
argo_hard_refresh_runtime_lane() {
|
||||
if [ "$runtime_lane" != "true" ]; then return 0; fi
|
||||
ARGO_APPLICATION="hwlab-g14-$lane" ARGO_FIELD_MANAGER="hwlab-$lane-gitops-promote" node <<'NODE'
|
||||
const fs = require("node:fs");
|
||||
const https = require("node:https");
|
||||
|
||||
const host = process.env.KUBERNETES_SERVICE_HOST;
|
||||
const port = process.env.KUBERNETES_SERVICE_PORT || "443";
|
||||
const startedAt = Date.now();
|
||||
const application = "hwlab-g14-v02";
|
||||
const application = process.env.ARGO_APPLICATION || "hwlab-g14-v02";
|
||||
const fieldManager = process.env.ARGO_FIELD_MANAGER || "hwlab-v02-gitops-promote";
|
||||
const pipelineRun = process.env.HWLAB_TEKTON_PIPELINERUN || null;
|
||||
const taskRun = process.env.HWLAB_TEKTON_TASKRUN || null;
|
||||
const task = process.env.HWLAB_TEKTON_TASK || null;
|
||||
@@ -1938,7 +1939,7 @@ function request(method, path, body, contentType = "application/merge-patch+json
|
||||
}
|
||||
const response = await request(
|
||||
"PATCH",
|
||||
"/apis/argoproj.io/v1alpha1/namespaces/argocd/applications/" + encodeURIComponent(application) + "?fieldManager=hwlab-v02-gitops-promote",
|
||||
"/apis/argoproj.io/v1alpha1/namespaces/argocd/applications/" + encodeURIComponent(application) + "?fieldManager=" + encodeURIComponent(fieldManager),
|
||||
{ metadata: { annotations: { "argocd.argoproj.io/refresh": "hard" } } }
|
||||
);
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
@@ -2102,7 +2103,7 @@ ci_timing_emit gitops-commit succeeded "$gitops_commit_started_ms"
|
||||
gitops_push_started_ms="$(ci_now_ms)"
|
||||
git_timed gitops-push 120 git push origin "HEAD:$(params.gitops-branch)"
|
||||
ci_timing_emit gitops-push succeeded "$gitops_push_started_ms"
|
||||
argo_hard_refresh_v02
|
||||
argo_hard_refresh_runtime_lane
|
||||
echo '{"status":"pushed","gitopsBranch":"'"$(params.gitops-branch)"'","sourceRevision":"'"$(params.revision)"'","gitopsWriteUrl":"'"$gitops_write_url"'"}'
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -151,9 +151,10 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots
|
||||
agentRunBundleCommit: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
}
|
||||
}), "runtime-identity-only");
|
||||
assert.match(gitopsPromoteScript, /argo_hard_refresh_v02\(\) \{/u);
|
||||
assert.match(gitopsPromoteScript, /argo_hard_refresh_runtime_lane\(\) \{/u);
|
||||
assert.match(gitopsPromoteScript, /ARGO_APPLICATION="hwlab-g14-\$lane" ARGO_FIELD_MANAGER="hwlab-\$lane-gitops-promote"/u);
|
||||
assert.match(gitopsPromoteScript, /argocd\.argoproj\.io\/refresh": "hard"/u);
|
||||
assert.match(gitopsPromoteScript, /applications\/" \+ encodeURIComponent\(application\) \+ "\?fieldManager=hwlab-v02-gitops-promote/u);
|
||||
assert.match(gitopsPromoteScript, /applications\/" \+ encodeURIComponent\(application\) \+ "\?fieldManager=" \+ encodeURIComponent\(fieldManager\)/u);
|
||||
assert.match(gitopsPromoteScript, /BatchMode=yes/u);
|
||||
assert.match(gitopsPromoteScript, /ConnectTimeout=10/u);
|
||||
assert.match(gitopsPromoteScript, /git_timed "source-head-\$phase" 45 git ls-remote/u);
|
||||
|
||||
Reference in New Issue
Block a user