Skip to content

Commit

Permalink
Add provision in odh-sync workflow to adjust Pipfile.cpu and Pipfile.…
Browse files Browse the repository at this point in the history
…gpu with codeflare-sdk release version
  • Loading branch information
abhijeet-dhumal committed Aug 20, 2024
1 parent de2bd73 commit e0e3361
Showing 1 changed file with 34 additions and 15 deletions.
49 changes: 34 additions & 15 deletions .github/workflows/odh-notebooks-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit e0e3361

Please sign in to comment.