Skip to content
Open
Show file tree
Hide file tree
Changes from 8 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
5 changes: 4 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ jobs:
- name: Setup DevSpace
uses: agynio/e2e/.github/actions/setup-devspace@main

- name: Deploy orchestrator from source
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Deploy orchestrator from CI image
Comment thread
noa-lucent marked this conversation as resolved.
Outdated
run: devspace run deploy

- name: Run E2E tests
Expand Down
56 changes: 47 additions & 9 deletions devspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version: v2beta1
vars:
ORCHESTRATOR_NAMESPACE: platform
DEV_IMAGE: ghcr.io/agynio/devcontainer-go:1
CI_IMAGE: agents-orchestrator:e2e

functions:
disable_argocd_sync: |-
Expand Down Expand Up @@ -53,9 +54,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 @@ -95,12 +99,29 @@ functions:
type: RuntimeDefault
EOF
)"
patch_ci_image_deployment: |-
echo "Patching agents-orchestrator deployment to use CI image..."
kubectl patch deployment agents-orchestrator -n ${ORCHESTRATOR_NAMESPACE} --type strategic --patch "$(cat <<EOF
spec:
template:
spec:
containers:
- name: agents-orchestrator
image: ${CI_IMAGE}
imagePullPolicy: Never
env:
- name: POLL_INTERVAL
value: "10s"
- name: WORKLOAD_RECONCILE_INTERVAL
value: "10s"
EOF
)"
wait_for_orchestrator: |-
echo "Waiting for orchestrator deployment to roll out..."
kubectl rollout status deployment/agents-orchestrator \
-n ${ORCHESTRATOR_NAMESPACE} --timeout=120s

echo "Waiting for orchestrator source sync and process start..."
echo "Waiting for orchestrator process start..."
ELAPSED=0
LABEL_SELECTOR="app.kubernetes.io/name=agents-orchestrator,app.kubernetes.io/instance=agents-orchestrator"
until kubectl logs -n ${ORCHESTRATOR_NAMESPACE} -l "${LABEL_SELECTOR}" --tail=200 2>/dev/null | \
Expand All @@ -117,7 +138,17 @@ functions:
fi
echo " still waiting... (${ELAPSED}s)"
done
echo "Orchestrator is running from source."
echo "Orchestrator is running."
build_ci_image: |-
echo "Building agents-orchestrator CI image..."
docker buildx build --load -t ${CI_IMAGE} .
if command -v k3d >/dev/null 2>&1 && k3d cluster list agyn-local >/dev/null 2>&1; then
echo "Importing agents-orchestrator CI image into k3d cluster..."
k3d image import ${CI_IMAGE} -c agyn-local
else
echo "k3d cluster agyn-local not found; assuming ${CI_IMAGE} is already visible to Kubernetes."
fi
echo "Agents-orchestrator CI image is ready."

commands:
deploy: |-
Expand Down Expand Up @@ -147,17 +178,20 @@ pipelines:
deploy:
run: |-
disable_argocd_sync
patch_deployment
start_dev --disable-pod-replace agents-orchestrator-deploy
build_ci_image
patch_ci_image_deployment
kubectl rollout status deployment/agents-orchestrator \
-n ${ORCHESTRATOR_NAMESPACE} --timeout=120s
wait_for_orchestrator
echo "Deploy complete. Orchestrator is running from source."
echo "Deploy complete. Orchestrator is running from the CI image."

restore-argocd:
run: |-
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 runs the freshly built CI image.
agents-orchestrator:
namespace: ${ORCHESTRATOR_NAMESPACE}
labelSelector:
Expand All @@ -168,6 +202,7 @@ dev:
container: agents-orchestrator
sync:
- path: ./:/opt/app/data
polling: false
excludePaths:
- .git/
- .devspace/
Expand All @@ -187,7 +222,7 @@ dev:
enabled: true
lastLines: 200

# One-shot variant of agents-orchestrator for CI deploy pipeline. Keep sync excludePaths in sync.
# Kept for manual one-shot DevSpace sync experiments. CI deploy uses a built image instead.
agents-orchestrator-deploy:
namespace: ${ORCHESTRATOR_NAMESPACE}
labelSelector:
Expand All @@ -198,7 +233,10 @@ dev:
container: agents-orchestrator
sync:
- path: ./:/opt/app/data
initialSync: mirrorLocal
waitInitialSync: true
noWatch: true
polling: false
excludePaths:
- .git/
- .devspace/
Expand Down
Loading