diff --git a/.github/workflows/odh-notebooks-sync.yml b/.github/workflows/odh-notebooks-sync.yml index 9ce1858fe..bffd2b793 100644 --- a/.github/workflows/odh-notebooks-sync.yml +++ b/.github/workflows/odh-notebooks-sync.yml @@ -53,6 +53,22 @@ jobs: - name: Update Pipfiles in accordance with Codeflare-SDK latest release run: | package_name=codeflare-sdk + install_package_using_pipenv(){ + if ! pipenv install ${package_name}~="${CODEFLARE_RELEASE_VERSION}"; then + echo "Failed to install ${package_name} with version ${CODEFLARE_RELEASE_VERSION} in $dir" + exit 1 + fi + # Lock dependencies, ensuring pre-release are included and clear previous state + if ! pipenv lock --pre --clear ; then + echo "Failed to lock dependencies" + exit 1 + fi + # remove virtual env and clear cache + if ! pipenv --rm --clear ; then + echo "Failed to remove virtual environment" + exit 1 + fi + } # Get the list of available versions for the package if ! versions=$(pipenv run pip-versions list $package_name);then echo "Failed to retrieve versions for $package_name" @@ -74,7 +90,7 @@ jobs: #Check if current_dir is not in exclude_directories list if [[ ! "${exclude_directories[@]}" =~ "$current_dir" ]]; then #Check if Pipfile exists in current_dir - if [ -f "$current_dir/Pipfile" ];then + if ls "$current_dir"/Pipfile* 1> /dev/null 2>&1;then directories+=("$current_dir") fi fi @@ -99,20 +115,23 @@ jobs: pipfile_python_version_major=$(echo "$pipfile_python_version" | awk -F '.' '{print $1}') pipfile_python_version_minor=$(echo "$pipfile_python_version" | awk -F '.' '{print $2}') if [[ "pipfile_python_version_major" -ge "$minimum_supported_python_version_major" && "pipfile_python_version_minor" -ge "$minimum_supported_python_version_minor" ]]; then - #install specified package - if ! pipenv install ${package_name}~="${CODEFLARE_RELEASE_VERSION}"; then - echo "Failed to install ${package_name} with version ${CODEFLARE_RELEASE_VERSION} in $dir" - exit 1 - fi - # Lock dependencies, ensuring pre-release are included and clear previous state - if ! pipenv lock --pre --clear ; then - echo "Failed to lock dependencies" - exit 1 - fi - # remove virtual env and clear cache - if ! pipenv --rm --clear ; then - echo "Failed to remove virtual environment" - exit 1 + if ! [ -f "Pipfile" ]; then + if [ -f "Pipfile.cpu" ]; then + mv Pipfile.cpu Pipfile + mv Pipfile.lock.cpu Pipfile.lock + #install specified package + install_package_using_pipenv + mv Pipfile.lock Pipfile.lock.cpu + mv Pipfile Pipfile.cpu + fi + if [ -f "Pipfile.gpu" ]; then + mv Pipfile.gpu Pipfile + mv Pipfile.lock.gpu Pipfile.lock + #install specified package + install_package_using_pipenv + mv Pipfile.lock Pipfile.lock.gpu + mv Pipfile Pipfile.gpu + fi fi else echo "Skipped installation of ${package_name} with version ${CODEFLARE_RELEASE_VERSION} in $dir"