Skip to content

Commit 4400efd

Browse files
authored
Add "local build" mode to running the e2e over kind (#219)
* Allow the e2e to use the current code as the base for version to be tested by the e2e
1 parent 0450532 commit 4400efd

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

hack/run-e2e-kind.sh

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,33 @@ KIND_CONFIG=${REPO_ROOT}/hack/e2e-kind-config.yaml
1010
GOPATH=${HOME}/go
1111
GOBIN=${GOPATH}/bin
1212

13-
TEST_THIRD_PARTY_INTEGRATIONS=${1}
14-
if [ -z "$TEST_THIRD_PARTY_INTEGRATIONS" ]; then
15-
echo "TEST_THIRD_PARTY_INTEGRATIONS argument isn't provided, defaulting to false"
16-
TEST_THIRD_PARTY_INTEGRATIONS="false"
17-
fi
13+
# Parse named parameters
14+
TEST_THIRD_PARTY_INTEGRATIONS="false"
15+
LOCAL_IMAGES_BUILD="false"
16+
17+
while [[ $# -gt 0 ]]; do
18+
case $1 in
19+
--test-third-party-integrations)
20+
TEST_THIRD_PARTY_INTEGRATIONS="true"
21+
shift
22+
;;
23+
--local-images-build)
24+
LOCAL_IMAGES_BUILD="true"
25+
shift
26+
;;
27+
-h|--help)
28+
echo "Usage: $0 [--test-third-party-integrations] [--local-images-build]"
29+
echo " --test-third-party-integrations: Install third party operators for compatibility testing"
30+
echo " --local-images-build: Build and use local images instead of pulling from registry"
31+
exit 0
32+
;;
33+
*)
34+
echo "Unknown option $1"
35+
echo "Use --help for usage information"
36+
exit 1
37+
;;
38+
esac
39+
done
1840

1941
kind create cluster --config ${KIND_CONFIG} --name $CLUSTER_NAME
2042

@@ -28,8 +50,21 @@ if [ "$TEST_THIRD_PARTY_INTEGRATIONS" = "true" ]; then
2850
${REPO_ROOT}/hack/third_party_integrations/deploy_knative.sh
2951
fi
3052

31-
PACKAGE_VERSION=0.0.0-$(git rev-parse --short origin/main)
32-
helm upgrade -i kai-scheduler oci://ghcr.io/nvidia/kai-scheduler/kai-scheduler -n kai-scheduler --create-namespace --set "global.gpuSharing=true" --version "$PACKAGE_VERSION"
53+
if [ "$LOCAL_IMAGES_BUILD" = "true" ]; then
54+
cd ${REPO_ROOT}
55+
PACKAGE_VERSION=0.0.0-$(git rev-parse --short HEAD)
56+
make build VERSION=$PACKAGE_VERSION
57+
for image in $(docker images --format '{{.Repository}}:{{.Tag}}' | grep $PACKAGE_VERSION); do
58+
kind load docker-image $image --name $CLUSTER_NAME
59+
done
60+
helm package ./deployments/kai-scheduler -d ./charts --app-version $PACKAGE_VERSION --version $PACKAGE_VERSION
61+
helm upgrade -i kai-scheduler ./charts/kai-scheduler-$PACKAGE_VERSION.tgz -n kai-scheduler --create-namespace --set "global.gpuSharing=true" --wait
62+
rm -rf ./charts/kai-scheduler-$PACKAGE_VERSION.tgz
63+
cd ${REPO_ROOT}/hack
64+
else
65+
PACKAGE_VERSION=0.0.0-$(git rev-parse --short origin/main)
66+
helm upgrade -i kai-scheduler oci://ghcr.io/nvidia/kai-scheduler/kai-scheduler -n kai-scheduler --create-namespace --set "global.gpuSharing=true" --version "$PACKAGE_VERSION"
67+
fi
3368

3469
# Allow all the pods in the fake-gpu-operator and kai-scheduler to start
3570
sleep 30

0 commit comments

Comments
 (0)