Skip to content

Commit

Permalink
ci(Makefile): remove build-related env variables (#1173)
Browse files Browse the repository at this point in the history
Because

- the Makefile targets are for local development and testing purpose,
the the service images have been also built from scratch to ensure
integrity. In this case, `BUILD` and `BUILD_CORE_DEV_IMAGE` are
redundant as they have been set always `true` anyway.

This commit

- remove `BUILD` and `BUILD_CORE_DEV_IMAGE` env variables
- remove `make build-release` in `make all` and `make build-latest` in
`make latest`, i.e., `make all` and `make latest` will use only remote
pre-built images and won't build service images locally
- fix typos
  • Loading branch information
pinglin authored Feb 24, 2025
1 parent cc9c6e2 commit 91b18fc
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 56 deletions.
11 changes: 4 additions & 7 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ COMPOSE_PROJECT_NAME=instill-core
# the value can be all, exclude-api-gateway, exclude-mgmt, exclude-pipeline, exclude-model, or exclude-console.
PROFILE=all

# build from scratch or not at launch, which will build all sources from scrach. Default to false.
BUILD=false

# system-wise config path (all vdp, model and artifact projects must use the same path)
SYSTEM_CONFIG_PATH=~/.config/instill

Expand All @@ -20,7 +17,7 @@ USAGE_ENABLED=true
# flag to enable observability stack
OBSERVE_ENABLED=false

# flag to enable model-backend creating predploy models
# flag to enable model-backend creating pre-dploy models
INITMODEL_ENABLED=false

# configuration directory path
Expand Down Expand Up @@ -109,13 +106,13 @@ POSTGRESQL_VERSION=14.1
POSTGRESQL_HOST=pg-sql
POSTGRESQL_PORT=5432

# Elasticseach
# Elasticsearch
ELASTICSEARCH_IMAGE=elasticsearch
ELASTICSEARCH_VERSION=7.17.27
ELASTICSEARCH_HOST=elasticsearch
ELASTICSEARCH_PORT=9200

# Temopral
# Temporal
TEMPORAL_IMAGE=temporalio/auto-setup
TEMPORAL_VERSION=1.22.3
TEMPORAL_HOST=temporal
Expand All @@ -138,7 +135,7 @@ INFLUXDB_VERSION=2.7
INFLUXDB_HOST=influxdb
INFLUXDB_PORT=8086

# opengfa
# OpenFGA
OPENFGA_IMAGE=openfga/openfga
OPENFGA_VERSION=v1.5.1
OPENFGA_HOST=openfga
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-test-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ jobs:
# connection creation on `pipeline-backend`.
run: |
if [ "${{ inputs.target }}" == "latest" ]; then
make latest BUILD_CORE_DEV_IMAGE=true EDITION=local-ce:test COMPONENT_ENV=.env.component-test
make latest EDITION=local-ce:test COMPONENT_ENV=.env.component-test
else
make all BUILD_CORE_DEV_IMAGE=true EDITION=local-ce:test COMPONENT_ENV=.env.component-test
make all EDITION=local-ce:test COMPONENT_ENV=.env.component-test
fi
- name: Uppercase component name
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-test-console.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- name: Launch Instill Core (${{ inputs.target }})
run: |
make ${{ inputs.target }} BUILD_CORE_DEV_IMAGE=true EDITION=local-ce:test INSTILL_CORE_HOST=api-gateway
make ${{ inputs.target }} EDITION=local-ce:test INSTILL_CORE_HOST=api-gateway
- name: Run console integration test (${{ inputs.target }})
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/make-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Launch Instill Core (release)
run: |
make all BUILD_CORE_DEV_IMAGE=true EDITION=local-ce:test
make all EDITION=local-ce:test
- name: List all docker containers
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/make-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Launch Instill Core (latest)
run: |
make latest BUILD_CORE_DEV_IMAGE=true EDITION=local-ce:test
make latest EDITION=local-ce:test
- name: List all docker containers
run: |
Expand Down
82 changes: 38 additions & 44 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ COMPONENT_TEST_ENV := .env.component-test
.PHONY: all
all: ## Launch all services with their up-to-date release version
@docker inspect --type=image instill/ray:${RAY_RELEASE_TAG} >/dev/null 2>&1 || printf "\033[1;33mINFO:\033[0m This may take a while due to the enormous size of the Ray server image, but the image pulling process should be just a one-time effort.\n" && sleep 5
@make build-release BUILD=${BUILD}
@if [ ! -f "$$(echo ${SYSTEM_CONFIG_PATH}/user_uid)" ]; then \
mkdir -p ${SYSTEM_CONFIG_PATH} && \
docker run --rm --name uuidgen ${INSTILL_CORE_IMAGE_NAME}:${INSTILL_CORE_VERSION} uuidgen > ${SYSTEM_CONFIG_PATH}/user_uid; \
uuidgen > ${SYSTEM_CONFIG_PATH}/user_uid; \
fi
ifeq (${NVIDIA_GPU_AVAILABLE}, true)
@cat docker-compose-nvidia.yml | yq '.services.ray_server.deploy.resources.reservations.devices[0].device_ids |= (strenv(NVIDIA_VISIBLE_DEVICES) | split(",")) | ..style="double"' | \
Expand All @@ -70,10 +69,9 @@ endif
.PHONY: latest
latest: ## Lunch all dependent services with their latest codebase
@docker inspect --type=image instill/ray:${RAY_LATEST_TAG} >/dev/null 2>&1 || printf "\033[1;33mINFO:\033[0m This may take a while due to the enormous size of the Ray server image, but the image pulling process should be just a one-time effort.\n" && sleep 5
@make build-latest PROFILE=${PROFILE} BUILD=${BUILD}
@if [ ! -f "$$(echo ${SYSTEM_CONFIG_PATH}/user_uid)" ]; then \
mkdir -p ${SYSTEM_CONFIG_PATH} && \
docker run --rm --name uuidgen ${INSTILL_CORE_IMAGE_NAME}:latest uuidgen > ${SYSTEM_CONFIG_PATH}/user_uid; \
uuidgen > ${SYSTEM_CONFIG_PATH}/user_uid; \
fi
ifeq (${NVIDIA_GPU_AVAILABLE}, true)
@cat docker-compose-nvidia.yml | yq '.services.ray_server.deploy.resources.reservations.devices[0].device_ids |= (strenv(NVIDIA_VISIBLE_DEVICES) | split(",")) | ..style="double"' | \
Expand All @@ -86,8 +84,7 @@ endif

.PHONY: build-latest
build-latest: ## Build latest images for all services
@if [ "${BUILD}" = "true" ] || [ "${BUILD_CORE_DEV_IMAGE}" = "true" ]; then \
docker build --progress plain \
@docker build --progress plain \
--build-arg ALPINE_VERSION=${ALPINE_VERSION} \
--build-arg GOLANG_VERSION=${GOLANG_VERSION} \
--build-arg K6_VERSION=${K6_VERSION} \
Expand All @@ -96,10 +93,8 @@ build-latest: ## Build latest images for all services
--build-arg XK6_SQL_POSTGRES_VERSION=${XK6_SQL_POSTGRES_VERSION} \
--build-arg CACHE_DATE="$(shell date)" \
--target latest \
-t ${INSTILL_CORE_IMAGE_NAME}:latest .; \
fi
@if [ "${BUILD}" = "true" ]; then \
docker run --rm \
-t ${INSTILL_CORE_IMAGE_NAME}:latest .
@docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ./.env:/instill-core/.env \
-v ./docker-compose-build.yml:/instill-core/docker-compose-build.yml \
Expand All @@ -113,35 +108,31 @@ build-latest: ## Build latest images for all services
CONSOLE_VERSION=latest \
COMPONENT_ENV=${COMPONENT_ENV} \
COMPOSE_PROFILES=${PROFILE} docker compose -f docker-compose-build.yml build --progress plain \
"; \
fi
"

.PHONY: build-release
build-release: ## Build release images for all services
@if [ "${BUILD}" = "true" ] || [ "${BUILD_CORE_DEV_IMAGE}" = "true" ]; then \
docker build --progress plain \
--build-arg ALPINE_VERSION=${ALPINE_VERSION} \
--build-arg GOLANG_VERSION=${GOLANG_VERSION} \
--build-arg K6_VERSION=${K6_VERSION} \
--build-arg XK6_VERSION=${XK6_VERSION} \
--build-arg XK6_SQL_VERSION=${XK6_SQL_VERSION} \
--build-arg XK6_SQL_POSTGRES_VERSION=${XK6_SQL_POSTGRES_VERSION} \
--build-arg CACHE_DATE="$(shell date)" \
--build-arg API_GATEWAY_VERSION=${API_GATEWAY_VERSION} \
--build-arg MGMT_BACKEND_VERSION=${MGMT_BACKEND_VERSION} \
--build-arg PIPELINE_BACKEND_VERSION=${PIPELINE_BACKEND_VERSION} \
--build-arg MODEL_BACKEND_VERSION=${MODEL_BACKEND_VERSION} \
--build-arg ARTIFACT_BACKEND_VERSION=${ARTIFACT_BACKEND_VERSION} \
--build-arg CONSOLE_VERSION=${CONSOLE_VERSION} \
--target release \
-t ${INSTILL_CORE_IMAGE_NAME}:${INSTILL_CORE_VERSION} .; \
fi
@if [ "${BUILD}" = "true" ]; then \
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ./.env:/instill-core/.env \
-v ./docker-compose-build.yml:/instill-core/docker-compose-build.yml \
--name ${INSTILL_CORE_BUILD_CONTAINER_NAME}-release \
@docker build --progress plain \
--build-arg ALPINE_VERSION=${ALPINE_VERSION} \
--build-arg GOLANG_VERSION=${GOLANG_VERSION} \
--build-arg K6_VERSION=${K6_VERSION} \
--build-arg XK6_VERSION=${XK6_VERSION} \
--build-arg XK6_SQL_VERSION=${XK6_SQL_VERSION} \
--build-arg XK6_SQL_POSTGRES_VERSION=${XK6_SQL_POSTGRES_VERSION} \
--build-arg CACHE_DATE="$(shell date)" \
--build-arg API_GATEWAY_VERSION=${API_GATEWAY_VERSION} \
--build-arg MGMT_BACKEND_VERSION=${MGMT_BACKEND_VERSION} \
--build-arg PIPELINE_BACKEND_VERSION=${PIPELINE_BACKEND_VERSION} \
--build-arg MODEL_BACKEND_VERSION=${MODEL_BACKEND_VERSION} \
--build-arg ARTIFACT_BACKEND_VERSION=${ARTIFACT_BACKEND_VERSION} \
--build-arg CONSOLE_VERSION=${CONSOLE_VERSION} \
--target release \
-t ${INSTILL_CORE_IMAGE_NAME}:${INSTILL_CORE_VERSION} .
@docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ./.env:/instill-core/.env \
-v ./docker-compose-build.yml:/instill-core/docker-compose-build.yml \
--name ${INSTILL_CORE_BUILD_CONTAINER_NAME}-release \
${INSTILL_CORE_IMAGE_NAME}:${INSTILL_CORE_VERSION} /bin/sh -c " \
API_GATEWAY_VERSION=${API_GATEWAY_VERSION} \
MGMT_BACKEND_VERSION=${MGMT_BACKEND_VERSION} \
Expand Down Expand Up @@ -195,7 +186,8 @@ top: ## Display all running service processes

.PHONY: integration-test-latest
integration-test-latest: # Run integration test on the latest VDP
@make latest BUILD=true EDITION=local-ce:test COMPONENT_ENV=${COMPONENT_TEST_ENV}
@make build-latest
@make latest EDITION=local-ce:test COMPONENT_ENV=${COMPONENT_TEST_ENV}
@docker run --rm \
--network instill-network \
--name ${INSTILL_CORE_INTEGRATION_TEST_CONTAINER_NAME}-latest \
Expand All @@ -208,11 +200,13 @@ integration-test-latest: # Run integration test on the latest VDP

.PHONY: integration-test-release
integration-test-release: # Run integration test on the release VDP
@make all BUILD=true EDITION=local-ce:test COMPONENT_ENV=${COMPONENT_TEST_ENV}
@make build-release
@make all EDITION=local-ce:test COMPONENT_ENV=${COMPONENT_TEST_ENV}
@docker run --rm \
--network instill-network \
--name ${INSTILL_CORE_INTEGRATION_TEST_CONTAINER_NAME}-release \
${INSTILL_CORE_IMAGE_NAME}:${INSTILL_CORE_VERSION} /bin/sh -c " \
/bin/sh -c 'sed -i "s/\(\w\+GITHUB\w\+\)=/\1=foo/" .env.component' && \
/bin/sh -c 'cd mgmt-backend && make integration-test API_GATEWAY_URL=${API_GATEWAY_HOST}:${API_GATEWAY_PORT}' && \
/bin/sh -c 'cd pipeline-backend && make integration-test API_GATEWAY_URL=${API_GATEWAY_HOST}:${API_GATEWAY_PORT} DB_HOST=pg-sql' && \
/bin/sh -c 'cd model-backend && make integration-test API_GATEWAY_URL=${API_GATEWAY_HOST}:${API_GATEWAY_PORT}' \
Expand All @@ -221,7 +215,7 @@ integration-test-release: # Run integration test on the release VDP

.PHONY: helm-integration-test-latest
helm-integration-test-latest: # Run integration test on the Helm latest for VDP
@make build-latest BUILD=true COMPONENT_ENV=${COMPONENT_TEST_ENV}
@make build-latest COMPONENT_ENV=${COMPONENT_TEST_ENV}
@helm install ${HELM_RELEASE_NAME} charts/core \
--namespace ${HELM_NAMESPACE} --create-namespace \
--set edition=k8s-ce:test \
Expand Down Expand Up @@ -263,7 +257,7 @@ endif

.PHONY: helm-integration-test-release
helm-integration-test-release: # Run integration test on the Helm release for VDP
@make build-release BUILD=true COMPONENT_ENV=${COMPONENT_TEST_ENV}
@make build-release COMPONENT_ENV=${COMPONENT_TEST_ENV}
@helm install ${HELM_RELEASE_NAME} charts/core \
--namespace ${HELM_NAMESPACE} --create-namespace \
--set edition=k8s-ce:test \
Expand Down Expand Up @@ -305,7 +299,7 @@ endif

.PHONY: console-integration-test-latest
console-integration-test-latest: # Run console integration test on the latest Instill Core
@make latest BUILD=true EDITION=local-ce:test INSTILL_CORE_HOST=${API_GATEWAY_HOST} COMPONENT_ENV=${COMPONENT_TEST_ENV}
@make latest EDITION=local-ce:test INSTILL_CORE_HOST=${API_GATEWAY_HOST} COMPONENT_ENV=${COMPONENT_TEST_ENV}
@docker run --rm \
-e NEXT_PUBLIC_GENERAL_API_VERSION=v1beta \
-e NEXT_PUBLIC_MODEL_API_VERSION=v1alpha \
Expand All @@ -323,7 +317,7 @@ console-integration-test-latest: # Run console integration test on the latest

.PHONY: console-integration-test-release
console-integration-test-release: # Run console integration test on the release Instill Core
@make all BUILD=true EDITION=local-ce:test INSTILL_CORE_HOST=${API_GATEWAY_HOST} COMPONENT_ENV=${COMPONENT_TEST_ENV}
@make all EDITION=local-ce:test INSTILL_CORE_HOST=${API_GATEWAY_HOST} COMPONENT_ENV=${COMPONENT_TEST_ENV}
@docker run --rm \
-e NEXT_PUBLIC_GENERAL_API_VERSION=v1beta \
-e NEXT_PUBLIC_MODEL_API_VERSION=v1alpha \
Expand All @@ -341,7 +335,7 @@ console-integration-test-release: # Run console integration test on the releas

.PHONY: console-helm-integration-test-latest
console-helm-integration-test-latest: # Run console integration test on the Helm latest for Instill Core
@make build-latest BUILD=true COMPONENT_ENV=${COMPONENT_TEST_ENV}
@make build-latest COMPONENT_ENV=${COMPONENT_TEST_ENV}
ifeq ($(UNAME_S),Darwin)
@helm install ${HELM_RELEASE_NAME} charts/core --namespace ${HELM_NAMESPACE} --create-namespace \
--set edition=k8s-ce:test \
Expand Down Expand Up @@ -421,7 +415,7 @@ endif

.PHONY: console-helm-integration-test-release
console-helm-integration-test-release: # Run console integration test on the Helm release for Instill Core
@make build-release BUILD=true COMPONENT_ENV=${COMPONENT_TEST_ENV}
@make build-release COMPONENT_ENV=${COMPONENT_TEST_ENV}
ifeq ($(UNAME_S),Darwin)
@helm install ${HELM_RELEASE_NAME} charts/core --namespace ${HELM_NAMESPACE} --create-namespace \
--set edition=k8s-ce:test \
Expand Down

0 comments on commit 91b18fc

Please sign in to comment.