From ef1bf98fe245aefd0f184b35bbdb155303df2a89 Mon Sep 17 00:00:00 2001
From: Sylvester Joosten <sjoosten@anl.gov>
Date: Thu, 23 May 2019 11:41:11 -0500
Subject: [PATCH] added singularity CI
---
.gitlab-ci.yml | 35 ++++++++++++++++++++
containers/singularity/Singularity | 51 ++++++++++++++++++++++++++++++
2 files changed, 86 insertions(+)
create mode 100644 .gitlab-ci.yml
create mode 100644 containers/singularity/Singularity
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..a29f22b
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,35 @@
+image: eicweb.phy.anl.gov:4567/whit/image_recipes/root_base:latest
+#image: whit2333/root_base:latest
+#
+
+singularity-build:
+ tags:
+ - singularity
+ script:
+ #- docker login eicweb.phy.anl.gov:4567 -u whit -p ${CI_IMAGE_BUILD_PAT}
+ - cp containers/singularity/Singularity .
+ - /bin/bash .gitlabci/setup.sh
+ - /bin/bash .gitlabci/build.sh Singularity
+
+ - mkdir -p build && cp *.simg build
+ - mkdir -p build && cp Singularity* build
+
+ # Step 2. Take a look at "artifacts" below and add the paths you want added
+ # You can also add the entire build folder. You can also upload to storage
+ # clients defined by sregistry, here are some examples
+ # https://singularityhub.github.io/sregistry-cli/clients
+ # Environment variables must be defined in CI encrypted secrets/settings
+ # https://code.stanford.edu/help/ci/variables/README#variables).
+ #- /bin/bash build.sh --uri collection/container --cli google-storage Singularity
+ #- /bin/bash build.sh --uri collection/container --cli google-drive Singularity
+ #- /bin/bash build.sh --uri collection/container --cli globus Singularity
+ #- /bin/bash build.sh --uri collection/container --cli registry Singularity
+
+ # This is where you can save job artifacts
+ # https://docs.gitlab.com/ee/user/project/pipelines/job_artifacts.html
+ # You can specify the path to containers or the build folder to save.
+ # Don't forget to save your recipes too!
+ artifacts:
+ paths:
+ - build/Singularity.simg
+ - build/Singularity
diff --git a/containers/singularity/Singularity b/containers/singularity/Singularity
new file mode 100644
index 0000000..c5ec1fc
--- /dev/null
+++ b/containers/singularity/Singularity
@@ -0,0 +1,51 @@
+Bootstrap: docker
+From: eicweb.phy.anl.gov:4567/whit/image_recipes/root_base:latest
+
+%help
+ Container for file-input simc
+ Tools:
+ - simc : SIMC version that takes file input
+
+%labels
+ Maintainer "Sylvester Joosten"
+ Version v1.0
+
+%post -c /bin/bash
+ echo "Constructing simc container"
+ echo "1. ------------------------------------------"
+ echo "1. -- Building and installing SIMC
+ echo "1. ------------------------------------------"
+ source /usr/local/bin/thisroot.sh
+ export PYTHONPATH=/usr/local/lib:$PYTHONPATH
+ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
+ cd /tmp
+ git clone --recurse-submodules https://eicweb.phy.anl.gov/jlab/simc-file-input.git && \
+ mkdir build && cd build && cmake ../simc-file-input && make -j20 install
+ cd /tmp && rm -rf build simc-file-input
+
+# ===================================
+# GLOBAL
+# ===================================
+
+%environment -c /bin/bash
+ export PYTHONPATH=/usr/local/lib:$PYTHONPATH
+ export PATH=/usr/loca/bin:${PATH}
+ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
+ export ROOT_INCLUDE_PATH=/usr/local/include
+
+%runscript
+ echo "Launching a shell in the simc container."
+ echo "Use through singularity apps recommended (see help for more info)."
+ exec bash
+
+# ===================================
+# SIMC
+# ===================================
+%apprun simc
+ simc "%@"
+
+%appenv simc
+ export PYTHONPATH=/usr/local/lib:$PYTHONPATH
+ export PATH=/usr/loca/bin:${PATH}
+ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
+ export ROOT_INCLUDE_PATH=/usr/local/include
--
GitLab