]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
scripts: Add ability to install a different pip version 1556/head
authorDavid Galloway <dgallowa@redhat.com>
Tue, 21 Apr 2020 19:00:49 +0000 (15:00 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Tue, 21 Apr 2020 19:00:49 +0000 (15:00 -0400)
@guits was seeing an issue in ceph-ansible jobs with pip 10.0.0.  This commit will allow individual jobs to specify "latest" or "pip==X.X.X" or "pip<20.0.0" as a second parameter to the `install_python_packages` functions.  The default behavior is still no second parameter and pip=10.0.0 will still be installed until we're ready to unpin that.

Signed-off-by: David Galloway <dgallowa@redhat.com>
scripts/build_utils.sh

index cddb693bf9989df2cca9bc7f5a10f60bd07f10de..b1dded498a8d099cdd8010da784ff352c3dc5aa1 100644 (file)
@@ -107,10 +107,20 @@ install_python_packages_no_binary () {
     # the virtualenv exists it will get re-used since this function can be used
     # along with install_python_packages
     #
-    # Usage:
+    # Usage (with pip 10.0.0 [the default]):
     #
     #   to_install=( "ansible" "chacractl>=0.0.4" )
     #   install_python_packages_no_binary "to_install[@]"
+    #
+    # Usage (with pip<X.X.X [can also do ==X.X.X or !=X.X.X]):
+    #
+    #   to_install=( "ansible" "chacractl>=0.0.4" )
+    #   install_python_packages_no_binary "to_install[@]" "pip<X.X.X"
+    #
+    # Usage (with latest pip):
+    #
+    #   to_install=( "ansible" "chacractl>=0.0.4" )
+    #   install_python_packages_no_binary "to_install[@]" latest
 
     create_virtualenv $TEMPVENV
 
@@ -118,7 +128,21 @@ install_python_packages_no_binary () {
     PIP_SDIST_INDEX="$HOME/.cache/pip"
     mkdir -p $PIP_SDIST_INDEX
 
-    $VENV/pip install "pip==10.0.0"
+    # We started pinning pip to 10.0.0 as the default to prevent mismatching
+    # versions on non-ephemeral slaves.  Some jobs require different or latest
+    # pip though so these if statements allow for that.
+    if [ "$2" == "latest" ]; then
+        echo "Ensuring latest pip is installed"
+        $VENV/pip install -U pip
+    elif [[ -n $2 && "$2" != "latest" ]]; then
+        echo "Installing $2"
+        $VENV/pip install "$2"
+    else
+        # This is the default for most jobs.
+        # See ff01d2c5 and fea10f52
+        echo "Installing pip 10.0.0"
+        $VENV/pip install "pip==10.0.0"
+    fi
 
     echo "Updating setuptools"
     pip_download setuptools
@@ -138,10 +162,20 @@ install_python_packages () {
     # Use this function to create a virtualenv and install
     # python packages. Pass a list of package names.
     #
-    # Usage:
+    # Usage (with pip 10.0.0 [the default]):
     #
     #   to_install=( "ansible" "chacractl>=0.0.4" )
     #   install_python_packages "to_install[@]"
+    #
+    # Usage (with pip<X.X.X [can also do ==X.X.X or !=X.X.X]):
+    #
+    #   to_install=( "ansible" "chacractl>=0.0.4" )
+    #   install_python_packages_no_binary "to_install[@]" "pip<X.X.X"
+    #
+    # Usage (with latest pip):
+    #
+    #   to_install=( "ansible" "chacractl>=0.0.4" )
+    #   install_python_packages "to_install[@]" latest
 
     create_virtualenv $TEMPVENV
 
@@ -149,7 +183,21 @@ install_python_packages () {
     PIP_SDIST_INDEX="$HOME/.cache/pip"
     mkdir -p $PIP_SDIST_INDEX
 
-    $VENV/pip install "pip==10.0.0"
+    # We started pinning pip to 10.0.0 as the default to prevent mismatching
+    # versions on non-ephemeral slaves.  Some jobs require different or latest
+    # pip though so these if statements allow for that.
+    if [ "$2" == "latest" ]; then
+        echo "Ensuring latest pip is installed"
+        $VENV/pip install -U pip
+    elif [[ -n $2 && "$2" != "latest" ]]; then
+        echo "Installing $2"
+        $VENV/pip install "$2"
+    else
+        # This is the default for most jobs.
+        # See ff01d2c5 and fea10f52
+        echo "Installing pip 10.0.0"
+        $VENV/pip install "pip==10.0.0"
+    fi
 
     echo "Updating setuptools"
     pip_download setuptools