Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions docs/building_blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -655,14 +655,13 @@ processors and `arm64-sbsa` for aarch64 processors.
- __oslabel__: The Linux distribution label assigned by Mellanox to the
package repository. For Ubuntu, the default value is
`ubuntuXX.04` where `XX` is derived from the base image. For
RHEL-base Linux distributions, the default value is `rhelX.Y`
where `X.Y` is `9.2` for RHEL 9.x and `8.6` for RHEL 8.x.
RHEL-base Linux distributions, the default value is `rhelX`.

- __ospackages__: List of OS packages to install prior to installing
DOCA OFED. The default values are `ca-certificates`, `gnupg`, and
`wget`.

- __packages__: List of packages to install from Mellanox OFED. For
- __packages__: List of packages to install from DOCA. For
Ubuntu, the default values are `ibverbs-providers`,
`ibverbs-utils` `libibmad-dev`, `libibmad5`, `libibumad3`,
`libibumad-dev`, `libibverbs-dev` `libibverbs1`, `librdmacm-dev`,
Expand All @@ -671,13 +670,13 @@ values are `libibumad`, `libibverbs`, `libibverbs-utils`,
`librdmacm`, `rdma-core`, and `rdma-core-devel`.

- __version__: The version of DOCA OFED to download. The default value
is `2.10.0`.
is `3.2.0`.

__Examples__


```python
doca_ofed(version='2.10.0')
doca_ofed(version='3.2.0')
```


