@@ -181,6 +181,22 @@ ps: ## List all service containers
181181top : # # Display all running service processes
182182 @EDITION= DEFAULT_USER_UID= docker compose top
183183
184+ .PHONY : integration-test-model-deploy-latest
185+ integration-test-model-deploy-latest : # Run integration test on the latest Instill Core to build, push and deploy dummy models
186+ @make latest EDITION=local-ce:test
187+ @make build-and-push-models
188+ @make latest EDITION=local-ce:test INITMODEL_ENABLED=true INITMODEL_PATH=${PWD} /integration-test/models/inventory.json
189+ @make wait-models-deploy
190+ @make down
191+
192+ .PHONY : integration-test-model-deploy-release
193+ integration-test-model-deploy-release : # Run integration test on the released Instill Core to build, push and deploy dummy models
194+ @make all EDITION=local-ce:test
195+ @make build-and-push-models
196+ @make all EDITION=local-ce:test INITMODEL_ENABLED=true INITMODEL_PATH=${PWD} /integration-test/models/inventory.json
197+ @make wait-models-deploy
198+ @make down
199+
184200.PHONY : integration-test-latest
185201integration-test-latest : # Run integration test on the latest Instill Core
186202 @make build-latest
@@ -196,7 +212,7 @@ integration-test-latest: # Run integration test on the latest Instill Core
196212 @make down
197213
198214.PHONY : integration-test-release
199- integration-test-release : # Run integration test on the release Instill Core
215+ integration-test-release : # Run integration test on the released Instill Core
200216 @make build-release
201217 @make all EDITION=local-ce:test COMPONENT_ENV=${COMPONENT_TEST_ENV}
202218 @docker run --rm \
@@ -318,7 +334,7 @@ console-integration-test-latest: # Run console integration test on the latest
318334 @make down
319335
320336.PHONY : console-integration-test-release
321- console-integration-test-release : # Run console integration test on the release Instill Core
337+ console-integration-test-release : # Run console integration test on the released Instill Core
322338 @make all EDITION=local-ce:test INSTILL_CORE_HOST=${API_GATEWAY_HOST} COMPONENT_ENV=${COMPONENT_TEST_ENV}
323339 @docker run --rm \
324340 -e NEXT_PUBLIC_GENERAL_API_VERSION=v1beta \
@@ -491,6 +507,28 @@ endif
491507 @pkill -f "port-forward"
492508 @make down
493509
510+ .PHONY : build-and-push-models
511+ build-and-push-models : # Helper target to build and push models
512+ @SDK_PATH=$$(python3 -c 'import instill; import os.path; print(os.path.dirname(os.path.dirname(instill.__file__ ) ))' 2>/dev/null || echo ""); \
513+ ./integration-test/scripts/build_and_push_models.sh \
514+ " $( PWD) /integration-test/models" \
515+ " localhost:5001" \
516+ " $$ SDK_PATH"
517+
518+ .PHONY : wait-models-deploy
519+ wait-models-deploy : # Helper target to wait for model deployment
520+ @model_count=$$(jq length integration-test/models/inventory.json ) ; \
521+ timeout=600; elapsed=0; spinner=' |/-\\' ; i=0; \
522+ while [ " $$ (curl -s http://localhost:8265/api/serve/applications/ | jq " .applications | to_entries | map(select(.key | contains(\" dummy-\" )) | .value.status) | length == $$ model_count and all(. == \" RUNNING\" )" )" != " true" ]; do \
523+ running_count=$$(curl -s http://localhost:8265/api/serve/applications/ | jq '.applications | to_entries | map(select(.key | contains("dummy-" ) ) | .value.status) | map(select(. == " RUNNING" )) | length' ); \
524+ printf " \r[Waiting %3ds/%ds] %c models still deploying... (%d/%d RUNNING)" " $$ elapsed" " $$ timeout" " $$ {spinner:i++%4:1}" " $$ running_count" " $$ model_count" ; \
525+ sleep 1; elapsed=$$((elapsed+1 ) ); \
526+ if [ " $$ elapsed" -ge " $$ timeout" ]; then \
527+ echo " \nTimeout waiting for models to deploy!" ; exit 1; \
528+ fi ; \
529+ done ; \
530+ echo " \nAll $$ model_count models deployed and running."
531+
494532.PHONY : help
495533help : # # Show this help
496534 @echo " \nMake Application with Instill Core"
0 commit comments