From 533fd5c426420544816b3e853ccc793bf5f71a90 Mon Sep 17 00:00:00 2001 From: Vito Di Benedetto <55766483+vitodb@users.noreply.github.com> Date: Wed, 27 Sep 2023 18:56:43 -0500 Subject: [PATCH] Adding DE modules EL9 CI container based on AlmaLinux9 --- package/ci/EL9/Dockerfile | 27 +++++++++++++ package/ci/EL9/python3-entrypoint.sh | 60 ++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 package/ci/EL9/Dockerfile create mode 100755 package/ci/EL9/python3-entrypoint.sh diff --git a/package/ci/EL9/Dockerfile b/package/ci/EL9/Dockerfile new file mode 100644 index 00000000..e74f62d1 --- /dev/null +++ b/package/ci/EL9/Dockerfile @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: 2017 Fermi Research Alliance, LLC +# SPDX-License-Identifier: Apache-2.0 + +ARG BASEIMAGE=hepcloud/decision-engine-ci-el9 +FROM ${BASEIMAGE} +COPY python3-entrypoint.sh /entrypoint.sh + +# Identity information for the decisionengine user +ARG UID=1001 +ARG USERNAME=decisionengine +ARG GID=116 +ARG GROUPNAME=decisionengine +ARG HOMEDIR=/home/decisionengine + +# install GlideinWMS requirements +RUN dnf install -y openssl-devel swig + +# Make user and place for logs/configs +RUN groupadd -g $GID $GROUPNAME ; \ + useradd -u $UID -g $GID -d $HOMEDIR -m $USERNAME ; \ + chown $USERNAME:$GROUPNAME /var/log/decisionengine /etc/decisionengine + +# Become container user +USER $USERNAME +WORKDIR $HOMEDIR + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/package/ci/EL9/python3-entrypoint.sh b/package/ci/EL9/python3-entrypoint.sh new file mode 100755 index 00000000..d1af2f52 --- /dev/null +++ b/package/ci/EL9/python3-entrypoint.sh @@ -0,0 +1,60 @@ +#!/bin/bash -xe + +# SPDX-FileCopyrightText: 2017 Fermi Research Alliance, LLC +# SPDX-License-Identifier: Apache-2.0 + +CMD=${1:- -m pytest} +LOGFILE=${2:- pytest.log} +# set defaul DE_BRANCH to master or eventually set it as entrypoint script argument +DE_BRANCH=${3:-master} + +# check DE modules branch +# the entrypoint script is supposed to run inside DE modules folder +# GITHUB_PR_NUMBER is set in Jenkins for PR +# CI on GitHub for PR uses a HEAD detached branch +# if we have a different case, we are testing an actual branch +[[ -z ${GITHUB_PR_NUMBER} && $(git rev-parse --abbrev-ref HEAD) != "HEAD" ]] && DE_BRANCH=$(git rev-parse --abbrev-ref HEAD) || : +echo "DE_BRANCH: ${DE_BRANCH}" + +id +getent passwd $(whoami) +python3 -m site +echo '' + +# checkout DE Framework +rm -rf decisionengine +git clone -b ${DE_BRANCH} https://github.com/HEPCloud/decisionengine.git + +# checkout GlideinWMS for python3 +rm -rf glideinwms +git clone -b branch_v3_9 https://github.com/glideinWMS/glideinwms.git + +# Install dependencies for GlideinWMS +python3 -m pip install --upgrade pip +python3 -m pip install --upgrade wheel +python3 -m pip install -r glideinwms/requirements.txt + +# Install dependencies for DE Framework +python3 -m pip install --upgrade pip +python3 -m pip install --upgrade wheel +python3 -m pip install --upgrade pytest +python3 -m pip install --user Cython +python3 -m pip install --user numpy +(cd decisionengine/ ; python3 setup.py bdist_wheel) +python3 -m pip install --user decisionengine/dist/decisionengine*.whl + +# Install DE Modules dependencies +python3 -m pip install --upgrade pip +python3 -m pip install --upgrade pytest +python3 -m pip install -e . --user +python3 -m pip install -e .[develop] --user + +echo'' +python3 -m pip list + +# make sure the pipe doesn't eat failures +set -o pipefail + +# run the python "module/command" +export PYTHONPATH=${PWD}/src:${PYTHONPATH} +python3 ${CMD} 2>&1 | tee ${LOGFILE}