Skip to content

Commit

Permalink
3193 rocky linux workflow scripts support (#3288)
Browse files Browse the repository at this point in the history
* Issue 3193. fixes fo workflow scripts to work with Rocky Linux

* issue 3193 moved all places where /etc/os-release were used to use CP_OS, CP_VER etc

* issue #3204 nice_dcv_setup fixes for rockylinux

* issue 3193 fix for lustre client installation

* issue 3193 fix for CP_OS_VER usage

* issue 3193 dind nvidia changes

* issue 3193 update Dockerfile for Rocky
  • Loading branch information
SilinPavel authored Aug 30, 2023
1 parent fed3711 commit f250ba3
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 39 deletions.
6 changes: 6 additions & 0 deletions deploy/docker/cp-tools/base/rockylinux/vanilla/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ RUN yum install -y wget \
git \
curl \
procps \
findutils \
epel-release && \
yum clean all && \
yum install -y python2 && \
ln -sf python2 /usr/bin/python && \
curl https://cloud-pipeline-oss-builds.s3.amazonaws.com/tools/pip/2.7/get-pip.py | python -

# Enable epel-release and powertools by default
RUN yum install -y epel-release && \
yum config-manager --set-enabled powertools && \
yum update -y
26 changes: 22 additions & 4 deletions scripts/pipeline-launch/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ function run_pre_common_commands {
function define_distro_name_and_version {
# Get the distro name and version
CP_OS=
CP_OS_FAMILY=
CP_VER=
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
Expand All @@ -458,8 +459,25 @@ function define_distro_name_and_version {
CP_OS=$(uname -s)
CP_VER=$(uname -r)
fi

case $CP_OS in
ubuntu | debian)
CP_OS_FAMILY=debian
;;
centos | rocky | fedora | ol | amzn)
CP_OS_FAMILY=rhel
;;
*)
CP_OS_FAMILY=linux
;;
esac

export CP_OS
export CP_OS_FAMILY
export CP_VER
export CP_VER_MAJOR="${CP_VER%%.*}"


}

