Skip to content

Commit

Permalink
Ubi9 image changes (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchanaShinde1 authored Mar 6, 2024
1 parent 52807b7 commit 39c804d
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 39 deletions.
8 changes: 4 additions & 4 deletions doc/README.open_ce_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion open_ce/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 3 additions & 3 deletions open_ce/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 2 additions & 4 deletions open_ce/images/builder-cuda/Dockerfile.cuda-12.2
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
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
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
Expand All @@ -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
Expand All @@ -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 && \
Expand Down
6 changes: 2 additions & 4 deletions open_ce/images/builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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 && \
Expand Down
19 changes: 10 additions & 9 deletions open_ce/images/builder/Dockerfile-p10
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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 && \
Expand Down
12 changes: 6 additions & 6 deletions open_ce/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
16 changes: 8 additions & 8 deletions tests/inputs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
'''
Expand All @@ -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):
'''
Expand All @@ -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',
Expand All @@ -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)

0 comments on commit 39c804d

Please sign in to comment.