From ef74907be25ff47f180686416bce0da0ce8802dc Mon Sep 17 00:00:00 2001 From: dvirlabs Date: Mon, 23 Jun 2025 00:42:54 +0300 Subject: [PATCH] Seperate the script --- automation/config.sh | 13 +++++++++---- automation/main.sh | 4 ++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/automation/config.sh b/automation/config.sh index 3a1b4f2..d96aaf1 100644 --- a/automation/config.sh +++ b/automation/config.sh @@ -1,20 +1,25 @@ #!/bin/bash -set -e +# ✋ Do NOT install tools here — do that in the pipeline or main.sh -# Required tools -apk add --no-cache git bash curl yq jq +# ❗ Fail if required env vars are not set +: "${GIT_TOKEN:?GIT_TOKEN is not set}" +: "${CLOUDFLARE_API_TOKEN:?CLOUDFLARE_API_TOKEN is not set}" +: "${CLOUDFLARE_ZONE_ID:?CLOUDFLARE_ZONE_ID is not set}" -# Repo Config +# Repos SANDBOX_REPO_URL="https://git.dvirlabs.com/dvirlabs/sandbox.git" INFRA_REPO_URL="https://${GIT_TOKEN}@git.dvirlabs.com/dvirlabs/infra.git" +# Paths SANDBOX_CLONE=".tmp-repos/sandbox" INFRA_CLONE=".tmp-repos/infra" +# Generated files GENERATED_FILE="$(pwd)/generated-values/cloudflared-values.yaml" ORIGINAL_FILE="$INFRA_CLONE/manifests/cloudflared/values.yaml" MERGED_FILE="$INFRA_CLONE/manifests/cloudflared/values.yaml" +# Cloudflare API CLOUDFLARE_API="https://api.cloudflare.com/client/v4" TARGET="b50bbf48-0a2f-47ce-b73e-336b6718318b.cfargotunnel.com" diff --git a/automation/main.sh b/automation/main.sh index 344cbf8..a953c04 100644 --- a/automation/main.sh +++ b/automation/main.sh @@ -1,6 +1,10 @@ #!/bin/bash set -e +# Install dependencies (done once here) +apk add --no-cache git bash curl yq jq + +# Load config AFTER env is present (from Woodpecker or exported manually) source automation/config.sh rm -rf .tmp-repos