Skip to content

Commit

Permalink
add test docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpintarelli committed Aug 16, 2024
1 parent 87b6799 commit eaa8923
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 124 deletions.
33 changes: 12 additions & 21 deletions ci/cscs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,20 @@ build slurm base:
extends: [.container-builder-cscs-zen2, .my-dynamic-image-name]
stage: baseimage
timeout: 10h
variables:
CSCS_NOTIFICATION_CONTEXT: "$slurm_version"
DOCKERFILE: ci/slurm_docker/Dockerfile.base
DOCKER_BUILD_ARGS: '["SLURM_VERSION=$slurm_version"]'
WATCH_FILECHANGES: ci/slurm_docker/Dockerfile.base ci/slurm_docker/cgroup.conf ci/slurm_docker/entrypoint.sh ci/slurm_docker/install_slurm.sh ci/slurm_docker/slurm.conf.in
PERSIST_IMAGE_NAME: $CSCS_REGISTRY_PATH/base/public/slurm-base

build:
extends: [.container-builder-cscs-zen2, .my-dynamic-image-name]
needs: ["build slurm base"]
stage: buildtest
variables:
CSCS_NOTIFICATION_CONTEXT: "$slurm_version"
DOCKERFILE: ci/slurm_docker/Dockerfile
DOCKER_BUILD_ARGS: '["SLURM_VERSION=$slurm_version"]'
WATCH_FILECHANGES: ci/slurm_docker/Dockerfile ci/slurm_docker/cgroup.conf ci/slurm_docker/entrypoint.sh ci/slurm_docker/install_slurm.sh ci/slurm_docker/slurm.conf.in
WATCH_FILECHANGES: ci/slurm_docker/Dockerfile ci/slurm_docker/install_and_test.sh
PERSIST_IMAGE_NAME: $CSCS_REGISTRY_PATH/base/public/slurm-uenv-mount

# build:
# extends: .container-builder-cscs-zen2
# needs: ["build slurm base"]
# stage: buildtest
# image: $CSCS_REGISTRY_PATH/base/public/slurm-uenv-mount:$CI_COMMIT_SHA
# script:
# - |
# echo $PWD
# ls -al
# CXX=g++-12 CC=gcc-12 meson setup builddir
# meson install -C builddir
# echo "required /usr/local/lib64/libslurm-uenv-mount.so" > /etc/slurm/plugstack.conf
# # initialization
# /entrypoint.sh
# sinfo
# echo "Run tests in bash-bats"
# su testuser -c bash <<\EOF
# bats ci/tests
# EOF
107 changes: 4 additions & 103 deletions ci/slurm_docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,104 +1,5 @@
FROM opensuse/leap:15.4

ARG SLURM_VERSION=23.02.7
ARG SLURM_ROOT=/usr
ARG SLURM_CONFDIR=/etc/slurm

ENV SLURM_VERSION ${SLURM_VERSION}
ENV SLURM_ROOT ${SLURM_ROOT}
ENV SLURM_CONFDIR ${SLURM_CONFDIR}

RUN zypper install -y \
munge \
munge-devel \
libnuma1 \
libnuma-devel \
librrd8 \
readline-devel \
hwloc \
hwloc-devel \
lz4 \
liblz4-devel \
libz1 \
zlib-devel \
freeipmi \
freeipmi-devel \
dbus-1 \
dbus-1-devel \
make \
gcc12 \
gcc12-c++ \
curl \
tar \
bzip2 \
python3 \
vim \
ca-certificates \
less \
sudo \
fuse3-devel \
git \
sqlite3 \
sqlite3-devel \
libopenssl-devel \
util-linux \
util-linux-systemd \
squashfs \
rpm-build \
lua53 \
lua53-devel \
libmount-devel

RUN useradd -M slurm

RUN mkdir -p /var/log/slurm
RUN mkdir -p /var/spool/slurmctld && chown slurm /var/spool/slurmctld && chmod u+rwx /var/spool/slurmctld
RUN mkdir -p /var/spool/slurmd && chown slurm /var/spool/slurmd && chmod u+rwx /var/spool/slurmd


COPY ci/slurm_docker/install_slurm.sh .

RUN ./install_slurm.sh ${SLURM_VERSION} ${SLURM_ROOT} ${SLURM_CONFDIR} --enable-multiple-slurmd

RUN mkdir -p ${SLURM_CONFDIR}
COPY ci/slurm_docker/cgroup.conf ${SLURM_CONFDIR}
COPY ci/slurm_docker/slurm.conf.in ${SLURM_CONFDIR}

# slurm-uenv-mount
# install python
RUN curl -O https://www.python.org/ftp/python/3.10.11/Python-3.10.11.tgz \
&& tar xzvf Python-3.10.11.tgz \
&& cd Python-3.10.11 \
&& ./configure \
&& make install -j \
&& cd ../ && rm -r Python-3.10.11
RUN zypper --non-interactive rm libopenssl-devel

# rpmbuild > /usr/lib/rpm/macros.d/macros.meson are missing here ...
RUN python3 -m pip install --upgrade pip && python3 -m pip install meson ninja
RUN curl https://raw.githubusercontent.com/mesonbuild/meson/master/data/macros.meson -o /usr/lib/rpm/macros.d/macros.meson
# rpm build expects meson in /usr/bin/meson
RUN ln -s /usr/local/bin/meson /usr/bin/meson

# download bash-bats
RUN curl -L https://github.com/bats-core/bats-core/archive/refs/tags/v1.9.0.tar.gz | tar xz
RUN ln -s /bats-core-1.9.0/bin/bats /usr/bin/bats
RUN mkdir bats-helpers
RUN git clone --depth 1 https://github.com/bats-core/bats-assert.git bats-helpers/bats-assert
RUN git clone --depth 1 https://github.com/bats-core/bats-support.git bats-helpers/bats-support
ENV BATS_LIB_PATH /bats-helpers

RUN mkdir /user-environment
RUN mkdir /user-profilers
RUN mkdir /user-tools

RUN useradd testuser
RUN mkdir -p /home/testuser
RUN chown testuser /home/testuser

COPY ci/tests /tests

COPY ci/slurm_docker/entrypoint.sh .
ENTRYPOINT ["./entrypoint.sh"]
CMD ["bash"]
FROM ${BASE_IMAGE}

COPY . /src
WORKDIR /src
RUN ./ci/slurm_docker/install_and_test.sh

0 comments on commit eaa8923

Please sign in to comment.