Skip to content
Open
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 53 additions & 4 deletions devspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ functions:
- |
set -eu
elapsed=0
while [ ! -f /opt/app/data/go.mod ]; do
while [ ! -f /opt/app/data/go.mod ] || \
[ ! -f /opt/app/data/go.sum ] || \
[ ! -f /opt/app/data/buf.gen.yaml ] || \
[ ! -f /opt/app/data/buf.yaml ]; do
sleep 1; elapsed=$((elapsed + 1))
[ "$elapsed" -ge 240 ] && { echo "ERROR: sync timeout" >&2; exit 1; }
[ "$elapsed" -ge 240 ] && { echo "ERROR: sync timeout waiting for source and Buf config" >&2; exit 1; }
done
buf generate buf.build/agynio/api \
--include-imports \
Expand Down Expand Up @@ -118,6 +121,45 @@ functions:
echo " still waiting... (${ELAPSED}s)"
done
echo "Orchestrator is running from source."
sync_sources_once: |-
echo "Syncing source tree into agents-orchestrator pod..."
LABEL_SELECTOR="app.kubernetes.io/name=agents-orchestrator,app.kubernetes.io/instance=agents-orchestrator"
POD="$(kubectl get pod -n ${ORCHESTRATOR_NAMESPACE} -l "${LABEL_SELECTOR}" \
-o jsonpath='{.items[0].metadata.name}')"
if [ -z "${POD}" ]; then
echo "ERROR: agents-orchestrator pod not found for selector ${LABEL_SELECTOR}" >&2
kubectl get pods -n ${ORCHESTRATOR_NAMESPACE} -l "${LABEL_SELECTOR}" -o wide >&2 || true
exit 1
fi

SYNC_ARCHIVE="$(mktemp)"
trap 'rm -f "${SYNC_ARCHIVE}"' EXIT
find . -mindepth 1 -maxdepth 1 \
! -name .git \
! -name .devspace \
! -name .gen \
! -name tmp \
-print0 | tar --null -T - -cf "${SYNC_ARCHIVE}"
SYNC_SIZE="$(wc -c < "${SYNC_ARCHIVE}")"
echo "Uploading source archive (${SYNC_SIZE} bytes) to pod ${POD}..."
if ! timeout 120s kubectl cp -n ${ORCHESTRATOR_NAMESPACE} \
-c agents-orchestrator "${SYNC_ARCHIVE}" "${POD}:/tmp/agents-orchestrator-source.tar"; then
echo "ERROR: source archive upload failed or timed out" >&2
kubectl get pod -n ${ORCHESTRATOR_NAMESPACE} "${POD}" -o wide >&2 || true
kubectl logs -n ${ORCHESTRATOR_NAMESPACE} "${POD}" \
-c agents-orchestrator --tail=200 >&2 || true
exit 1
fi
if ! timeout 120s kubectl exec -n ${ORCHESTRATOR_NAMESPACE} "${POD}" \
-c agents-orchestrator -- sh -c \
'tar -xf /tmp/agents-orchestrator-source.tar -C /opt/app/data && rm -f /tmp/agents-orchestrator-source.tar'; then
echo "ERROR: source archive extraction failed or timed out" >&2
kubectl get pod -n ${ORCHESTRATOR_NAMESPACE} "${POD}" -o wide >&2 || true
kubectl logs -n ${ORCHESTRATOR_NAMESPACE} "${POD}" \
-c agents-orchestrator --tail=200 >&2 || true
exit 1
fi
echo "Source tree synced."

commands:
deploy: |-
Expand Down Expand Up @@ -148,7 +190,9 @@ pipelines:
run: |-
disable_argocd_sync
patch_deployment
start_dev --disable-pod-replace agents-orchestrator-deploy
kubectl rollout status deployment/agents-orchestrator \
-n ${ORCHESTRATOR_NAMESPACE} --timeout=120s
sync_sources_once
wait_for_orchestrator
echo "Deploy complete. Orchestrator is running from source."

Expand All @@ -157,7 +201,8 @@ pipelines:
restore_argocd_sync

dev:
# CI counterpart: agents-orchestrator-deploy (one-shot sync)
# Interactive dev sync uses inotify in the container. CI deploy avoids DevSpace
# sync/watch entirely and performs a one-shot source upload in sync_sources_once.
agents-orchestrator:
namespace: ${ORCHESTRATOR_NAMESPACE}
labelSelector:
Expand All @@ -168,6 +213,7 @@ dev:
container: agents-orchestrator
sync:
- path: ./:/opt/app/data
polling: false
excludePaths:
- .git/
- .devspace/
Expand Down Expand Up @@ -198,7 +244,10 @@ dev:
container: agents-orchestrator
sync:
- path: ./:/opt/app/data
initialSync: mirrorLocal
waitInitialSync: true
noWatch: true
polling: false
excludePaths:
- .git/
- .devspace/
Expand Down
Loading