From eaa8923bea3c31a80683e6acf0c44ab6ef53f699 Mon Sep 17 00:00:00 2001 From: Simon Pintarelli Date: Fri, 16 Aug 2024 22:31:45 +0200 Subject: [PATCH] add test docker container --- ci/cscs.yml | 33 +++++------- ci/slurm_docker/Dockerfile | 107 ++----------------------------------- 2 files changed, 16 insertions(+), 124 deletions(-) diff --git a/ci/cscs.yml b/ci/cscs.yml index f7ff270..ae4c8dc 100644 --- a/ci/cscs.yml +++ b/ci/cscs.yml @@ -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 diff --git a/ci/slurm_docker/Dockerfile b/ci/slurm_docker/Dockerfile index b47b008..630df0e 100644 --- a/ci/slurm_docker/Dockerfile +++ b/ci/slurm_docker/Dockerfile @@ -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