-
Notifications
You must be signed in to change notification settings - Fork 20
fix(e2e): fix local minikube scripts and switch CLI health checks to /status #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2974474
5925d1f
f9faa85
1b9377b
5f006a4
d7c7fb5
0d57e9d
556df03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,61 +1,65 @@ | ||
| #!/usr/bin/env bash | ||
| # Build Docker images locally and deploy to minikube via Helm. | ||
| # | ||
| # This script handles the build step, then delegates the Helm install to | ||
| # install_helm_e2e.sh so install logic lives in one place. | ||
| # | ||
| # Environment variables: | ||
| # MINIKUBE_PROFILE - minikube profile name (default: minikube) | ||
| # NMP_REGISTRY - image registry (default: docker.io/my-registry) | ||
| # IMAGE_TAG - image tag (default: local-<epoch>) | ||
| # BUILD_ARCH - target platform (default: auto-detected from host) | ||
| # HELM_VALUES - values file (default: e2e/k8s/values/minikube.yaml) | ||
|
|
||
| set -e | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| REPO_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)" | ||
|
|
||
| MINIKUBE_PROFILE="${MINIKUBE_PROFILE:-minikube}" | ||
|
|
||
| # Check if minikube is running | ||
| if ! minikube status &>/dev/null; then | ||
| echo "Minikube is not running. Starting minikube..." | ||
| # Use the setup_local_minikube_gpu.sh script to start minikube, | ||
| # and ensure the script is in the same directory as this script. | ||
|
|
||
| "$SCRIPT_DIR/setup_local_minikube_gpu.sh" | ||
| if ! minikube status -p "${MINIKUBE_PROFILE}" &>/dev/null; then | ||
| echo "Minikube profile ${MINIKUBE_PROFILE} is not running. Starting..." | ||
| MINIKUBE_PROFILE="${MINIKUBE_PROFILE}" "$SCRIPT_DIR/setup_local_minikube_cpu.sh" | ||
| fi | ||
|
|
||
| # Wait for minikube to be ready | ||
| minikube status | ||
| minikube status -p "${MINIKUBE_PROFILE}" | ||
|
|
||
| # Build the images with a local tag and then load them | ||
| # Use epoch seconds (date +%s) so each run gets a unique tag and upgrades pick up new images | ||
| # Use epoch seconds so each run gets a unique tag and upgrades pick up new images | ||
| IMAGE_TAG="${IMAGE_TAG:-local-$(date +%s)}" | ||
|
|
||
| # Detect platform for build (match host arch) | ||
| BUILD_ARCH="${BUILD_ARCH:-linux/$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')}" | ||
| GIT_SHA=$(git -C "${REPO_ROOT}" rev-parse HEAD) | ||
|
|
||
| NMP_REGISTRY="${NMP_REGISTRY:-docker.io/my-registry}" | ||
|
|
||
| echo "Building docker-cpu images with tag $IMAGE_TAG (platform=$BUILD_ARCH)..." | ||
|
|
||
| # Allow building directly into minikube's docker daemon | ||
| eval "$(minikube docker-env)" | ||
| # Build directly into minikube's docker daemon | ||
| eval "$(minikube -p "${MINIKUBE_PROFILE}" docker-env)" | ||
|
|
||
| # Set the image tag to the git sha | ||
| ( | ||
| cd "${REPO_ROOT}" | ||
| CI_COMMIT_SHA="$GIT_SHA" \ | ||
| BAKE_TAG="$IMAGE_TAG" \ | ||
| IMAGE_REGISTRY="docker.io/my-registry" \ | ||
| IMAGE_REGISTRY="${NMP_REGISTRY}" \ | ||
| BUILD_ARCH="$BUILD_ARCH" \ | ||
| docker buildx bake docker-cpu --set "*.platform=$BUILD_ARCH" | ||
| ) | ||
|
|
||
|
|
||
| # Echo the image tags and an example script to run end-to-end tests | ||
| echo "Image tags:" | ||
| echo " nmp-api: $IMAGE_TAG" | ||
| echo " nmp-cpu-tasks: $IMAGE_TAG" | ||
| echo " platform: $IMAGE_TAG" | ||
| echo "----------------------------------------" | ||
| echo "Example script to run end-to-end jobs tests:" | ||
| echo " NMP_E2E_INTERNAL_HOST=nemo-platform-api:8080 NMP_E2E_REGISTRY=docker.io/my-registry NMP_E2E_TAG=$IMAGE_TAG uv run pytest e2e --kubernetes --cluster-url=http://localhost:80" | ||
| echo "----------------------------------------" | ||
| echo "To rerun the helm install/upgrade, run:" | ||
| echo " helm upgrade --install nemo-platform k8s/helm/ -f e2e/k8s/values/local.yaml --set \"api.image.tag=$IMAGE_TAG\" --set \"core.image.tag=$IMAGE_TAG\" --set \"platformConfig.platform.image_tag=$IMAGE_TAG\"" | ||
| echo "Images built with tag: $IMAGE_TAG" | ||
| echo "----------------------------------------" | ||
|
|
||
| # Install/upgrade the helm chart with image tags | ||
| helm upgrade --install nemo-platform k8s/helm/ \ | ||
| -f e2e/k8s/values/local.yaml \ | ||
| --set "api.image.tag=$IMAGE_TAG" \ | ||
| --set "core.image.tag=$IMAGE_TAG" \ | ||
| --set "platformConfig.platform.image_tag=$IMAGE_TAG" | ||
| # Delegate helm install to install_helm_e2e.sh | ||
| export HELM_VALUES="${HELM_VALUES:-${REPO_ROOT}/e2e/k8s/values/minikube.yaml}" | ||
| export NMP_E2E_REGISTRY="${NMP_REGISTRY}" | ||
| export NMP_E2E_TAG="${IMAGE_TAG}" | ||
| export NMP_E2E_PULL_POLICY="Never" | ||
| export MINIKUBE_PROFILE | ||
| export REQUIRE_NMP_E2E_IMAGES=true | ||
|
|
||
| exec "$SCRIPT_DIR/install_helm_e2e.sh" | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.