Skip to content

Commit cc1ea04

Browse files
Add provision in odh-sync workflow to adjust Pipfile.cpu and Pipfile.gpu with codeflare-sdk release version
1 parent de2bd73 commit cc1ea04

File tree

1 file changed

+39
-16
lines changed

1 file changed

+39
-16
lines changed

.github/workflows/odh-notebooks-sync.yml

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,23 @@ jobs:
5353
- name: Update Pipfiles in accordance with Codeflare-SDK latest release
5454
run: |
5555
package_name=codeflare-sdk
56+
available_python_versions=("3.9") # add space separated python versions according to 'python-versions' specified in 'Setup Python Environment' step
57+
install_package_using_pipenv(){
58+
if ! pipenv install ${package_name}~="${CODEFLARE_RELEASE_VERSION}"; then
59+
echo "Failed to install ${package_name} with version ${CODEFLARE_RELEASE_VERSION} in $dir"
60+
exit 1
61+
fi
62+
# Lock dependencies, ensuring pre-release are included and clear previous state
63+
if ! pipenv lock --pre --clear ; then
64+
echo "Failed to lock dependencies"
65+
exit 1
66+
fi
67+
# remove virtual env and clear cache
68+
if ! pipenv --rm --clear ; then
69+
echo "Failed to remove virtual environment"
70+
exit 1
71+
fi
72+
}
5673
# Get the list of available versions for the package
5774
if ! versions=$(pipenv run pip-versions list $package_name);then
5875
echo "Failed to retrieve versions for $package_name"
@@ -74,7 +91,7 @@ jobs:
7491
#Check if current_dir is not in exclude_directories list
7592
if [[ ! "${exclude_directories[@]}" =~ "$current_dir" ]]; then
7693
#Check if Pipfile exists in current_dir
77-
if [ -f "$current_dir/Pipfile" ];then
94+
if ls "$current_dir"/Pipfile* 1> /dev/null 2>&1;then
7895
directories+=("$current_dir")
7996
fi
8097
fi
@@ -98,21 +115,27 @@ jobs:
98115
pipfile_python_version=$(grep -E '^python_version' ./Pipfile | cut -d '"' -f 2) # extracted from pipfile
99116
pipfile_python_version_major=$(echo "$pipfile_python_version" | awk -F '.' '{print $1}')
100117
pipfile_python_version_minor=$(echo "$pipfile_python_version" | awk -F '.' '{print $2}')
101-
if [[ "pipfile_python_version_major" -ge "$minimum_supported_python_version_major" && "pipfile_python_version_minor" -ge "$minimum_supported_python_version_minor" ]]; then
102-
#install specified package
103-
if ! pipenv install ${package_name}~="${CODEFLARE_RELEASE_VERSION}"; then
104-
echo "Failed to install ${package_name} with version ${CODEFLARE_RELEASE_VERSION} in $dir"
105-
exit 1
106-
fi
107-
# Lock dependencies, ensuring pre-release are included and clear previous state
108-
if ! pipenv lock --pre --clear ; then
109-
echo "Failed to lock dependencies"
110-
exit 1
111-
fi
112-
# remove virtual env and clear cache
113-
if ! pipenv --rm --clear ; then
114-
echo "Failed to remove virtual environment"
115-
exit 1
118+
if [[ " ${available_python_versions[@]} " =~ " ${pipfile_python_version} " && "$pipfile_python_version_major" -ge "$minimum_supported_python_version_major" && "$pipfile_python_version_minor" -ge "$minimum_supported_python_version_minor" ]]; then
119+
if ! [ -f "Pipfile" ]; then
120+
if [ -f "Pipfile.cpu" ]; then
121+
mv Pipfile.cpu Pipfile
122+
mv Pipfile.lock.cpu Pipfile.lock
123+
#install specified package
124+
install_package_using_pipenv
125+
mv Pipfile.lock Pipfile.lock.cpu
126+
mv Pipfile Pipfile.cpu
127+
fi
128+
if [ -f "Pipfile.gpu" ]; then
129+
mv Pipfile.gpu Pipfile
130+
mv Pipfile.lock.gpu Pipfile.lock
131+
#install specified package
132+
install_package_using_pipenv
133+
mv Pipfile.lock Pipfile.lock.gpu
134+
mv Pipfile Pipfile.gpu
135+
fi
136+
else
137+
#install specified package
138+
install_package_using_pipenv
116139
fi
117140
else
118141
echo "Skipped installation of ${package_name} with version ${CODEFLARE_RELEASE_VERSION} in $dir"

0 commit comments

Comments
 (0)