-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
200 lines (170 loc) · 6.65 KB
/
Taskfile.yaml
File metadata and controls
200 lines (170 loc) · 6.65 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# SPDX-FileCopyrightText: Copyright (c) 2025 Cisco and/or its affiliates.
# SPDX-License-Identifier: Apache-2.0
---
version: '3'
silent: true
vars:
KIND_CLUSTER_NAME: '{{ .KIND_CLUSTER_NAME | default "agntcy-test" }}'
## Image config
IMAGE_REPO: '{{ .IMAGE_REPO | default "ghcr.io/agntcy" }}'
GATEWAY_IMAGE_TAG: '{{ .GATEWAY_IMAGE_TAG | default "0.3.0" }}'
DIRECTORY_IMAGE_TAG: '{{ .DIRECTORY_IMAGE_TAG | default "v0.1.1" }}'
IMAGE_BAKE_OPTS: '{{ .IMAGE_BAKE_OPTS | default "--set *.platform=linux/arm64" }}'
TEST_APP_TAG: '{{ .TEST_APP_TAG | default "v0.0.1" }}'
AZURE_OPENAI_API_KEY: '{{ .AZURE_OPENAI_API_KEY | default "" }}'
AZURE_OPENAI_ENDPOINT: '{{ .AZURE_OPENAI_ENDPOINT | default "" }}'
HELM_NAMESPACE: '{{ .HELM_NAMESPACE | default "default" }}'
tasks:
default:
cmds:
- task -l
kind:create:
desc: Create kind cluster
cmds:
- kind create cluster --name {{.KIND_CLUSTER_NAME}} --wait 60s || true
- kubectl cluster-info --context kind-{{.KIND_CLUSTER_NAME}}
kind:destroy:
desc: Destroy kind cluster
cmds:
- kind delete cluster --name {{.KIND_CLUSTER_NAME}}
kind:load-images:directory:
desc: Pull and load images to kind
cmds:
# pull images
- docker pull {{.IMAGE_REPO}}/dir-apiserver:{{.DIRECTORY_IMAGE_TAG}}
# load images
- kind load docker-image {{.IMAGE_REPO}}/dir-apiserver:{{.DIRECTORY_IMAGE_TAG}} --name {{.KIND_CLUSTER_NAME}}
kind:load-images:gateway:
desc: Pull and load images to kind
cmds:
# pull images
- docker pull {{.IMAGE_REPO}}/agp/gw:{{.GATEWAY_IMAGE_TAG}}
# load images
- kind load docker-image {{.IMAGE_REPO}}/agp/gw:{{.GATEWAY_IMAGE_TAG}} --name {{.KIND_CLUSTER_NAME}}
k8s:port-forward:setup:directory:
internal: true
cmds:
- kubectl port-forward svc/agntcy-dir-apiserver -n {{ .HELM_NAMESPACE }} 8888 &
- sleep 1
k8s:port-forward:teardown:directory:
internal: true
cmds:
- kill -9 $(ps aux | grep port-forward | grep agntcy-dir-apiserver | awk '{print $2}') || true
k8s:port-forward:setup:gateway:
internal: true
cmds:
- kubectl port-forward svc/agntcy-agp -n {{ .HELM_NAMESPACE }} 46357 &
- sleep 1
k8s:port-forward:teardown:gateway:
internal: true
cmds:
- kill -9 $(ps aux | grep port-forward | grep agntcy-agp | awk '{print $2}') || true
test:env:directory:deploy:
desc: Deploy Agntcy directory test env
deps:
- kind:load-images:directory
vars:
REGCRED_CREATE: '{{ .REGCRED_CREATE | default "false" }}'
cmds:
- |
helm dependency build ./agntcy-dir/components/helm
helm upgrade agntcy-dir \
./agntcy-dir/components/helm \
--set dir.apiserver.image.tag="{{ .DIRECTORY_IMAGE_TAG }}" \
--set regcred.create="{{ .REGCRED_CREATE }}" \
--namespace {{ .HELM_NAMESPACE }} \
--create-namespace \
--install \
--wait \
--wait-for-jobs \
--timeout "15m"
test:env:directory:cleanup:
desc: Remove agntcy directory test env
cmds:
- helm delete --namespace {{ .HELM_NAMESPACE }} agntcy-dir
test:env:gateway:deploy:
desc: Deploy agntcy gateway test env
deps:
- kind:load-images:gateway
cmds:
- |
helm dependency build ./agntcy-agp/components/helm
helm upgrade agntcy-agp \
./agntcy-agp/components/helm \
--set agp.image.tag="{{ .GATEWAY_IMAGE_TAG }}" \
--namespace {{ .HELM_NAMESPACE }} \
--create-namespace \
--install \
--wait \
--wait-for-jobs \
--timeout "15m"
test:env:gateway:cleanup:
desc: Remove agent gateway test env
cmds:
- helm delete --namespace {{ .HELM_NAMESPACE }} agntcy-agp
build:gateway:agentic-apps:
desc: Build agentic containers
dir: ./agntcy-agp/agentic-apps
cmds:
- IMAGE_TAG={{ .TEST_APP_TAG }} docker buildx bake {{ .IMAGE_BAKE_OPTS }} --load
test:directory:
desc: Directory test
cmds:
- task: k8s:port-forward:setup:directory
- defer: { task: k8s:port-forward:teardown:directory }
- defer: { task: manifests:cleanup }
- IMAGE_REPO={{.IMAGE_REPO}} DIRECTORY_IMAGE_TAG={{.DIRECTORY_IMAGE_TAG}} go test ./agntcy-dir/tests -v -failfast -test.v -test.paniconexit0 -ginkgo.timeout 30m -timeout 30m -ginkgo.v
test:directory:compiler:
desc: Agntcy compiler test
cmds:
- docker pull {{.IMAGE_REPO}}/dir-ctl:{{.DIRECTORY_IMAGE_TAG}}
- IMAGE_REPO={{.IMAGE_REPO}} DIRECTORY_IMAGE_TAG={{.DIRECTORY_IMAGE_TAG}} go test ./agntcy-dir/tests -v -failfast -test.v -test.paniconexit0 -ginkgo.timeout 10m -timeout 10m -ginkgo.v -ginkgo.focus "agent compilation"
test:directory:push:
desc: Directory agent push test
cmds:
- task: k8s:port-forward:setup:directory
- defer: { task: k8s:port-forward:teardown:directory }
- defer: { task: manifests:cleanup }
- IMAGE_REPO={{.IMAGE_REPO}} DIRECTORY_IMAGE_TAG={{.DIRECTORY_IMAGE_TAG}} go test ./agntcy-dir/tests -v -failfast -test.v -test.paniconexit0 -ginkgo.timeout 30m -timeout 30m -ginkgo.v -ginkgo.focus "agent push and pull"
test:autogen-agent:run:
internal: true
cmds:
- |
hostNetFlag=""
hostMachine=http://host.docker.internal:46357
unameOut=$(uname -s)
case ${unameOut} in
Linux*)
hostMachine=http://127.0.0.1:46357
hostNetFlag="--net=host"
;;
Darwin*)
hostMachine=http://host.docker.internal:46357
;;
*)
esac
echo "gw host: ${hostMachine}"
docker run -d --rm \
-e AZURE_OPENAI_API_KEY={{.AZURE_OPENAI_API_KEY}} \
-e AZURE_OPENAI_ENDPOINT={{.AZURE_OPENAI_ENDPOINT}} \
${hostNetFlag} \
--name autogen-agent \
{{ .IMAGE_REPO }}/csit/test-autogen-agent:{{ .TEST_APP_TAG }} \
poetry run python autogen_agent.py -g ${hostMachine}
test:autogen-agent:remove:
internal: true
cmds:
- docker stop $(docker ps -a --no-trunc --filter name=^/autogen-agent$ -q)
test:gateway:
desc: Gateway test
cmds:
- task: k8s:port-forward:setup:gateway
- defer: { task: k8s:port-forward:teardown:gateway }
- task: test:autogen-agent:run
- defer: { task: test:autogen-agent:remove }
- docker pull {{ .IMAGE_REPO }}/csit/test-langchain-agent:{{ .TEST_APP_TAG }}
- IMAGE_REPO={{.IMAGE_REPO}} TEST_APP_TAG={{.TEST_APP_TAG}} go test ./agntcy-agp/tests -v -failfast -test.v -test.paniconexit0 -ginkgo.timeout 30m -timeout 30m -ginkgo.v
version:
desc: Get version
cmds:
- git describe --tags --match "v*" | cut -c 2-