fix(kestra-init): add basic auth support via KESTRA_USER/KESTRA_PASSWORD
All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 33s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m9s
Build and Push Docker Images / Build Integrator (push) Successful in 56s
Build and Push Docker Images / Build Kestra Init (push) Successful in 32s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 0s
All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 33s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m9s
Build and Push Docker Images / Build Integrator (push) Successful in 56s
Build and Push Docker Images / Build Kestra Init (push) Successful in 32s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 0s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -116,6 +116,8 @@ services:
|
||||
container_name: schoolcompare_kestra_init
|
||||
environment:
|
||||
KESTRA_URL: http://kestra:8080
|
||||
KESTRA_USER: ${KESTRA_USER:-}
|
||||
KESTRA_PASSWORD: ${KESTRA_PASSWORD:-}
|
||||
depends_on:
|
||||
kestra:
|
||||
condition: service_healthy
|
||||
|
||||
@@ -4,9 +4,15 @@ set -e
|
||||
KESTRA_URL="${KESTRA_URL:-http://kestra:8080}"
|
||||
MAX_WAIT=120
|
||||
|
||||
# Basic auth — set KESTRA_USER / KESTRA_PASSWORD if authentication is enabled
|
||||
AUTH=""
|
||||
if [ -n "$KESTRA_USER" ] && [ -n "$KESTRA_PASSWORD" ]; then
|
||||
AUTH="-u ${KESTRA_USER}:${KESTRA_PASSWORD}"
|
||||
fi
|
||||
|
||||
echo "Waiting for Kestra API at ${KESTRA_URL}..."
|
||||
elapsed=0
|
||||
until curl -sf "${KESTRA_URL}/api/v1/flows/search" > /dev/null 2>&1; do
|
||||
until curl -sf $AUTH "${KESTRA_URL}/api/v1/flows/search" > /dev/null 2>&1; do
|
||||
if [ "$elapsed" -ge "$MAX_WAIT" ]; then
|
||||
echo "ERROR: Kestra API not reachable after ${MAX_WAIT}s"
|
||||
exit 1
|
||||
@@ -22,7 +28,7 @@ for f in /flows/*.yml; do
|
||||
name="$(basename "$f")"
|
||||
echo " -> $name"
|
||||
|
||||
http_code=$(curl -s -o /tmp/kestra_resp -w "%{http_code}" \
|
||||
http_code=$(curl -s $AUTH -o /tmp/kestra_resp -w "%{http_code}" \
|
||||
-X POST "${KESTRA_URL}/api/v1/flows" \
|
||||
-H "Content-Type: application/x-yaml" \
|
||||
--data-binary "@${f}")
|
||||
@@ -32,7 +38,7 @@ for f in /flows/*.yml; do
|
||||
elif [ "$http_code" = "409" ]; then
|
||||
ns=$(grep '^namespace:' "$f" | awk '{print $2}')
|
||||
id=$(grep '^id:' "$f" | awk '{print $2}')
|
||||
http_code2=$(curl -s -o /tmp/kestra_resp -w "%{http_code}" \
|
||||
http_code2=$(curl -s $AUTH -o /tmp/kestra_resp -w "%{http_code}" \
|
||||
-X PUT "${KESTRA_URL}/api/v1/flows/${ns}/${id}" \
|
||||
-H "Content-Type: application/x-yaml" \
|
||||
--data-binary "@${f}")
|
||||
|
||||
Reference in New Issue
Block a user