11.DEFAULT_GOAL: =help
22
3+ SHELL := /bin/bash
4+
35# ============================================================================
46
57# load environment variables
@@ -181,6 +183,22 @@ ps: ## List all service containers
181183top : # # Display all running service processes
182184 @EDITION= DEFAULT_USER_UID= docker compose top
183185
186+ .PHONY : integration-test-model-deploy-latest
187+ integration-test-model-deploy-latest : # Run integration test on the latest Instill Core to build, push and deploy dummy models
188+ @make latest EDITION=local-ce:test
189+ @make build-and-push-models
190+ @make latest EDITION=local-ce:test INITMODEL_ENABLED=true INITMODEL_PATH=${PWD} /integration-test/models/inventory.json
191+ @make wait-models-deploy
192+ @make down
193+
194+ .PHONY : integration-test-model-deploy-release
195+ integration-test-model-deploy-release : # Run integration test on the released Instill Core to build, push and deploy dummy models
196+ @make all EDITION=local-ce:test
197+ @make build-and-push-models
198+ @make all EDITION=local-ce:test INITMODEL_ENABLED=true INITMODEL_PATH=${PWD} /integration-test/models/inventory.json
199+ @make wait-models-deploy
200+ @make down
201+
184202.PHONY : integration-test-latest
185203integration-test-latest : # Run integration test on the latest Instill Core
186204 @make build-latest
@@ -196,7 +214,7 @@ integration-test-latest: # Run integration test on the latest Instill Core
196214 @make down
197215
198216.PHONY : integration-test-release
199- integration-test-release : # Run integration test on the release Instill Core
217+ integration-test-release : # Run integration test on the released Instill Core
200218 @make build-release
201219 @make all EDITION=local-ce:test COMPONENT_ENV=${COMPONENT_TEST_ENV}
202220 @docker run --rm \
@@ -318,7 +336,7 @@ console-integration-test-latest: # Run console integration test on the latest
318336 @make down
319337
320338.PHONY : console-integration-test-release
321- console-integration-test-release : # Run console integration test on the release Instill Core
339+ console-integration-test-release : # Run console integration test on the released Instill Core
322340 @make all EDITION=local-ce:test INSTILL_CORE_HOST=${API_GATEWAY_HOST} COMPONENT_ENV=${COMPONENT_TEST_ENV}
323341 @docker run --rm \
324342 -e NEXT_PUBLIC_GENERAL_API_VERSION=v1beta \
@@ -491,6 +509,25 @@ endif
491509 @pkill -f "port-forward"
492510 @make down
493511
512+ .PHONY : build-and-push-models
513+ build-and-push-models : # Helper target to build and push models
514+ @./integration-test/scripts/build_and_push_models.sh " $( PWD) /integration-test/models" " localhost:5001"
515+
516+ .PHONY : wait-models-deploy
517+ wait-models-deploy : # Helper target to wait for model deployment
518+ @model_count=$$(jq length integration-test/models/inventory.json ) ; \
519+ timeout=600; elapsed=0; spinner=' |/-\\' ; i=0; \
520+ 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 \
521+ 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' ); \
522+ printf " \r[Waiting %3ds/%ds] %s models still deploying... (%d/%d RUNNING)" " $$ elapsed" " $$ timeout" " $$ {spinner:$$ ((i % 4)):1}" " $$ running_count" " $$ model_count" ; \
523+ sleep 1; elapsed=$$((elapsed+1 ) ); \
524+ if [ " $$ elapsed" -ge " $$ timeout" ]; then \
525+ echo " \nTimeout waiting for models to deploy!" ; exit 1; \
526+ fi ; \
527+ i=$$((i + 1 ) ); \
528+ done ; \
529+ echo " \nAll $$ model_count models deployed and running."
530+
494531.PHONY : help
495532help : # # Show this help
496533 @echo " \nMake Application with Instill Core"
0 commit comments