Fix runtime lane GitOps promote path

This commit is contained in:
Codex Agent
2026-06-08 16:02:07 +08:00
parent 6a8aa7da2a
commit e06f348dca
+11 -7
View File
@@ -1820,9 +1820,13 @@ for tool in node git timeout; do command -v "$tool" >/dev/null 2>&1 || { echo '{
${gitSshShellFunction()}
git_url_requires_ssh() { case "$1" in git@*|ssh://*) return 0 ;; *) return 1 ;; esac; }
lane="$(params.lane)"
case "$lane" in
v[0-9][0-9]*) runtime_lane=true ;;
*) runtime_lane=false ;;
esac
source_head_url_for_setup="$(params.git-url)"
gitops_read_url_for_setup="$(params.git-url)"
if [ "$lane" = "v02" ]; then
if [ "$runtime_lane" = "true" ]; then
source_head_url_for_setup="$(params.git-read-url)"
gitops_read_url_for_setup="$(params.git-read-url)"
fi
@@ -1840,7 +1844,7 @@ check_source_head() {
phase="$1"
expected="\${2:-$(params.revision)}"
source_head_url="$(params.git-url)"
if [ "$(params.lane)" = "v02" ]; then
if [ "$runtime_lane" = "true" ]; then
source_head_url="$(params.git-read-url)"
fi
latest_file="$(mktemp)"
@@ -1959,7 +1963,7 @@ check_source_head before-push
workdir="$(mktemp -d)"
gitops_read_url="$(params.git-url)"
gitops_write_url="$(params.git-write-url)"
if [ "$lane" = "v02" ]; then
if [ "$runtime_lane" = "true" ]; then
gitops_read_url="$(params.git-read-url)"
fi
gitops_clone_started_ms="$(ci_now_ms)"
@@ -1970,18 +1974,18 @@ old_runtime_snapshot="$workdir/old-runtime-snapshot"
if git_timed gitops-branch-ls 45 git ls-remote --exit-code --heads origin "$(params.gitops-branch)" >/dev/null; then
git_timed gitops-fetch 90 git fetch origin "$(params.gitops-branch)"
git checkout -B "$(params.gitops-branch)" "origin/$(params.gitops-branch)"
if [ "$lane" = "v02" ] && [ -d "$runtime_path" ]; then
if [ "$runtime_lane" = "true" ] && [ -d "$runtime_path" ]; then
mkdir -p "$old_runtime_snapshot"
cp -a "$runtime_path"/. "$old_runtime_snapshot"/
fi
if [ "$lane" = "v02" ]; then rm -rf "$runtime_path" "$catalog_path"; else rm -rf deploy/gitops/g14 "$catalog_path"; fi
if [ "$runtime_lane" = "true" ]; then rm -rf "$runtime_path" "$catalog_path"; else rm -rf deploy/gitops/g14 "$catalog_path"; fi
else
git checkout --orphan "$(params.gitops-branch)"
git rm -rf . >/dev/null 2>&1 || true
fi
ci_timing_emit gitops-clone succeeded "$gitops_clone_started_ms"
mkdir -p "$(dirname "$runtime_path")" "$(dirname "$catalog_path")"
if [ "$lane" = "v02" ]; then
if [ "$runtime_lane" = "true" ]; then
cp -a "/workspace/source/repo/$runtime_path" "$runtime_path"
cp "/workspace/source/repo/$catalog_path" "$catalog_path"
git add "$catalog_path" "$runtime_path"
@@ -1991,7 +1995,7 @@ else
cp "/workspace/source/repo/$catalog_path" "$catalog_path"
git add "$catalog_path" deploy/gitops/g14
fi
if [ "$lane" = "v02" ] && [ -s /workspace/source/affected-services.json ]; then
if [ "$runtime_lane" = "true" ] && [ -s /workspace/source/affected-services.json ]; then
runtime_noop_decision="$(node - "$runtime_path" "$old_runtime_snapshot" /workspace/source/affected-services.json <<'NODE'
const fs = require("node:fs");
const path = require("node:path");