From 332a4a915771afedcb144463b012558e4669e529 Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Thu, 17 Oct 2024 14:57:46 +0200 Subject: [PATCH] Fix failed docker CI using more reasoning grep regex to parse python version (#6581) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The grep command failed that extracts the python version from mamba list failed because an indentation was added. See the python string in the output of `mamba list`: ``` List of packages in environment: "/opt/conda" Name Version Build Channel ──────────────────────────────────────────────────── python 3.10.13 hd12c33a_1_cpython conda-forge ``` --- .docker/aiida-core-base/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/aiida-core-base/Dockerfile b/.docker/aiida-core-base/Dockerfile index 87339724bc..40b18f9fa3 100644 --- a/.docker/aiida-core-base/Dockerfile +++ b/.docker/aiida-core-base/Dockerfile @@ -137,7 +137,7 @@ RUN set -x && \ mamba && \ rm micromamba && \ # Pin major.minor version of python - mamba list python | grep '^python ' | tr -s ' ' | cut -d ' ' -f 1,2 >> "${CONDA_DIR}/conda-meta/pinned" && \ + mamba list python | grep -oP 'python\s+\K[\d.]+' | tr -s ' ' | cut -d ' ' -f 1,2 >> "${CONDA_DIR}/conda-meta/pinned" && \ mamba clean --all -f -y && \ fix-permissions "${CONDA_DIR}" && \ fix-permissions "/home/${SYSTEM_USER}"