-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevspace.yaml
More file actions
175 lines (167 loc) · 6.2 KB
/
devspace.yaml
File metadata and controls
175 lines (167 loc) · 6.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
version: v2beta1
vars:
APP_NAMESPACE: platform
E2E_IMAGE: mcr.microsoft.com/playwright:v1.58.2-noble
functions:
disable_argocd_sync: |-
for app in chat-app; do
if kubectl get application "$app" -n argocd >/dev/null 2>&1; then
echo "Disabling ArgoCD auto-sync for $app..."
kubectl patch application "$app" -n argocd \
--type merge \
-p '{"spec":{"syncPolicy":{"automated":null}}}'
echo "ArgoCD auto-sync disabled for $app."
else
echo "WARNING: ArgoCD Application '$app' not found in argocd namespace."
fi
done
restore_argocd_sync: &restore_argocd_sync |-
for app in chat-app; do
if kubectl get application "$app" -n argocd >/dev/null 2>&1; then
echo "Re-enabling ArgoCD auto-sync for $app..."
kubectl patch application "$app" -n argocd \
--type merge \
-p '{"spec":{"syncPolicy":{"automated":{"prune":true,"selfHeal":true}}}}'
echo "ArgoCD auto-sync restored for $app."
else
echo "WARNING: ArgoCD Application '$app' not found."
fi
done
deploy_pr_image: |-
echo "Deploying PR image to cluster..."
IMAGE="${PR_IMAGE:-}"
if [ -z "$IMAGE" ]; then
echo "ERROR: PR_IMAGE not set, aborting hot deploy"
exit 1
fi
kubectl set image deployment/chat-app chat-app="$IMAGE" -n ${APP_NAMESPACE}
kubectl rollout status deployment/chat-app -n ${APP_NAMESPACE} --timeout=120s
echo "PR image deployed successfully"
dump_agent_logs: |-
echo "=== ORCHESTRATOR LOGS ==="
kubectl logs deploy/agents-orchestrator -n platform --tail=100 || true
echo "=== AGENT WORKLOAD PODS (agyn-workloads) ==="
kubectl get pods -n agyn-workloads -o wide 2>/dev/null || true
echo "=== AGENT WORKLOAD LOGS ==="
for pod in $(kubectl get pods -n agyn-workloads -o name 2>/dev/null); do
echo "--- $pod ---"
kubectl logs "$pod" -n agyn-workloads --all-containers --tail=50 2>/dev/null || true
done
echo "=== K8S-RUNNER LOGS ==="
kubectl logs deploy/k8s-runner -n platform --tail=50 || true
echo "=== END DIAGNOSTIC LOGS ==="
deployments:
e2e-runner:
namespace: ${APP_NAMESPACE}
helm:
chart:
name: component-chart
repo: https://charts.devspace.sh
values:
containers:
- image: ${E2E_IMAGE}
env:
- name: E2E_BASE_URL
value: "https://chat.agyn.dev"
- name: ARGOS_TOKEN
value: "${ARGOS_TOKEN}"
- name: ARGOS_BRANCH
value: "${ARGOS_BRANCH}"
- name: ARGOS_COMMIT
value: "${ARGOS_COMMIT}"
- name: CI
value: "${CI}"
labels:
app.kubernetes.io/name: chat-app-e2e
commands:
test-e2e: |-
devspace run-pipeline test-e2e $@
pipelines:
dev:
flags:
- name: watch
short: w
description: "Keep DevSpace running and stream logs"
run: |-
disable_argocd_sync
if [ "$(get_flag "watch")" == "true" ]; then
start_dev --disable-pod-replace chat-app
else
start_dev --disable-pod-replace chat-app
echo "Dev environment ready. Stopping dev session."
stop_dev chat-app
fi
test-e2e:
run: |-
disable_argocd_sync
deploy_pr_image
create_deployments e2e-runner
start_dev e2e-runner &
sleep 5
set +e
exec_container \
--label-selector "app.kubernetes.io/name=chat-app-e2e" \
-n ${APP_NAMESPACE} \
-- bash -c '
echo "Waiting for file sync..."
for i in $(seq 1 60); do
[ -f /opt/app/data/package.json ] && [ -f /opt/app/data/pnpm-lock.yaml ] && [ -f /opt/app/data/test/e2e/fixtures.ts ] && [ -f /opt/app/data/test/e2e/multi-user-fixtures.ts ] && [ -f /opt/app/data/test/e2e/chat-api.ts ] && [ -f /opt/app/data/test/e2e/chat-exchange.spec.ts ] && [ -f /opt/app/data/test/e2e/chat-detail.spec.ts ] && [ -f /opt/app/data/test/e2e/chats-list.spec.ts ] && [ -f /opt/app/data/test/e2e/file-upload.spec.ts ] && [ -f /opt/app/data/test/e2e/sign-in-helper.ts ] && [ -f /opt/app/data/test/e2e/sign-in.spec.ts ] && break
sleep 2
done
if [ ! -f /opt/app/data/package.json ] || [ ! -f /opt/app/data/pnpm-lock.yaml ] || [ ! -f /opt/app/data/test/e2e/fixtures.ts ] || [ ! -f /opt/app/data/test/e2e/multi-user-fixtures.ts ] || [ ! -f /opt/app/data/test/e2e/chat-api.ts ] || [ ! -f /opt/app/data/test/e2e/chat-exchange.spec.ts ] || [ ! -f /opt/app/data/test/e2e/chat-detail.spec.ts ] || [ ! -f /opt/app/data/test/e2e/chats-list.spec.ts ] || [ ! -f /opt/app/data/test/e2e/file-upload.spec.ts ] || [ ! -f /opt/app/data/test/e2e/sign-in-helper.ts ] || [ ! -f /opt/app/data/test/e2e/sign-in.spec.ts ]; then
echo "ERROR: File sync timed out (package.json, pnpm-lock.yaml, or test/e2e files not found after 120s)"
exit 1
fi
sleep 5
cd /opt/app/data
corepack enable
pnpm install --frozen-lockfile
E2E_BASE_URL=https://chat.agyn.dev ARGOS_TOKEN=${ARGOS_TOKEN} ARGOS_BRANCH=${ARGOS_BRANCH} ARGOS_COMMIT=${ARGOS_COMMIT} CI=true pnpm test:e2e
'
EXIT_CODE=$?
set -e
dump_agent_logs || true
stop_dev e2e-runner
purge_deployments e2e-runner
restore_argocd_sync
exit ${EXIT_CODE}
hooks:
- name: restore-argocd-auto-sync
events:
- after:dev:chat-app
command: bash
args:
- -c
- *restore_argocd_sync
dev:
e2e-runner:
namespace: ${APP_NAMESPACE}
labelSelector:
app.kubernetes.io/name: chat-app-e2e
command: ["sleep", "infinity"]
workingDir: /opt/app/data
sync:
- path: ./:/opt/app/data
excludePaths:
- .git/
- .devspace/
- node_modules/
- dist/
chat-app:
namespace: ${APP_NAMESPACE}
labelSelector:
app.kubernetes.io/name: chat-app
app.kubernetes.io/instance: chat-app
containers:
chat-app:
sync:
- path: ./dist:/usr/share/nginx/html
excludePaths:
- .git/
- .devspace/
- node_modules/
logs:
enabled: true
lastLines: 200
ports:
- port: "3000"