From 39c804d16de34bb79b8be37aa681e763df2aa4cb Mon Sep 17 00:00:00 2001 From: ArchanaShinde1 <106796026+ArchanaShinde1@users.noreply.github.com> Date: Wed, 6 Mar 2024 12:09:56 +0530 Subject: [PATCH] Ubi9 image changes (#216) --- doc/README.open_ce_build.md | 8 ++++---- open_ce/constants.py | 2 +- open_ce/errors.py | 6 +++--- .../images/builder-cuda/Dockerfile.cuda-12.2 | 6 ++---- open_ce/images/builder/Dockerfile | 6 ++---- open_ce/images/builder/Dockerfile-p10 | 19 ++++++++++--------- open_ce/inputs.py | 12 ++++++------ tests/inputs_test.py | 16 ++++++++-------- 8 files changed, 36 insertions(+), 39 deletions(-) diff --git a/doc/README.open_ce_build.md b/doc/README.open_ce_build.md index d3a7632b..9cd48ac4 100644 --- a/doc/README.open_ce_build.md +++ b/doc/README.open_ce_build.md @@ -464,19 +464,19 @@ check the Dockerfile for details. * System: RHEL 8.5 or above * OS: Linux * Power Architecture: Power9/Power10 -* GCC Compiler: GCC11 +* GCC Compiler: GCC12 One can build Power10 enabled packages with above system requirements. Note that Power10 is not required on your build system. The libraries can be built on Power9 as well. To install GCC 11, following command can be used - ```shell - yum install -y gcc-toolset-11 + yum install -y gcc-toolset-12 ``` -Set GCC_11_HOME environment variables to proceed with the builds on baremetal, if GCC11 is installed at a non-default location. +Set GCC_HOME environment variables to proceed with the builds on baremetal, if GCC12 is installed at a non-default location. For example: ```shell - export GCC_11_HOME=/opt/rh/gcc-toolset-11/root/usr + export GCC_HOME=/opt/rh/gcc-toolset-12/root/usr ``` GCC 11 setup is automated if the builds are done in a podman container using `--container_build` option. Please see [`Dockerfile`](https://github.com/open-ce/open-ce-builder/blob/main/open_ce/images/builder/Dockerfile-p10) used for containerized build of these packages. diff --git a/open_ce/constants.py b/open_ce/constants.py index 898fd92f..17f5c665 100644 --- a/open_ce/constants.py +++ b/open_ce/constants.py @@ -50,6 +50,6 @@ DEFAULT_GRAPH_FILE = "graph.png" DEFAULT_TEST_RESULT_FILE = "test_results.xml" DEFAULT_PPC_ARCH = "p9" -DEFAULT_GCC_11_HOME_DIR = "/opt/rh/gcc-toolset-11/root/usr" +DEFAULT_GCC_HOME_DIR = "/opt/rh/gcc-toolset-12/root/usr" OPENSSL_ENV_FILE = "openssl-env.yaml" FFMPEG_ENV_FILE = "ffmpeg-env.yaml" diff --git a/open_ce/errors.py b/open_ce/errors.py index 0a8e5b49..80532c31 100644 --- a/open_ce/errors.py +++ b/open_ce/errors.py @@ -89,10 +89,10 @@ class Error(Enum): TEMP_BUILD_IMAGE_FILES = (37, "Error removing temporary files created during build image.") UNABLE_DOWNLOAD_SOURCE = (38, "Unable to download source for '{}'.") UNABLE_CLONE_SOURCE = (39, "Unable to clone source for '{}'.") - GCC11_COMPILER_NOT_FOUND = (40, "Please check if GCC11 is installed. If not, install" + + GCC12_COMPILER_NOT_FOUND = (40, "Please check if GCC12 is installed. If not, install" + " gcc-toolset-11. Also, set environment variables" + - " GCC_11_HOME to point to the installed location." + - " For e.g. GCC_11_HOME=\"/opt/rh/gcc-toolset-11/root/usr\"") + " GCC_HOME to point to the installed location." + + " For e.g. GCC_HOME=\"/opt/rh/gcc-toolset-11/root/usr\"") GIT_TAG_MISSING = (41, "git_tag attribute is missing for '{}'") FIPS_PACKAGES_NOT_BUILT = (42, "FIPS Compliant OpenSSL env failed to build") diff --git a/open_ce/images/builder-cuda/Dockerfile.cuda-12.2 b/open_ce/images/builder-cuda/Dockerfile.cuda-12.2 index 64e0c60b..e21a1cb1 100644 --- a/open_ce/images/builder-cuda/Dockerfile.cuda-12.2 +++ b/open_ce/images/builder-cuda/Dockerfile.cuda-12.2 @@ -1,4 +1,4 @@ -FROM docker.io/nvidia/cuda:12.2.0-devel-ubi8 +FROM docker.io/nvidia/cuda:12.2.2-devel-ubi9 ENV CONDA_HOME=${CONDA_HOME:-/opt/conda} ENV PATH=$CONDA_HOME/bin:$PATH @@ -6,7 +6,6 @@ ENV CUDA_HOME=/usr/local/cuda ENV OPEN_CE_CONDA_BUILD=3.22.0 ENV OPEN_CE_CONDA=4.14 -ENV OPENSSL_VER=3.* ENV CICD_GROUP=cicd ARG GROUP_ID=1500 @@ -20,7 +19,7 @@ ENV LIMIT_BUILD_RESOURCES=${LIMIT_BUILD_RESOURCES} RUN rpm -e --nodeps --verbose gcc gcc-c++ RUN export ARCH="$(uname -m)" && \ - yum repolist && yum install -y rsync openssh-clients diffutils procps git-lfs file psmisc openssl openssl-libs openssl-devel && \ + yum repolist && yum install -y rsync openssh-clients diffutils procps git-lfs file psmisc libxcrypt-compat openssl-devel && \ # Create CICD Group groupadd --non-unique --gid ${GROUP_ID} ${CICD_GROUP} && \ # Adduser Builder @@ -36,7 +35,6 @@ RUN export ARCH="$(uname -m)" && \ $CONDA_HOME/bin/conda config --system --set always_yes true && \ $CONDA_HOME/bin/conda config --system --set auto_update_conda false && \ $CONDA_HOME/bin/conda config --system --set notify_outdated_conda false && \ - $CONDA_HOME/bin/conda config --system --add create_default_packages openssl=${OPENSSL_VER} && \ $CONDA_HOME/bin/conda --version && \ mkdir -p $CONDA_HOME/conda-bld && \ mkdir -p $HOME/.cache && \ diff --git a/open_ce/images/builder/Dockerfile b/open_ce/images/builder/Dockerfile index a53f7d50..618fa586 100644 --- a/open_ce/images/builder/Dockerfile +++ b/open_ce/images/builder/Dockerfile @@ -1,11 +1,10 @@ -FROM registry.access.redhat.com/ubi8/ubi +FROM registry.access.redhat.com/ubi9/ubi ENV CONDA_HOME=${CONDA_HOME:-/opt/conda} ENV PATH=$CONDA_HOME/bin:$PATH ENV OPEN_CE_CONDA_BUILD=3.22.0 ENV OPEN_CE_CONDA=4.14 -ENV OPENSSL_VER=3.* ENV CICD_GROUP=cicd ARG GROUP_ID=1500 @@ -16,7 +15,7 @@ ARG LIMIT_BUILD_RESOURCES=0 ENV LIMIT_BUILD_RESOURCES=${LIMIT_BUILD_RESOURCES} RUN export ARCH="$(uname -m)" && \ - yum repolist && yum install -y rsync openssh-clients diffutils procps binutils git-lfs glibc-devel file psmisc openssl openssl-libs openssl-devel && \ + yum repolist && yum install -y rsync openssh-clients diffutils procps binutils git-lfs glibc-devel file psmisc libxcrypt-compat openssl-devel && \ # Create CICD Group groupadd --non-unique --gid ${GROUP_ID} ${CICD_GROUP} && \ # Adduser Builder @@ -32,7 +31,6 @@ RUN export ARCH="$(uname -m)" && \ $CONDA_HOME/bin/conda config --system --set always_yes true && \ $CONDA_HOME/bin/conda config --system --set auto_update_conda false && \ $CONDA_HOME/bin/conda config --system --set notify_outdated_conda false && \ - $CONDA_HOME/bin/conda config --system --add create_default_packages openssl=${OPENSSL_VER} && \ $CONDA_HOME/bin/conda --version && \ mkdir -p $CONDA_HOME/conda-bld && \ mkdir -p $HOME/.cache && \ diff --git a/open_ce/images/builder/Dockerfile-p10 b/open_ce/images/builder/Dockerfile-p10 index ef7529f6..2495fc3f 100644 --- a/open_ce/images/builder/Dockerfile-p10 +++ b/open_ce/images/builder/Dockerfile-p10 @@ -1,11 +1,10 @@ -FROM registry.access.redhat.com/ubi8/ubi:8.5-214 +FROM registry.access.redhat.com/ubi9/ubi ENV CONDA_HOME=${CONDA_HOME:-/opt/conda} ENV PATH=$CONDA_HOME/bin:$PATH ENV OPEN_CE_CONDA_BUILD=3.22.0 ENV OPEN_CE_CONDA=4.14 -ENV OPENSSL_VER=3.* ENV CICD_GROUP=cicd ARG GROUP_ID=1500 @@ -16,7 +15,9 @@ ARG LIMIT_BUILD_RESOURCES=0 ENV LIMIT_BUILD_RESOURCES=${LIMIT_BUILD_RESOURCES} RUN export ARCH="$(uname -m)" && \ - yum repolist && yum install -y rsync openssh-clients diffutils procps git-lfs gcc-toolset-11 glibc-devel file libtirpc-devel psmisc libX11-devel && \ + yum install -y yum-utils rsync openssh-clients diffutils procps git-lfs gcc-toolset-12 glibc-devel file libxcrypt-compat psmisc libX11-devel openssl openssl-libs openssl-devel && \ + yum-config-manager --set-enabled codeready-builder-for-rhel-9-ppc64le-rpms && \ + yum install -y libtirpc-devel && \ # Create CICD Group groupadd --non-unique --gid ${GROUP_ID} ${CICD_GROUP} && \ # Adduser Builder @@ -38,22 +39,22 @@ RUN export ARCH="$(uname -m)" && \ mkdir -p $HOME/.cache && \ echo "export PYTHONPATH=${PYTHONPATH}:$HOME/open_ce" >> ${HOME}/.bashrc && \ echo "export LIMIT_BUILD_RESOURCES=${LIMIT_BUILD_RESOURCES}" >> ${HOME}/.bashrc && \ - export PATH="/opt/rh/gcc-toolset-11/root/usr/bin:${PATH}" && \ - export GCC_11_HOME="/opt/rh/gcc-toolset-11/root/usr" && \ + export PATH="/opt/rh/gcc-toolset-12/root/usr/bin:${PATH}" && \ + export GCC_HOME="/opt/rh/gcc-toolset-12/root/usr" && \ echo "PATH="${PATH}"" >> ${HOME}/.profile && \ echo "PATH="${PATH}"" >> ${HOME}/.bashrc && \ - echo "GCC_11_HOME="${GCC_11_HOME}"" >> ${HOME}/.bashrc && \ + echo "GCC_HOME="${GCC_HOME}"" >> ${HOME}/.bashrc && \ chown -R ${BUILD_USER}:${CICD_GROUP} ${CONDA_HOME} && \ git config --global http.version HTTP/1.1 && \ git config --global http.postBuffer 157286400 USER ${BUILD_USER} -RUN export PATH="/opt/rh/gcc-toolset-11/root/usr/bin:${PATH}" && \ - export GCC_11_HOME="/opt/rh/gcc-toolset-11/root/usr" && \ +RUN export PATH="/opt/rh/gcc-toolset-12/root/usr/bin:${PATH}" && \ + export GCC_HOME="/opt/rh/gcc-toolset-12/root/usr" && \ echo "PATH="${PATH}"" >> ${HOME}/.profile && \ echo "PATH="${PATH}"" >> ${HOME}/.bashrc && \ - echo "GCC_11_HOME="${GCC_11_HOME}"" >> ${HOME}/.bashrc && \ + echo "GCC_HOME="${GCC_HOME}"" >> ${HOME}/.bashrc && \ mkdir -p $HOME/.cache && \ echo ". $CONDA_HOME/etc/profile.d/conda.sh" >> ${HOME}/.bashrc && \ echo "export PYTHONPATH=${PYTHONPATH}:$HOME/open_ce" >> ${HOME}/.bashrc && \ diff --git a/open_ce/inputs.py b/open_ce/inputs.py index 7fa95764..53b7cea0 100644 --- a/open_ce/inputs.py +++ b/open_ce/inputs.py @@ -401,18 +401,18 @@ def _check_cuda_versions(args): def _check_ppc_arch(args): ''' This will check if ppc_arch is p10 and set the corresponding - needed environment variables for GCC_11_HOME + needed environment variables for GCC_HOME ''' if "ppc_arch" in vars(args).keys() and args.ppc_arch: opence_globals.PPC_ARCH_VARIANT = args.ppc_arch if args.ppc_arch == "p10": - if "GCC_11_HOME" not in os.environ: - os.environ["GCC_11_HOME"] = constants.DEFAULT_GCC_11_HOME_DIR + if "GCC_HOME" not in os.environ: + os.environ["GCC_HOME"] = constants.DEFAULT_GCC_HOME_DIR PATH = os.environ["PATH"] - os.environ["PATH"] = f"{os.path.join(os.environ['GCC_11_HOME'], 'bin')}:{PATH}" + os.environ["PATH"] = f"{os.path.join(os.environ['GCC_HOME'], 'bin')}:{PATH}" print("Path variable set to : ", os.environ["PATH"]) - if not os.path.exists(constants.DEFAULT_GCC_11_HOME_DIR): - raise OpenCEError(Error.GCC11_COMPILER_NOT_FOUND) + if not os.path.exists(constants.DEFAULT_GCC_HOME_DIR): + raise OpenCEError(Error.GCC12_COMPILER_NOT_FOUND) def parse_args(parser, arg_strings=None): diff --git a/tests/inputs_test.py b/tests/inputs_test.py index 407f2012..861896f5 100644 --- a/tests/inputs_test.py +++ b/tests/inputs_test.py @@ -63,14 +63,14 @@ def test_check_ppc_arch_for_p9(mocker): 'os.path.exists', return_value=True ) - if 'GCC_11_HOME' in os.environ: - del os.environ["GCC_11_HOME"] + if 'GCC_HOME' in os.environ: + del os.environ["GCC_HOME"] parser = make_parser([Argument.ENV_FILE, Argument.PPC_ARCH]) args = parser.parse_args(["test-env.yaml", "--ppc_arch=p9"]) _check_ppc_arch(args) - assert "GCC_11_HOME" not in os.environ + assert "GCC_HOME" not in os.environ def test_check_ppc_arch_for_p10(mocker): ''' @@ -85,8 +85,8 @@ def test_check_ppc_arch_for_p10(mocker): args = parser.parse_args(["test-env.yaml", "--ppc_arch=p10"]) _check_ppc_arch(args) - assert "GCC_11_HOME" in os.environ - del os.environ["GCC_11_HOME"] + assert "GCC_HOME" in os.environ + del os.environ["GCC_HOME"] def test_check_ppc_arch_for_p10_container_build(mocker): ''' @@ -100,11 +100,11 @@ def test_check_ppc_arch_for_p10_container_build(mocker): parser = make_parser([Argument.ENV_FILE, Argument.PPC_ARCH, Argument.CONTAINER_BUILD]) args_str = ["test-env.yaml", "--container_build", "--ppc_arch=p10"] parse_args(parser, args_str) - assert "GCC_11_HOME" not in os.environ + assert "GCC_HOME" not in os.environ def test_check_ppc_arch_for_p10_with_no_gcc_path(mocker): ''' - Test if GCC_11_HOME don't exist, an error is thrown + Test if GCC_HOME don't exist, an error is thrown ''' mocker.patch( 'os.path.exists', @@ -117,5 +117,5 @@ def test_check_ppc_arch_for_p10_with_no_gcc_path(mocker): with pytest.raises(OpenCEError) as exc: _check_ppc_arch(args) - assert Error.GCC11_COMPILER_NOT_FOUND.value[1] in str(exc.value) + assert Error.GCC12_COMPILER_NOT_FOUND.value[1] in str(exc.value)