This commit is contained in:
dvirlabs 2025-06-19 22:46:01 +03:00
parent 52378569ab
commit 2d85f6c895

View File

@ -16,8 +16,8 @@ INFRA_REPO_URL="https://git.dvirlabs.com/dvirlabs/infra.git"
SANDBOX_CLONE=".tmp-repos/sandbox"
INFRA_CLONE=".tmp-repos/infra"
GENERATED_FILE="generated-values/cloudflared-values.yaml"
ORIGINAL_FILE="$INFRA_CLONE/cloudflared/values.yaml"
MERGED_FILE="$INFRA_CLONE/cloudflared/values.yaml"
ORIGINAL_FILE="$INFRA_CLONE/manifests/cloudflared/values.yaml"
MERGED_FILE="$INFRA_CLONE/manifests/cloudflared/values.yaml"
# === STEP 1: Clone Repos ===
echo "📦 Cloning sandbox-apps..."
@ -57,10 +57,10 @@ echo "🔁 Merging new entries into: $ORIGINAL_FILE"
TEMP_FILE=$(mktemp)
# Copy original ingress list (except null or malformed)
# Copy original ingress list
yq eval '.cloudflare.ingress' "$ORIGINAL_FILE" > "$TEMP_FILE"
# Append new unique entries
# Append new unique entries (skip existing hostnames)
yq eval '.ingress' "$GENERATED_FILE" | yq eval -o=json '.' - | jq -c '.[]' | while read -r new_entry; do
hostname=$(echo "$new_entry" | jq -r '.hostname')
service=$(echo "$new_entry" | jq -r '.service')
@ -87,10 +87,10 @@ yq eval '
echo "✅ Final merged values.yaml:"
cat "$MERGED_FILE"
# === STEP 5: Optional push
# === STEP 5: Optional push to Git ===
# cd "$INFRA_CLONE"
# git config user.name "woodpecker-bot"
# git config user.email "ci@dvirlabs.com"
# git add cloudflared/values.yaml
# git add manifests/cloudflared/values.yaml
# git commit -m "chore(cloudflared): auto-add ingress from sandbox"
# git push