@@ -28,13 +28,15 @@ BUILD_DEPENDENT_IMAGES ?= yes
2828PUSH_IMAGES ?= yes
2929
3030# OS dependant: Generate date, select appropriate cmd to locate container engine
31- ifeq ($(OS ) , Windows_NT)
32- DATE ?= $(shell powershell -Command "Get-Date -Format 'yyyyMMdd'")
33- WHERE_WHICH ?= where
34- else
35- DATE ?= $(shell date +'%Y%m%d')
36- WHERE_WHICH ?= which
31+ ifdef OS
32+ ifeq ($(OS), Windows_NT)
33+ DATE ?= $(shell powershell -Command "Get-Date -Format 'yyyyMMdd'")
34+ WHERE_WHICH ?= where
35+ endif
3736endif
37+ DATE ?= $(shell date +'% Y% m% d')
38+ WHERE_WHICH ?= which
39+
3840
3941# linux/amd64 or darwin/arm64
4042OS_ARCH =$(shell go env GOOS) /$(shell go env GOARCH)
@@ -186,41 +188,6 @@ runtime-cuda-tensorflow-ubi9-python-3.11: cuda-ubi9-python-3.11
186188codeserver-ubi9-python-3.11 : base-ubi9-python-3.11
187189 $(call image,$@ ,codeserver/ubi9-python-3.11,$< )
188190
189- # Build and push base-anaconda-python-3.11-intel-gpu image to the registry
190- .PHONY : intel-base-gpu-ubi9-python-3.11
191- intel-base-gpu-ubi9-python-3.11 : base-ubi9-python-3.11
192- $(call image,$@ ,intel/base/gpu/ubi9-python-3.11,$< )
193-
194- # Build and push intel-runtime-tensorflow-ubi9-python-3.11 image to the registry
195- .PHONY : intel-runtime-tensorflow-ubi9-python-3.11
196- intel-runtime-tensorflow-ubi9-python-3.11 : intel-base-gpu-ubi9-python-3.11
197- $(call image,$@ ,intel/runtimes/tensorflow/ubi9-python-3.11,$< )
198-
199- # Build and push jupyter-intel-tensorflow-ubi9-python-3.11 image to the registry
200- .PHONY : jupyter-intel-tensorflow-ubi9-python-3.11
201- jupyter-intel-tensorflow-ubi9-python-3.11 : intel-base-gpu-ubi9-python-3.11
202- $(call image,$@ ,jupyter/intel/tensorflow/ubi9-python-3.11,$< )
203-
204- # Build and push intel-runtime-pytorch-ubi9-python-3.11 image to the registry
205- .PHONY : intel-runtime-pytorch-ubi9-python-3.11
206- intel-runtime-pytorch-ubi9-python-3.11 : intel-base-gpu-ubi9-python-3.11
207- $(call image,$@ ,intel/runtimes/pytorch/ubi9-python-3.11,$< )
208-
209- # Build and push jupyter-intel-pytorch-ubi9-python-3.11 image to the registry
210- .PHONY : jupyter-intel-pytorch-ubi9-python-3.11
211- jupyter-intel-pytorch-ubi9-python-3.11 : intel-base-gpu-ubi9-python-3.11
212- $(call image,$@ ,jupyter/intel/pytorch/ubi9-python-3.11,$< )
213-
214- # Build and push intel-runtime-ml-ubi9-python-3.11 image to the registry
215- .PHONY : intel-runtime-ml-ubi9-python-3.11
216- intel-runtime-ml-ubi9-python-3.11 : base-ubi9-python-3.11
217- $(call image,$@ ,intel/runtimes/ml/ubi9-python-3.11,$< )
218-
219- # Build and push jupyter-intel-ml-ubi9-python-3.11 image to the registry
220- .PHONY : jupyter-intel-ml-ubi9-python-3.11
221- jupyter-intel-ml-ubi9-python-3.11 : base-ubi9-python-3.11
222- $(call image,$@ ,jupyter/intel/ml/ubi9-python-3.11,$< )
223-
224191# ###################################### Buildchain for Python 3.11 using C9S #######################################
225192
226193# Build and push base-c9s-python-3.11 image to the registry
@@ -340,64 +307,11 @@ undeploy-c9s-%: bin/kubectl
340307 $(info # Undeploying notebook from $(NOTEBOOK_DIR ) directory...)
341308 $(KUBECTL_BIN ) delete -k $(NOTEBOOK_DIR )
342309
343- # Function for testing a notebook with papermill
344- # ARG 1: Notebook name
345- # ARG 1: UBI flavor
346- # ARG 1: Python kernel
347- define test_with_papermill
348- $(eval PREFIX_NAME := $(subst /,-,$(1 ) _$(2 ) ) )
349- $(KUBECTL_BIN ) exec $(FULL_NOTEBOOK_NAME ) -- /bin/sh -c "python3 -m pip install papermill"
350- if ! $(KUBECTL_BIN ) exec $(FULL_NOTEBOOK_NAME ) -- /bin/sh -c "wget ${NOTEBOOK_REPO_BRANCH_BASE}/jupyter/$(1 ) /$(2 ) -$(3 ) /test/test_notebook.ipynb -O test_notebook.ipynb && python3 -m papermill test_notebook.ipynb $(PREFIX_NAME ) _output.ipynb --kernel python3 --stderr-file $(PREFIX_NAME ) _error.txt" ; then
351- echo "ERROR: The $(1 ) $(2 ) notebook encountered a failure. To investigate the issue, you can review the logs located in the ocp-ci cluster on 'artifacts/notebooks-e2e-tests/jupyter-$(1 ) -$(2 ) -$(3 ) -test-e2e' directory or run 'cat $(PREFIX_NAME ) _error.txt' within your container. The make process has been aborted."
352- exit 1
353- fi
354- if $(KUBECTL_BIN ) exec $(FULL_NOTEBOOK_NAME ) -- /bin/sh -c "cat $(PREFIX_NAME ) _error.txt | grep --quiet FAILED" ; then
355- echo "ERROR: The $(1 ) $(2 ) notebook encountered a failure. The make process has been aborted."
356- $(KUBECTL_BIN ) exec $(FULL_NOTEBOOK_NAME ) -- /bin/sh -c "cat $(PREFIX_NAME ) _error.txt"
357- exit 1
358- fi
359- endef
360-
361310# Verify the notebook's readiness by pinging the /api endpoint and executing the corresponding test_notebook.ipynb file in accordance with the build chain logic.
362311.PHONY : test
363312test-% : bin/kubectl
364- # Verify the notebook's readiness by pinging the /api endpoint
365- $(eval NOTEBOOK_NAME := $(subst .,-,$(subst cuda-,,$* ) ) )
366- $(eval PYTHON_VERSION := $(shell echo $* | sed 's/.* -python-//') )
367- $(info # Running tests for $(NOTEBOOK_NAME ) notebook...)
368- $(KUBECTL_BIN ) wait --for=condition=ready pod -l app=$(NOTEBOOK_NAME ) --timeout=600s
369- $(KUBECTL_BIN ) port-forward svc/$(NOTEBOOK_NAME ) -notebook 8888:8888 & curl --retry 5 --retry-delay 5 --retry-connrefused http://localhost:8888/notebook/opendatahub/jovyan/api ; EXIT_CODE=$$? ; echo && pkill --full " ^$( KUBECTL_BIN) .*port-forward.*"
370- $(eval FULL_NOTEBOOK_NAME = $(shell ($(KUBECTL_BIN ) get pods -l app=$(NOTEBOOK_NAME ) -o custom-columns=":metadata.name" | tr -d '\n') ) )
371-
372- # Tests notebook's functionalities
373- if echo "$(FULL_NOTEBOOK_NAME)" | grep -q "minimal-ubi9"; then
374- $(call test_with_papermill,minimal,ubi9,python-$(PYTHON_VERSION))
375- elif echo "$(FULL_NOTEBOOK_NAME)" | grep -q "intel-tensorflow-ubi9"; then
376- $(call test_with_papermill,intel/tensorflow,ubi9,python-$(PYTHON_VERSION))
377- elif echo "$(FULL_NOTEBOOK_NAME)" | grep -q "intel-pytorch-ubi9"; then
378- $(call test_with_papermill,intel/pytorch,ubi9,python-$(PYTHON_VERSION))
379- elif echo "$(FULL_NOTEBOOK_NAME)" | grep -q "datascience-ubi9"; then
380- $(MAKE) validate-ubi9-datascience PYTHON_VERSION=$(PYTHON_VERSION) -e FULL_NOTEBOOK_NAME=$(FULL_NOTEBOOK_NAME)
381- elif echo "$(FULL_NOTEBOOK_NAME)" | grep -q "pytorch-ubi9"; then
382- $(MAKE) validate-ubi9-datascience PYTHON_VERSION=$(PYTHON_VERSION) -e FULL_NOTEBOOK_NAME=$(FULL_NOTEBOOK_NAME)
383- $(call test_with_papermill,pytorch,ubi9,python-$(PYTHON_VERSION))
384- elif echo "$(FULL_NOTEBOOK_NAME)" | grep -q "tensorflow-ubi9"; then
385- $(MAKE) validate-ubi9-datascience PYTHON_VERSION=$(PYTHON_VERSION) -e FULL_NOTEBOOK_NAME=$(FULL_NOTEBOOK_NAME)
386- $(call test_with_papermill,tensorflow,ubi9,python-$(PYTHON_VERSION))
387- elif echo "$(FULL_NOTEBOOK_NAME)" | grep -q "intel-ml-ubi9"; then
388- $(call test_with_papermill,intel/ml,ubi9,python-$(PYTHON_VERSION))
389- elif echo "$(FULL_NOTEBOOK_NAME)" | grep -q "trustyai-ubi9"; then
390- $(call test_with_papermill,trustyai,ubi9,python-$(PYTHON_VERSION))
391- elif echo "$(FULL_NOTEBOOK_NAME)" | grep -q "anaconda"; then
392- echo "There is no test notebook implemented yet for Anaconda Notebook...."
393- else
394- echo "No matching condition found for $(FULL_NOTEBOOK_NAME)."
395- fi
396-
397- .PHONY : validate-ubi9-datascience
398- validate-ubi9-datascience :
399- $(call test_with_papermill,minimal,ubi9,python-$(PYTHON_VERSION ) )
400- $(call test_with_papermill,datascience,ubi9,python-$(PYTHON_VERSION ) )
313+ $(info # Running tests for $* notebook...)
314+ @./scripts/test_jupyter_with_papermill.sh $*
401315
402316# Validate that runtime image meets minimum criteria
403317# This validation is created from subset of https://github.com/elyra-ai/elyra/blob/9c417d2adc9d9f972de5f98fd37f6945e0357ab9/Makefile#L325
@@ -520,12 +434,7 @@ BASE_DIRS := base/c9s-python-$(PYTHON_VERSION) \
520434# Default value is false, can be overiden
521435# The below directories are not supported on tier-1
522436INCLUDE_OPT_DIRS ?= false
523- OPT_DIRS := jupyter/intel/ml/ubi9-python-$(PYTHON_VERSION ) \
524- jupyter/intel/pytorch/ubi9-python-$(PYTHON_VERSION ) \
525- jupyter/intel/tensorflow/ubi9-python-$(PYTHON_VERSION ) \
526- intel/runtimes/ml/ubi9-python-$(PYTHON_VERSION ) \
527- intel/runtimes/pytorch/ubi9-python-$(PYTHON_VERSION ) \
528- intel/runtimes/tensorflow/ubi9-python-$(PYTHON_VERSION )
437+ OPT_DIRS :=
529438
530439# This recipe gets args, can be used like
531440# make refresh-pipfilelock-files PYTHON_VERSION=3.11 INCLUDE_OPT_DIRS=false
@@ -554,6 +463,11 @@ refresh-pipfilelock-files:
554463 fi
555464 done
556465
466+ echo "Regenerating requirements.txt files"
467+ pushd $(ROOT_DIR)
468+ bash $(ROOT_DIR)/scripts/sync-requirements-txt.sh
469+ popd
470+
557471# This is only for the workflow action
558472# For running manually, set the required environment variables
559473.PHONY : scan-image-vulnerabilities
0 commit comments