Expand Down
30 changes: 19 additions & 11 deletions hpccm/building_blocks/doca_ofed.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ class doca_ofed(bb_base, hpccm.templates.annotate, hpccm.templates.rm,
oslabel: The Linux distribution label assigned by Mellanox to the
package repository. For Ubuntu, the default value is
`ubuntuXX.04` where `XX` is derived from the base image. For
RHEL-base Linux distributions, the default value is `rhelX.Y`
where `X.Y` is `9.2` for RHEL 9.x and `8.6` for RHEL 8.x.
RHEL-base Linux distributions, the default value is `rhelX`.

ospackages: List of OS packages to install prior to installing
DOCA OFED. The default values are `ca-certificates`, `gnupg`, and
`wget`.

packages: List of packages to install from Mellanox OFED. For
packages: List of packages to install from DOCA. For
Ubuntu, the default values are `ibverbs-providers`,
`ibverbs-utils` `libibmad-dev`, `libibmad5`, `libibumad3`,
`libibumad-dev`, `libibverbs-dev` `libibverbs1`, `librdmacm-dev`,
Expand All @@ -65,12 +64,12 @@ class doca_ofed(bb_base, hpccm.templates.annotate, hpccm.templates.rm,
`librdmacm`, `rdma-core`, and `rdma-core-devel`.

version: The version of DOCA OFED to download. The default value
is `2.10.0`.
is `3.2.0`.

# Examples

```python
doca_ofed(version='2.10.0')
doca_ofed(version='3.2.0')
```

"""
Expand All @@ -81,12 +80,13 @@ def __init__(self, **kwargs):
super(doca_ofed, self).__init__(**kwargs)

self.__archlabel = kwargs.get('archlabel', '') # Filled in by __cpu_arch
self.__extra_opts = []
self.__key = 'https://linux.mellanox.com/public/repo/doca/GPG-KEY-Mellanox.pub'
self.__oslabel = kwargs.get('oslabel', '') # Filled in by __distro
self.__ospackages = kwargs.get('ospackages',
['ca-certificates', 'gnupg', 'wget'])
self.__packages = kwargs.get('packages', []) # Filled in by __distro
self.__version = kwargs.get('version', '2.10.0')
self.__version = kwargs.get('version', '3.2.0')

# Add annotation
self.add_annotation('version', self.__version)
Expand All @@ -109,9 +109,10 @@ def __instructions(self):

self += packages(
apt_keys=[self.__key],
apt_repositories=['deb [signed-by=/usr/share/keyrings/{3}] https://linux.mellanox.com/public/repo/doca/{0}/{1}/{2}/ ./'.format(self.__version, self.__oslabel, self.__archlabel, posixpath.basename(self.__key).replace('.pub', '.gpg'))],
apt_repositories=['deb [signed-by=/usr/share/keyrings/{3}] https://linux.mellanox.com/public/repo/doca/{0}/{1}/{2}/ ./'.format(self.__version, self.__oslabel, self.__archlabel, posixpath.basename(self.__key).replace('.pub', '.gpg')) if self.__key else None],
extra_opts=self.__extra_opts,
ospackages=self.__packages,
yum_keys=[self.__key],
yum_keys=[self.__key] if self.__key else None,
yum_repositories=['https://linux.mellanox.com/public/repo/doca/{0}/{1}/{2}'.format(self.__version, self.__oslabel, self.__archlabel)])

self += label(metadata=self.annotate_step())
Expand Down Expand Up @@ -150,10 +151,17 @@ def __distro(self):

elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
if not self.__oslabel:
if hpccm.config.g_linux_version >= Version('9.0'):
self.__oslabel = 'rhel9.2'
if hpccm.config.g_linux_version >= Version('10.0'):
self.__oslabel = 'rhel10'
# The DOCA OFED GPG key is rejected by the Rockylinux 10
# security policy as insecure. Do not check the
# package signatures.
self.__key = None
self.__extra_opts = ['--nogpgcheck']
elif hpccm.config.g_linux_version >= Version('9.0'):
self.__oslabel = 'rhel9'
else:
self.__oslabel = 'rhel8.6'
self.__oslabel = 'rhel8'

if not self.__packages:
self.__packages = ['libibverbs', 'libibverbs-utils',
Expand Down
46 changes: 35 additions & 11 deletions test/test_doca_ofed.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import logging # pylint: disable=unused-import
import unittest

from helpers import aarch64, centos8, docker, rockylinux9, ubuntu20, ubuntu22, ubuntu24, x86_64
from helpers import aarch64, centos8, docker, rockylinux9, rockylinux10, ubuntu20, ubuntu22, ubuntu24, x86_64

from hpccm.building_blocks.doca_ofed import doca_ofed

Expand All @@ -38,7 +38,7 @@ def test_defaults_ubuntu20(self):
"""Default doca_ofed building block"""
doca = doca_ofed()
self.assertMultiLineEqual(str(doca),
r'''# DOCA OFED version 2.10.0
r'''# DOCA OFED version 3.2.0
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
Expand All @@ -48,7 +48,7 @@ def test_defaults_ubuntu20(self):
RUN mkdir -p /usr/share/keyrings && \
rm -f /usr/share/keyrings/GPG-KEY-Mellanox.gpg && \
wget -qO - https://linux.mellanox.com/public/repo/doca/GPG-KEY-Mellanox.pub | gpg --dearmor -o /usr/share/keyrings/GPG-KEY-Mellanox.gpg && \
echo "deb [signed-by=/usr/share/keyrings/GPG-KEY-Mellanox.gpg] https://linux.mellanox.com/public/repo/doca/2.10.0/ubuntu20.04/x86_64/ ./" >> /etc/apt/sources.list.d/hpccm.list && \
echo "deb [signed-by=/usr/share/keyrings/GPG-KEY-Mellanox.gpg] https://linux.mellanox.com/public/repo/doca/3.2.0/ubuntu20.04/x86_64/ ./" >> /etc/apt/sources.list.d/hpccm.list && \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ibverbs-providers \
Expand All @@ -70,7 +70,7 @@ def test_defaults_ubuntu22(self):
"""Default doca_ofed building block"""
doca = doca_ofed()
self.assertMultiLineEqual(str(doca),
r'''# DOCA OFED version 2.10.0
r'''# DOCA OFED version 3.2.0
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
Expand All @@ -80,7 +80,7 @@ def test_defaults_ubuntu22(self):
RUN mkdir -p /usr/share/keyrings && \
rm -f /usr/share/keyrings/GPG-KEY-Mellanox.gpg && \
wget -qO - https://linux.mellanox.com/public/repo/doca/GPG-KEY-Mellanox.pub | gpg --dearmor -o /usr/share/keyrings/GPG-KEY-Mellanox.gpg && \
echo "deb [signed-by=/usr/share/keyrings/GPG-KEY-Mellanox.gpg] https://linux.mellanox.com/public/repo/doca/2.10.0/ubuntu22.04/arm64-sbsa/ ./" >> /etc/apt/sources.list.d/hpccm.list && \
echo "deb [signed-by=/usr/share/keyrings/GPG-KEY-Mellanox.gpg] https://linux.mellanox.com/public/repo/doca/3.2.0/ubuntu22.04/arm64-sbsa/ ./" >> /etc/apt/sources.list.d/hpccm.list && \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ibverbs-providers \
Expand All @@ -102,7 +102,7 @@ def test_defaults_ubuntu24(self):
"""Default doca_ofed building block"""
doca = doca_ofed()
self.assertMultiLineEqual(str(doca),
r'''# DOCA OFED version 2.10.0
r'''# DOCA OFED version 3.2.0
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
Expand All @@ -112,7 +112,7 @@ def test_defaults_ubuntu24(self):
RUN mkdir -p /usr/share/keyrings && \
rm -f /usr/share/keyrings/GPG-KEY-Mellanox.gpg && \
wget -qO - https://linux.mellanox.com/public/repo/doca/GPG-KEY-Mellanox.pub | gpg --dearmor -o /usr/share/keyrings/GPG-KEY-Mellanox.gpg && \
echo "deb [signed-by=/usr/share/keyrings/GPG-KEY-Mellanox.gpg] https://linux.mellanox.com/public/repo/doca/2.10.0/ubuntu24.04/x86_64/ ./" >> /etc/apt/sources.list.d/hpccm.list && \
echo "deb [signed-by=/usr/share/keyrings/GPG-KEY-Mellanox.gpg] https://linux.mellanox.com/public/repo/doca/3.2.0/ubuntu24.04/x86_64/ ./" >> /etc/apt/sources.list.d/hpccm.list && \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ibverbs-providers \
Expand All @@ -134,15 +134,15 @@ def test_defaults_rockylinux9(self):
"""Default doca_ofed building block"""
doca = doca_ofed()
self.assertMultiLineEqual(str(doca),
r'''# DOCA OFED version 2.10.0
r'''# DOCA OFED version 3.2.0
RUN yum install -y \
ca-certificates \
gnupg \
wget && \
rm -rf /var/cache/yum/*
RUN rpm --import https://linux.mellanox.com/public/repo/doca/GPG-KEY-Mellanox.pub && \
yum install -y dnf-utils && \
yum-config-manager --add-repo https://linux.mellanox.com/public/repo/doca/2.10.0/rhel9.2/x86_64 && \
yum-config-manager --add-repo https://linux.mellanox.com/public/repo/doca/3.2.0/rhel9/x86_64 && \
yum install -y \
libibumad \
libibverbs \
Expand All @@ -152,22 +152,46 @@ def test_defaults_rockylinux9(self):
rdma-core-devel && \
rm -rf /var/cache/yum/*''')

@x86_64
@rockylinux10
@docker
def test_defaults_rockylinux10(self):
"""Default doca_ofed building block"""
doca = doca_ofed()
self.assertMultiLineEqual(str(doca),
r'''# DOCA OFED version 3.2.0
RUN yum install -y \
ca-certificates \
gnupg \
wget && \
rm -rf /var/cache/yum/*
RUN yum install -y dnf-utils && \
yum-config-manager --add-repo https://linux.mellanox.com/public/repo/doca/3.2.0/rhel10/x86_64 && \
yum install -y --nogpgcheck \
libibumad \
libibverbs \
libibverbs-utils \
librdmacm \
rdma-core \
rdma-core-devel && \
rm -rf /var/cache/yum/*''')

@x86_64
@centos8
@docker
def test_defaults_rockylinux8(self):
"""Default doca_ofed building block"""
doca = doca_ofed()
self.assertMultiLineEqual(str(doca),
r'''# DOCA OFED version 2.10.0
r'''# DOCA OFED version 3.2.0
RUN yum install -y \
ca-certificates \
gnupg \
wget && \
rm -rf /var/cache/yum/*
RUN rpm --import https://linux.mellanox.com/public/repo/doca/GPG-KEY-Mellanox.pub && \
yum install -y dnf-utils && \
yum-config-manager --add-repo https://linux.mellanox.com/public/repo/doca/2.10.0/rhel8.6/x86_64 && \
yum-config-manager --add-repo https://linux.mellanox.com/public/repo/doca/3.2.0/rhel8/x86_64 && \
yum install -y \
libibumad \
libibverbs \
Expand Down
Loading