# This function handle any distro/version - specific package manager state, e.g. clean up or reconfigure
Expand All @@ -480,7 +498,7 @@ function configure_package_manager {
# System package manager setup
local CP_REPO_BASE_URL_DEFAULT="${CP_REPO_BASE_URL_DEFAULT:-"${GLOBAL_DISTRIBUTION_URL}tools/repos"}"
local CP_REPO_BASE_URL="${CP_REPO_BASE_URL_DEFAULT}/${CP_OS}/${CP_VER}"
if [ "$CP_OS" == "centos" ]; then
if [ "$CP_OS" == "centos" ] || [ "$CP_OS" == "rocky" ]; then
for _CP_REPO_RETRY_ITER in $(seq 1 $CP_REPO_RETRY_COUNT); do
# Remove nvidia repositories, as they cause run initialization failure
rm -f /etc/yum.repos.d/cuda.repo
Expand Down Expand Up @@ -548,8 +566,8 @@ function get_install_command_by_current_distr {
_TOOLS_TO_INSTALL="$(sed "s/\( \|^\)ltdl\( \|$\)/ ${_ltdl_lib_name} /g" <<< "$_TOOLS_TO_INSTALL")"
fi
if [[ "$_TOOLS_TO_INSTALL" == *"python"* ]] && \
[ "$CP_OS" == "centos" ] && \
[ "$CP_VER" == "8" ]; then
{ [ "$CP_OS" == "centos" ] || [ "$CP_OS" == "rocky" ]; } && \
{ [[ "$CP_VER" == "8"* ]] || [[ "$CP_VER" == "9"* ]]; }; then
_TOOLS_TO_INSTALL="$(sed -e "s/python/python2/g" <<< "$_TOOLS_TO_INSTALL")"
fi

Expand Down Expand Up @@ -2151,7 +2169,7 @@ echo "-"
# Force SystemD capability if the Kubernetes is requested
if ( check_cp_cap "CP_CAP_SYSTEMD_CONTAINER" || check_cp_cap "CP_CAP_KUBE" ) \
&& check_installed "systemctl" && \
[ "$CP_OS" == "centos" ]; then
[ "$CP_OS" == "centos" ] || [ "$CP_OS" == "rocky" ]; then
_SYSTEMCTL_STATUS=$(systemctl &> /dev/null; $?)
if [ "$_SYSTEMCTL_STATUS" -eq 0 ]; then
echo "Systemd already active, skipping installation"
Expand Down
37 changes: 23 additions & 14 deletions workflows/pipe-common/shell/dind_setup
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,12 @@ IS_RPM_BASED=$?
######################################################
_DIND_DEP_INSTALL_RESULT=0
if [ $IS_RPM_BASED -eq 0 ]; then
yum install -y -q \
btrfs-progs \
e2fsprogs \
iptables \
iproute \
xfsprogs \
xz \
pigz \
kmod
_PACKAGES_TO_INSTALL="e2fsprogs iptables iproute xfsprogs xz pigz kmod"
# Rocky doesn't have btrfs-progs
if [ "$CP_OS" != "rocky" ]; then
_PACKAGES_TO_INSTALL="${_PACKAGES_TO_INSTALL} btrfs-progs"
fi
yum install -y -q "$_PACKAGES_TO_INSTALL"
_DIND_DEP_INSTALL_RESULT=$?
else
apt install -y -qq \
Expand All @@ -64,7 +61,13 @@ pipe_log_info "DIND dependencies installed" "$DIND_SETUP_TASK"
######################################################

[ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
export CP_CAP_DIND_VERSION="${CP_CAP_DIND_VERSION:-18.09.6}"

CP_CAP_DIND_DEFAULT_VERSION=18.09.6
if [ "$CP_OS" == "rocky" ]; then
CP_CAP_DIND_DEFAULT_VERSION=20.10.23
fi

export CP_CAP_DIND_VERSION="${CP_CAP_DIND_VERSION:-$CP_CAP_DIND_DEFAULT_VERSION}"
export CP_CAP_DIND_CHANNEL="${CP_CAP_DIND_CHANNEL:-stable}"
export CP_CAP_DIND_ARCH="${CP_CAP_DIND_ARCH:-x86_64}"

Expand All @@ -80,11 +83,20 @@ rm -f docker.tgz

pipe_log_info "Docker installed: ${CP_CAP_DIND_CHANNEL}/${CP_CAP_DIND_ARCH}/docker-${CP_CAP_DIND_VERSION}" "$DIND_SETUP_TASK"


# TODO fix for Rocky Linux
nvidia-smi
REQUIRES_GPU_DIND=$?
if [ $REQUIRES_GPU_DIND -eq 0 ]; then
pipe_log_info "Active CUDA environment detected, try to install NVIDIA Docker" "$DIND_SETUP_TASK"
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
distribution="${CP_OS}${CP_VER}"
if [ "$CP_OS" != "rocky" ]; then
if [[ "$CP_VER" == "8"* ]]; then
distribution="rhel8.6"
elif [[ "$CP_VER" == "9"* ]]; then
distribution="rhel9.0"
fi
fi
if [ $IS_RPM_BASED -eq 0 ]; then
export CP_CAP_DIND_GPU_VERSION="${CP_CAP_DIND_GPU_VERSION:-2.0.0-3.docker18.09.6}"

Expand All @@ -95,9 +107,6 @@ if [ $REQUIRES_GPU_DIND -eq 0 ]; then
find /etc/yum.repos.d -type f \( -name "*nvidia*" -o -name "*docker*" \) -exec rm -f {} \;
else
export CP_CAP_DIND_GPU_VERSION="${CP_CAP_DIND_GPU_VERSION:-2.0.0+docker18.09.6-3}"
os=$(. /etc/os-release;echo $ID)
os_release=$(. /etc/os-release;echo $VERSION_CODENAME)
sources_list=/etc/apt/sources.list
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list \
| tee /etc/apt/sources.list.d/nvidia-docker.list
Expand Down
18 changes: 11 additions & 7 deletions workflows/pipe-common/shell/install_nfs_client
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,21 @@ then
CHECK_NFS_SMB_CMD="rpm -qa | grep nfs-utils && rpm -qa | grep cifs-utils"
INSTALL_NFS_SMB_CMD="yum install nfs-utils cifs-utils -y -q"
CHECK_LUSTRE_CMD="rpm -qa | grep lustre-client"
OS_VERSION_ID=$(. /etc/os-release;echo $VERSION_ID)
if [ "$OS_VERSION_ID" == "6" ]; then
if [ "$CP_OS" == "rocky" ]; then
LUSTRE_VERSION="2.12.5-1"
else
if [ "$CP_VER" == "6" ]; then
LUSTRE_VERSION="2.10.8-1"
elif [ "$OS_VERSION_ID" == "7" ]; then
elif [ "$CP_VER" == "7" ]; then
LUSTRE_VERSION="2.12.5-1"
elif [ "$OS_VERSION_ID" == "8" ]; then
elif [ "$CP_VER" == "8" ]; then
LUSTRE_VERSION="2.10.8-2"
else
else
LUSTRE_VERSION="NA"
fi
fi
LUSTRE_VERSION="$LUSTRE_VERSION.el$OS_VERSION_ID.x86_64"

LUSTRE_VERSION="$LUSTRE_VERSION.el$CP_VER.x86_64"
LUSTRE_CLIENT_URL="${GLOBAL_DISTRIBUTION_URL}tools/lustre/client/rpm/lustre-client-$LUSTRE_VERSION.tar.gz"
read -r -d '' INSTALL_LUSTRE_CMD <<- EOM
yum install -y -q wget yum-utils &&
Expand All @@ -56,7 +60,7 @@ else
CHECK_NFS_SMB_CMD="dpkg -l | grep nfs-common && dpkg -l | grep cifs-utils"
INSTALL_NFS_SMB_CMD='apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" nfs-common cifs-utils -y -qq'
CHECK_LUSTRE_CMD="dpkg -l | grep lustre-client"
LUSTRE_VERSION=$(. /etc/os-release;echo $ID-${VERSION_ID//.})
LUSTRE_VERSION="$CP_OS-${CP_VER//.}"
LUSTRE_CLIENT_URL="${GLOBAL_DISTRIBUTION_URL}tools/lustre/client/deb/lustre-client-$LUSTRE_VERSION.tar.gz"
if ! command -v depmod &> /dev/null; then
apt-get install -y -qq kmod
Expand Down
8 changes: 6 additions & 2 deletions workflows/pipe-common/shell/modules_setup
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ if [ "$CP_CAP_MODULE_PREINSTALLED" != "true" ]; then
fi

tar -zxf modules.tar.gz
rm -rf modules.tar.gz
fi

_MODULES_INSTALL_RESULT=1
Expand Down Expand Up @@ -114,8 +115,11 @@ if [ "$CP_CAP_MODULES_TYPE" == "tcl" ]; then
elif [ "$CP_CAP_MODULES_TYPE" == "lmod" ]; then
if [ "$CP_CAP_MODULE_PREINSTALLED" != "true" ]; then
if [[ "$IS_RPM_BASED" = 0 ]]; then
yum install -y -q lua lua-bitop lua-devel lua-filesystem \
lua-json lua-lpeg lua-posix lua-term tcl4 tcl-devel less gcc
_PACKAGES_TO_INSTALL="lua lua-devel lua-filesystem lua-json lua-lpeg lua-posix lua-term tcl tcl-devel less gcc"
if [ "$CP_OS" != "rocky" ]; then
_PACKAGES_TO_INSTALL="${_PACKAGES_TO_INSTALL} lua-bitop"
fi
yum install -y -q "$_PACKAGES_TO_INSTALL"
_MODULES_INSTALL_RESULT=$?
else
apt install make tcl-dev rsync lua5.2 lua-bitop lua-filesystem lua-json lua-lpeg lua-posix lua-term less gcc -y
Expand Down
20 changes: 10 additions & 10 deletions workflows/pipe-common/shell/nice_dcv_setup
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ function install_prerequisites {
pipe_log_info "Installing DCV prerequisites" "$DCV_INSTALL_TASK"
_pkg_result=0
if [[ "$IS_RPM_BASED" = 0 ]]; then
yum -y install glx-utils mesa-dri-drivers xorg-x11-server-Xorg \
xorg-x11-utils xorg-x11-xauth xorg-x11-xinit xvattr \
xorg*fonts* xterm libXvMC mesa-libxatracker freeglut \
gnome-desktop3 gnome-terminal gnome-system-log \
gnome-system-monitor nautilus evince gnome-color-manager \
gnome-font-viewer gnome-shell gnome-calculator gedit gdm \
metacity gnome-session gnome-classic-session \
gnome-session-xsession gnu-free-fonts-common \
gnu-free-mono-fonts gnu-free-sans-fonts \
gnu-free-serif-fonts desktop-backgrounds-gnome && \
_PKG_TO_INSTALL="glx-utils mesa-dri-drivers xorg-x11-server-Xorg xorg-x11-utils xorg-x11-xauth xorg-x11-xinit
xorg*fonts* xterm libXvMC mesa-libxatracker freeglut gnome-desktop3 gnome-terminal
gnome-system-monitor nautilus evince gnome-color-manager gnome-font-viewer gnome-shell
gnome-calculator gedit gdm metacity gnome-session gnome-classic-session gnome-session-xsession
gnu-free-fonts-common gnu-free-mono-fonts gnu-free-sans-fonts gnu-free-serif-fonts
desktop-backgrounds-gnome"
if [[ "$CP_OS" != "rocky" ]]; then
_PKG_TO_INSTALL="$_PKG_TO_INSTALL xvattr gnome-system-log"
fi
yum -y install "$_PKG_TO_INSTALL" && \
yum -y groupinstall "Xfce"
_pkg_result=$?
else
Expand Down
4 changes: 2 additions & 2 deletions workflows/pipe-common/shell/nomachine_setup
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function remove_nm {
function install_nm {
nm_version=$1
if [[ "$IS_RPM_BASED" = 0 ]]; then
os_ver=$(. /etc/os-release;echo $ID-${VERSION_ID//.})
os_ver="${CP_OS}-${CP_VER//.}"
wget -q "${GLOBAL_DISTRIBUTION_URL}tools/nomachine/xfce4-$os_ver.tar.gz" -O xfcedesktop.tar.gz && \
mkdir -p xfcedesktop && \
tar -xzvf xfcedesktop.tar.gz -C xfcedesktop && \
Expand Down Expand Up @@ -138,7 +138,7 @@ function config_nm {
sed -i 's@_XKB_PLUGIN_ID_@'"$XKB_PLUGIN_ID"'@g' /etc/nomachine/xfce/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml
else
XKB_PLUGIN_ID=9
if [[ "$(. /etc/os-release;echo $VERSION_ID)" == *"18."* ]]; then
if [[ "$CP_VER" == *"18."* ]]; then
sed -i 's@_XKB_PLUGIN_NAME_@xkb@g' /etc/nomachine/xfce/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml ;
else
sed -i 's@_XKB_PLUGIN_NAME_@xkb-plugin@g' /etc/nomachine/xfce/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml;
Expand Down

0 comments on commit f250ba3

Please sign in to comment.