Support CentOS 7 in GoogleStorage Gitlab template 25/73025/1
authorTrevor Bramwell <tbramwell@linuxfoundation.org>
Fri, 19 Nov 2021 18:18:09 +0000 (10:18 -0800)
committerTrevor Bramwell <tbramwell@linuxfoundation.org>
Fri, 19 Nov 2021 18:21:33 +0000 (10:21 -0800)
Add a check for `dnf` to the GoogleStorage gitlab-ci template, falling
back to `yum` if the command is not available. This should allow the job
to work on both CentOS 7 and 8.

Change-Id: I0964c23d799bb394bc331bd740a0d6a1cba74082
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
gitlab-templates/GoogleStorage.gitlab-ci.yml

index be941a8..4ddf313 100644 (file)
@@ -24,7 +24,12 @@ variables:
 
 .gsutil-install: &gsutil-install
   script:
 
 .gsutil-install: &gsutil-install
   script:
-    - dnf -y install python3-pip
+    - |
+        if command -v dnf &> /dev/null; then
+          dnf -y install python3-pip
+        else
+          yum -y install python3-pip
+        fi
     - python3 -m pip install -U pip
     - python3 -m pip install gsutil
     - echo "$GSUTIL_CONFIG" > ~/.boto
     - python3 -m pip install -U pip
     - python3 -m pip install gsutil
     - echo "$GSUTIL_CONFIG" > ~/.boto