Skip to content

Conversation

@shahzebsiddiqui
Copy link
Contributor

@shahzebsiddiqui shahzebsiddiqui commented Oct 23, 2017

edit (by @boegel): see new command line/configuration options:

  • --containerize/-C to enable generating of container recipes in path specified by --containerpath
  • various --container-* options to control the behavior
    • --container-build-image to enable building of container image with generating recipe by calling out to sudo singularity
    • --container-image-format to specify desired image of container images to be built (ext3, sandbox or squashfs (default))
    • --container-image-name to control name of generated container recipe & image

Currently relies on a base container image being used (to be specified via --container-base), see https://singularity-hub.org/collections/143.

Requires use of --experimental since the functionality is subject to change.

Documentation is in the works via easybuilders/easybuild#414

…cal Modules

and Flat Naming Scheme. Definition files are stored in $EASYBUILD_PACKAGEPATH.
Need thorough testing for other module naming schemes.
@shahzebsiddiqui
Copy link
Contributor Author

@boegel

[siddis14@amrndhl1157 easybuild-framework]$ ./eb M4-1.4.17-GCCcore-5.4.0.eb --package --package-tool=singularity --package-type=def --rebuild
== temporary log file in case of crash /tmp/eb-1BE82J/easybuild-tLhW4e.log
== processing EasyBuild easyconfig /nfs/grid/software/RHEL7/easybuild/software/Core/EasyBuild/3.4.0/lib/python2.7/site-packages/easybuild_easyconfigs-3.4.0-py2.7.egg/easybuild/easyconfigs/m/M4/M4-1.4.17-GCCcore-5.4.0.eb
== building and installing M4/1.4.17-GCCcore-5.4.0...
== fetching files...
== creating build dir, resetting environment...
== unpacking...
== patching...
== preparing...
== configuring...
== building...
== testing...
== installing...
== taking care of extensions...
== postprocessing...
== sanity checking...
== cleaning up...
== creating module...
== permissions...
== packaging...
== COMPLETED: Installation ended successfully
== Results of the build can be found in the log file(s) /home/siddis14/.local/easybuild/software/M4/1.4.17-GCCcore-5.4.0/easybuild/easybuild-M4-1.4.17-20171023.164149.log
== Build succeeded for 1 out of 1
== Temporary log file(s) /tmp/eb-1BE82J/easybuild-tLhW4e.log* have been removed.
== Temporary directory /tmp/eb-1BE82J has been removed.

The generated definition file

[siddis14@amrndhl1157 easybuild-framework]$ cat ~/.local/easybuild/packages/M4-1.4.17-GCCcore-5.4.0.def

# Copyright (c) 2015-2016, Gregory M. Kurtzer. All rights reserved.
#
# "Singularity" Copyright (c) 2016, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy).  All rights reserved.


BootStrap: docker
From: shahzebsiddiqui/easybuild


%post
su - easybuild
export EASYBUILD_INSTALLPATH=/app
export EASYBUILD_PREFIX=/scratch
export EASYBUILD_TMPDIR=/scratch/tmp

export EASYBUILD_MODULE_NAMING_SCHEME=EasyBuildMNS
module use /app/modules/all/
eb M4-1.4.17-GCCcore-5.4.0.eb --robot
exit

%runscript
eval "$@"

%environment
source /etc/profile
 module use /app/modules/all/
 module load M4/1.4.17-GCCcore-5.4.0

@boegel
Copy link
Member

boegel commented Oct 24, 2017

@shahzebsiddiqui This seems to be working on top of my commit in #2263, but somehow my commit is not included in your branch? That's a bit confusing...

Maybe you should issue a PR to my branch I used for #2263 instead (pkg_docker_singularity)?

In any case, the approach you took is way too hardcoded, we need to make it more flexible so people have some control over which base image is used, etc.

Also, I'd like to make it a self-contained .def file that starts from a base OS image like centos7 or so, i.e. include the Lmod & EB installation + installing dependency packages in it, for now.

What we probably need is support to let people provide a template .def file, where EasyBuild then fills in the blanks.

I'm also having second thoughts on leveraging --package for this, since building & installing the software first, and then generate a .def file alongside is rather silly, since you need to do the whole installation process again by asking Singularity to build the image...

In that sense, this is not a package at all, it's a recipe for a different tool that happens to use EasyBuild in it.

So, we probably need a dedicated option for this, rather than leveraging --package.

If we're still interested in letting EasyBuild call out to singularity to actually obtain an image directly, then it's a different matter (since you then obtain a 'package' directly), but as discussed I'm not sure that use case makes much sense for now...

alter bootstrap option when generating def file. Easybuild will write
definition file to $EASYBUILD_PACKAGEPATH for now. After definition file
is created it will try to build the container using
sudo singularity build <image> def_file.

This process assumes the user has sudo priviledge to run this operation
…uild this container

in shub and made easybuild reference my container.

More work needs to be done with tagging containers in shub to allow multiple container
types and option for building from different bootstrap process. Also work needs to be done
to figure out os dependency and automatically add them in recipe and install the packages
before installing app.
@shahzebsiddiqui
Copy link
Contributor Author

shahzebsiddiqui commented Oct 25, 2017

@boegel
Here is an initial implementation of building singularity images from easybuild. This implementation assumes you are using singularity 2.4 and using singularity build. There needs to be more thorough check for singularity version, if user is part of sudo group before proceeding with container build. Also there is no check in host filesystem if their is sufficient space to write this container.

[siddis14@amrndhl1157 easybuild-framework]$ ./eb --software=bzip2,1.0.6  --singularity
== temporary log file in case of crash /tmp/eb-ZWbz7S/easybuild-FBI4Ng.log
Singularity tool found at /usr/local/bin/singularity
Writing Singularity Definition File: /home/siddis14/.local/easybuild/packages/bzip2-1.0.6.def
Using container recipe deffile: bzip2-1.0.6.def
Sanitizing environment
Adding base Singularity environment to container
Progress |===================================| 100.0%
Exporting contents of shub://shahzebsiddiqui/easybuild-framework to /tmp/.singularity-build.rPN8Cw
User defined %runscript found! Taking priority.
Adding environment to container
Lmod has detected the following error: The following module(s) are unknown:
"bzip2/1.0.6"

Please check the spelling or version number. Also try "module spider ..."




Running post scriptlet
+ su - easybuild
== temporary log file in case of crash /scratch/tmp/eb-Kun5dH/easybuild-IpW4ZK.log
== resolving dependencies ...
== processing EasyBuild easyconfig /usr/easybuild/easyconfigs/b/bzip2/bzip2-1.0.6.eb
== building and installing bzip2/1.0.6...
== fetching files...
== creating build dir, resetting environment...
== unpacking...
== patching...
== preparing...
== configuring...
== building...
== testing...
== installing...
== taking care of extensions...
== postprocessing...
== sanity checking...
== cleaning up...
== creating module...
== permissions...
== packaging...
== COMPLETED: Installation ended successfully
== Results of the build can be found in the log file(s) /app/software/bzip2/1.0.6/easybuild/easybuild-bzip2-1.0.6-20171025.025236.log
== Build succeeded for 1 out of 1
== Temporary log file(s) /scratch/tmp/eb-Kun5dH/easybuild-IpW4ZK.log* have been removed.
== Temporary directory /scratch/tmp/eb-Kun5dH has been removed.
Adding runscript
Found an existing definition file
Adding a bootstrap_history directory
Finalizing Singularity container
Calculating final size for metadata...
comm: file 2 is not in sorted order
comm: file 2 is not in sorted order
Environment variables were added, removed, and/or changed during bootstrap.
Variables unique to original image (shahzebsiddiqui/easybuild-framework)
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PS1=Singularity>
PWD=/home/siddis14/.local/easybuild/packages
SHLVL=1
_=/usr/bin/printenv
Variables unique to new image (/tmp/.singularity-build.rPN8Cw)
BASH_ENV=/usr/share/lmod/lmod/init/bash
HISTCONTROL=ignoredups
HISTSIZE=1000
HOSTNAME=amrndhl1157.pfizer.com
KDEDIRS=/usr
LANG=en_US.UTF-8
LESSOPEN=||/usr/bin/lesspipe.sh
LMOD_arch=x86_64
LMOD_CMD=/usr/share/lmod/lmod/libexec/lmod
LMOD_COLORIZE=yes
LMOD_DEFAULT_MODULEPATH=/nfs/grid/software/RHEL7/non-easybuild/modules/all:/nfs/grid/software/RHEL7/easybuild/modules/all/Core:/nfs/grid/software/moduledomains:/etc/modulefiles:/usr/share/modulefiles:/usr/share/modulefiles/Linux:/usr/share/modulefiles/Core:/usr/share/lmod/lmod/modulefiles/Core
LMOD_DIR=/usr/share/lmod/lmod/libexec/
LMOD_FULL_SETTARG_SUPPORT=no
LMOD_PKG=/usr/share/lmod/lmod
LMOD_PREPEND_BLOCK=normal
LMOD_RC=/nfs/grid/software/modulessetup/config/lmodrc.lua
LMOD_SETTARG_CMD=:
LMOD_sys=Linux
LOGNAME=root
LS_COLORS=
MAIL=/var/spool/mail/root
MANPATH=/usr/share/lmod/lmod/share/man::
MODULEPATH=/nfs/grid/software/RHEL7/non-easybuild/modules/all:/nfs/grid/software/RHEL7/easybuild/modules/all/Core:/nfs/grid/software/moduledomains:/etc/modulefiles:/usr/share/modulefiles:/usr/share/modulefiles/Linux:/usr/share/modulefiles/Core:/usr/share/lmod/lmod/modulefiles/Core
MODULEPATH_ROOT=/usr/share/modulefiles
MODULESHOME=/usr/share/lmod/lmod
_ModuleTable001_=X01vZHVsZVRhYmxlXz17WyJhY3RpdmVTaXplIl09MCxiYXNlTXBhdGhBPXsiL25mcy9ncmlkL3NvZnR3YXJlL1JIRUw3L25vbi1lYXN5YnVpbGQvbW9kdWxlcy9hbGwiLCIvbmZzL2dyaWQvc29mdHdhcmUvUkhFTDcvZWFzeWJ1aWxkL21vZHVsZXMvYWxsL0NvcmUiLCIvbmZzL2dyaWQvc29mdHdhcmUvbW9kdWxlZG9tYWlucyIsIi9ldGMvbW9kdWxlZmlsZXMiLCIvdXNyL3NoYXJlL21vZHVsZWZpbGVzIiwiL3Vzci9zaGFyZS9tb2R1bGVmaWxlcy9MaW51eCIsIi91c3Ivc2hhcmUvbW9kdWxlZmlsZXMvQ29yZSIsIi91c3Ivc2hhcmUvbG1vZC9sbW9kL21vZHVsZWZpbGVzL0NvcmUiLH0sWyJjX3JlYnVpbGRUaW1lIl09ZmFsc2UsWyJjX3Nob3J0VGltZSJdPWZhbHNlLGZhbWls
_ModuleTable002_=eT17fSxpbmFjdGl2ZT17fSxtVD17fSxtcGF0aEE9eyIvbmZzL2dyaWQvc29mdHdhcmUvUkhFTDcvbm9uLWVhc3lidWlsZC9tb2R1bGVzL2FsbCIsIi9uZnMvZ3JpZC9zb2Z0d2FyZS9SSEVMNy9lYXN5YnVpbGQvbW9kdWxlcy9hbGwvQ29yZSIsIi9uZnMvZ3JpZC9zb2Z0d2FyZS9tb2R1bGVkb21haW5zIiwiL2V0Yy9tb2R1bGVmaWxlcyIsIi91c3Ivc2hhcmUvbW9kdWxlZmlsZXMiLCIvdXNyL3NoYXJlL21vZHVsZWZpbGVzL0xpbnV4IiwiL3Vzci9zaGFyZS9tb2R1bGVmaWxlcy9Db3JlIiwiL3Vzci9zaGFyZS9sbW9kL2xtb2QvbW9kdWxlZmlsZXMvQ29yZSIsfSxbInN5c3RlbUJhc2VNUEFUSCJdPSIvbmZzL2dyaWQvc29mdHdhcmUvUkhFTDcvbm9uLWVhc3lidWlsZC9tb2R1
_ModuleTable003_=bGVzL2FsbC86L25mcy9ncmlkL3NvZnR3YXJlL1JIRUw3L2Vhc3lidWlsZC9tb2R1bGVzL2FsbC9Db3JlOi9uZnMvZ3JpZC9zb2Z0d2FyZS9tb2R1bGVkb21haW5zOi9ldGMvbW9kdWxlZmlsZXM6L3Vzci9zaGFyZS9tb2R1bGVmaWxlczovdXNyL3NoYXJlL21vZHVsZWZpbGVzL0xpbnV4Oi91c3Ivc2hhcmUvbW9kdWxlZmlsZXMvQ29yZTovdXNyL3NoYXJlL2xtb2QvbG1vZC9tb2R1bGVmaWxlcy9Db3JlIixbInZlcnNpb24iXT0yLH0=
_ModuleTable_Sz_=3
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/cfengine/bin
PS1=Singularity>
PWD=/home/siddis14/.local/easybuild/packages
QT_GRAPHICSSYSTEM_CHECKED=1
QT_PLUGIN_PATH=/usr/lib64/kde4/plugins:/usr/lib/kde4/plugins
SHLVL=1
USER=root
_=/usr/bin/printenv
Skipping checks
Building Singularity image...
Singularity container built: bzip2-1.0.6.img
Cleaning up...

Singularity def and image file

[siddis14@amrndhl1157 packages]$ pwd
/home/siddis14/.local/easybuild/packages
[siddis14@amrndhl1157 packages]$ ls -l
total 222530
-rw-rw-r-- 1 siddis14 amer       319 Oct 24 22:52 bzip2-1.0.6.def
-rwxr-xr-x 1 siddis14 root 227868703 Oct 24 22:52 bzip2-1.0.6.img

Testing bzip2


[siddis14@amrndhl1157 packages]$ singularity run bzip2-1.0.6.img bzip2 --version
bzip2, a block-sorting file compressor.  Version 1.0.6, 6-Sept-2010.

   Copyright (C) 1996-2010 by Julian Seward.

   This program is free software; you can redistribute it and/or modify
   it under the terms set out in the LICENSE file, which is included
   in the bzip2-1.0.6 source distribution.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   LICENSE file for more details.

bzip2: I won't write compressed data to a terminal.
bzip2: For help, type: `bzip2 --help'.

@shahzebsiddiqui
Copy link
Contributor Author

For your reference, I have set shub as the default bootstrap and centos as the primary os.

[siddis14@amrndhl1157 easybuild-framework]$ ./eb --show-full-config | grep singularity
singularity                               (D) = False
singularity-bootstrap                     (D) = shub
singularity-os                            (D) = centos

You may note that OS release is not specified that maybe an option that user can pass. Right now I am using centos image from docker official channel since there is not an official centos image in shub.

…evel package.

Rename easybuild bootstrap file. SHUB uses extension for tagging so centos image
will have tag centos-7.3.1611
…ase to

control container properties.

By default eb will generate recipe file, but to enable container build from
eb you must pass --build-container. Default container size is 1024, eb will
do singularity image.create but in reality container will be resized in 2.4.
--container-size will be useful for singularity  <2.4 where you must use
singularity create first before bootstraping container.

%labels section adds architecture name, host and cpu model. Architecture
name is calculated by finding the model number.
@shahzebsiddiqui
Copy link
Contributor Author

I have created a new container in shub with tag "centos-7.3.1611". See https://www.singularity-hub.org/containers/567

Shown below is the latest changes with %labels that queries system info that can be queried by singularity

[siddis14@amrndhl1157 packages]$ cat bzip2-1.0.6.def
BootStrap: shub
From: shahzebsiddiqui/easybuild-framework:centos-7.3.1611

%post
su - easybuild
eb bzip2-1.0.6.eb --robot --installpath=/app/ --prefix=/scratch --tmpdir=/scratch/tmp  --module-naming-scheme=EasyBuildMNS
exit

%runscript
eval "$@"

%environment
source /etc/profile
module use /app/modules/all/
module load bzip2/1.0.6

%labels
Architecture IvyBridge
Host amrndhl1157.pfizer.com
CPU  Intel(R) Xeon(R) CPU E7-8891 v2 @ 3.20GHz
[siddis14@amrndhl1157 packages]$ singularity inspect --labels bzip2-1.0.6.img
{
    "org.label-schema.usage.singularity.deffile.bootstrap": "shub",
    "vendor": "CentOS",
    "name": "CentOS Base Image",
    "license": "GPLv2",
    "org.label-schema.usage": "/.singularity.d/runscript.help",
    "org.label-schema.schema-version": "1.0",
    "org.label-schema.build-size": "891MB",
    "HOST": "amrndhl1157.pfizer.com",
    "org.label-schema.usage.singularity.deffile.from": "shahzebsiddiqui/easybuild-framework:centos-7.3.1611",
    "ARCHITECTURE": "IvyBridge",
    "org.label-schema.build-date": "2017-10-26T16:29:56-04:00",
    "org.label-schema.usage.singularity.runscript.help": "/.singularity.d/runscript.help",
    "MAINTAINER": "Shahzeb Siddiqui",
    "org.label-schema.usage.singularity.version": "2.4-dist",
    "build-date": "20161214",
    "CPU": "Intel(R) Xeon(R) CPU E7-8891 v2 @ 3.20GHz",
    "org.label-schema.usage.singularity.deffile": "bzip2-1.0.6.def"
}

New flags in eb for singularity


  Singularity options:
    Options passed to EasyBuild for generating Singularity definition files. (configfile section singularity)

    --build-container=BUILD-CONTAINER
                        Build container will require sudo privileges!  (def False)
    --container-size=CONTAINER-SIZE
                        Size of container to allocate before building. Units in MB (def 1024)
    --singularity       Enabling Singularity Integration (def False)
    --singularity-bootstrap
                        Singularity bootstrap agent (def shub)
    --singularity-os=SINGULARITY-OS
                        Singularity container operating system  (def centos)
    --singularity-os-release=SINGULARITY-OS-RELEASE
                        Singularity container operating system release  (def 7.3.1611)

In order to use different OS and release we would need to create another bootstrap easybuild recipe and build in shub. This can be extended for Docker.

Next step would be to get os-dependency installed in %post section and then start installing toolchain containers in shub. We can bootstrap from shub if we provide a set of containers with different tags GCCcore-5.4.0, foss-2016b, gompi-2016b, ...

eb should be able to figure out the the Bootstrap line when generating recipe when --toolchain is specified.

@shahzebsiddiqui
Copy link
Contributor Author

@boegel Adding support for localimage bootstrap

[siddis14@amrndhl1157 easybuild-framework]$  eb --software=zlib,1.2.8 --singularity --bootstrap-imagepath=/nfs/grid/software/singularity/easybuild/easybuild-centos-7.3.1611.img
== temporary log file in case of crash /tmp/eb-ppHTZp/easybuild-rQwu_M.log
Singularity tool found at /usr/local/bin/singularity
Singularity version is 2.4 or higher ... OK
Singularity Version is 2.4
Writing Singularity Definition File: /home/siddis14/.local/easybuild/packages/zlib-1.2.8.def
[siddis14@amrndhl1157 easybuild-framework]$ cat /home/siddis14/.local/easybuild/packages/zlib-1.2.8.def
Bootstrap: localimage
From: /nfs/grid/software/singularity/easybuild/easybuild-centos-7.3.1611.img

%post
su - easybuild
eb zlib-1.2.8.eb --robot --installpath=/app/ --prefix=/scratch --tmpdir=/scratch/tmp  --module-naming-scheme=EasyBuildMNS
exit
rm -rf /scratch

%runscript
eval "$@"

%environment
source /etc/profile
module use /app/modules/all/
module load zlib/1.2.8

%labels
Architecture IvyBridge
Host amrndhl1157.pfizer.com
CPU  Intel(R) Xeon(R) CPU E7-8891 v2 @ 3.20GHz
[siddis14@amrndhl1157 easybuild-framework]$  eb --software=zlib,1.2.8 --singularity --bootstrap-imagepath=/nfs/grid/software/singularity/easybuild/easybuild-centos-7.3.1611.img --build-container=True
== temporary log file in case of crash /tmp/eb-TayMi9/easybuild-yDDqem.log
Singularity tool found at /usr/local/bin/singularity
Singularity version is 2.4 or higher ... OK
Singularity Version is 2.4
Writing Singularity Definition File: /home/siddis14/.local/easybuild/packages/zlib-1.2.8.def
[sudo] password for siddis14:
Creating empty 1024MiB image file: zlib-1.2.8.img
Formatting image with ext3 file system
Image is done: zlib-1.2.8.img
Building into existing container: zlib-1.2.8.img
Using container recipe deffile: zlib-1.2.8.def
Sanitizing environment
Adding base Singularity environment to container
Exporting contents of /nfs/grid/software/singularity/easybuild/easybuild-centos-7.3.1611.img to /tmp/.singularity-build.om7qaO
User defined %runscript found! Taking priority.
Adding environment to container
Lmod has detected the following error: These module(s) exist but cannot be
loaded as requested: "zlib/1.2.8"

   Try: "module spider zlib/1.2.8" to see how to load the module(s).





Running post scriptlet
+ su - easybuild
== temporary log file in case of crash /scratch/tmp/eb-ugWET8/easybuild-bgfJNV.log
== resolving dependencies ...
== processing EasyBuild easyconfig /usr/easybuild/easyconfigs/z/zlib/zlib-1.2.8.eb
== building and installing zlib/1.2.8...
== fetching files...
== creating build dir, resetting environment...
== unpacking...
== patching...
== preparing...
== configuring...
== building...
== testing...
== installing...
== taking care of extensions...
== postprocessing...
== sanity checking...
== cleaning up...
== creating module...
== permissions...
== packaging...
== COMPLETED: Installation ended successfully
== Results of the build can be found in the log file(s) /app/software/zlib/1.2.8/easybuild/easybuild-zlib-1.2.8-20171102.152547.log
== Build succeeded for 1 out of 1
== Temporary log file(s) /scratch/tmp/eb-ugWET8/easybuild-bgfJNV.log* have been removed.
== Temporary directory /scratch/tmp/eb-ugWET8 has been removed.
+ rm -rf /scratch
Adding deffile section labels to container
Adding runscript
Found an existing definition file
Adding a bootstrap_history directory
Finalizing Singularity container
Calculating final size for metadata...
comm: file 2 is not in sorted order
comm: file 2 is not in sorted order
Environment variables were added, removed, and/or changed during bootstrap.
Variables unique to original image (/nfs/grid/software/singularity/easybuild/easybuild-centos-7.3.1611.img)
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PS1=Singularity>
PWD=/home/siddis14/.local/easybuild/packages
SHLVL=1
_=/usr/bin/printenv
Variables unique to new image (/tmp/.singularity-build.om7qaO)
BASH_ENV=/usr/share/lmod/lmod/init/bash
HISTCONTROL=ignoredups
HISTSIZE=1000
HOSTNAME=amrndhl1157.pfizer.com
KDEDIRS=/usr
LANG=en_US.UTF-8
LESSOPEN=||/usr/bin/lesspipe.sh
LMOD_arch=x86_64
LMOD_CMD=/usr/share/lmod/lmod/libexec/lmod
LMOD_COLORIZE=yes
LMOD_DEFAULT_MODULEPATH=/nfs/grid/software/RHEL7/non-easybuild/modules/all:/nfs/grid/software/RHEL7/easybuild/modules/all/Core:/nfs/grid/software/moduledomains:/etc/modulefiles:/usr/share/modulefiles:/usr/share/modulefiles/Linux:/usr/share/modulefiles/Core:/usr/share/lmod/lmod/modulefiles/Core
LMOD_DIR=/usr/share/lmod/lmod/libexec/
LMOD_FULL_SETTARG_SUPPORT=no
LMOD_PKG=/usr/share/lmod/lmod
LMOD_PREPEND_BLOCK=normal
LMOD_RC=/nfs/grid/software/modulessetup/config/lmodrc.lua
LMOD_SETTARG_CMD=:
LMOD_sys=Linux
LOGNAME=root
LS_COLORS=
MAIL=/var/spool/mail/root
MANPATH=/usr/share/lmod/lmod/share/man::
MODULEPATH=/nfs/grid/software/RHEL7/non-easybuild/modules/all:/nfs/grid/software/RHEL7/easybuild/modules/all/Core:/nfs/grid/software/moduledomains:/etc/modulefiles:/usr/share/modulefiles:/usr/share/modulefiles/Linux:/usr/share/modulefiles/Core:/usr/share/lmod/lmod/modulefiles/Core
MODULEPATH_ROOT=/usr/share/modulefiles
MODULESHOME=/usr/share/lmod/lmod
_ModuleTable001_=X01vZHVsZVRhYmxlXz17WyJhY3RpdmVTaXplIl09MCxiYXNlTXBhdGhBPXsiL25mcy9ncmlkL3NvZnR3YXJlL1JIRUw3L25vbi1lYXN5YnVpbGQvbW9kdWxlcy9hbGwiLCIvbmZzL2dyaWQvc29mdHdhcmUvUkhFTDcvZWFzeWJ1aWxkL21vZHVsZXMvYWxsL0NvcmUiLCIvbmZzL2dyaWQvc29mdHdhcmUvbW9kdWxlZG9tYWlucyIsIi9ldGMvbW9kdWxlZmlsZXMiLCIvdXNyL3NoYXJlL21vZHVsZWZpbGVzIiwiL3Vzci9zaGFyZS9tb2R1bGVmaWxlcy9MaW51eCIsIi91c3Ivc2hhcmUvbW9kdWxlZmlsZXMvQ29yZSIsIi91c3Ivc2hhcmUvbG1vZC9sbW9kL21vZHVsZWZpbGVzL0NvcmUiLH0sWyJjX3JlYnVpbGRUaW1lIl09ZmFsc2UsWyJjX3Nob3J0VGltZSJdPWZhbHNlLGZhbWls
_ModuleTable002_=eT17fSxpbmFjdGl2ZT17fSxtVD17fSxtcGF0aEE9eyIvbmZzL2dyaWQvc29mdHdhcmUvUkhFTDcvbm9uLWVhc3lidWlsZC9tb2R1bGVzL2FsbCIsIi9uZnMvZ3JpZC9zb2Z0d2FyZS9SSEVMNy9lYXN5YnVpbGQvbW9kdWxlcy9hbGwvQ29yZSIsIi9uZnMvZ3JpZC9zb2Z0d2FyZS9tb2R1bGVkb21haW5zIiwiL2V0Yy9tb2R1bGVmaWxlcyIsIi91c3Ivc2hhcmUvbW9kdWxlZmlsZXMiLCIvdXNyL3NoYXJlL21vZHVsZWZpbGVzL0xpbnV4IiwiL3Vzci9zaGFyZS9tb2R1bGVmaWxlcy9Db3JlIiwiL3Vzci9zaGFyZS9sbW9kL2xtb2QvbW9kdWxlZmlsZXMvQ29yZSIsfSxbInN5c3RlbUJhc2VNUEFUSCJdPSIvbmZzL2dyaWQvc29mdHdhcmUvUkhFTDcvbm9uLWVhc3lidWlsZC9tb2R1
_ModuleTable003_=bGVzL2FsbC86L25mcy9ncmlkL3NvZnR3YXJlL1JIRUw3L2Vhc3lidWlsZC9tb2R1bGVzL2FsbC9Db3JlOi9uZnMvZ3JpZC9zb2Z0d2FyZS9tb2R1bGVkb21haW5zOi9ldGMvbW9kdWxlZmlsZXM6L3Vzci9zaGFyZS9tb2R1bGVmaWxlczovdXNyL3NoYXJlL21vZHVsZWZpbGVzL0xpbnV4Oi91c3Ivc2hhcmUvbW9kdWxlZmlsZXMvQ29yZTovdXNyL3NoYXJlL2xtb2QvbG1vZC9tb2R1bGVmaWxlcy9Db3JlIixbInZlcnNpb24iXT0yLH0=
_ModuleTable_Sz_=3
PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/cfengine/bin
PS1=Singularity>
PWD=/home/siddis14/.local/easybuild/packages
QTDIR=/usr/lib64/qt-3.3
QT_GRAPHICSSYSTEM_CHECKED=1
QTINC=/usr/lib64/qt-3.3/include
QTLIB=/usr/lib64/qt-3.3/lib
QT_PLUGIN_PATH=/usr/lib64/kde4/plugins:/usr/lib/kde4/plugins
SHLVL=1
USER=root
_=/usr/bin/printenv
Skipping checks
Building Singularity image...
Singularity container built: zlib-1.2.8.img
Cleaning up...

…alimage

bootstrap option. Image must be of extension .img or .simg according
to singularity.

Its up to user to ensure the local image is built correctly when using
it as a bootstrap agent
creating custom image name during singularity build.
…rectories

in /scratch in container to strip everything out. /scratch still needs to be
present in container for bootstraping again since --prefix requires /scratch to
be created in advance.

Toolchain container boostrap progression: GCCcore-5.4.0 -> GCC-5.4.0-2.26 ->
gompi-2016b -> foss-2016b
@shahzebsiddiqui
Copy link
Contributor Author

Support for --image-name which can override default naming scheme for images.

[siddis14@amrndhl1157 easybuild-framework]$ eb --software=git-lfs,1.1.1 --singularity --build-container=True --image-name=git-lfs.img
== temporary log file in case of crash /tmp/eb-zCYjQL/easybuild-RZDx7k.log
Singularity tool found at /usr/local/bin/singularity
Singularity version is 2.4 or higher ... OK
Singularity Version is 2.4
Writing Singularity Definition File: /home/siddis14/.local/easybuild/packages/git-lfs-1.1.1.def
[sudo] password for siddis14:
Creating empty 1024MiB image file: git-lfs.img
Formatting image with ext3 file system
Image is done: git-lfs.img
Building into existing container: git-lfs.img
Using container recipe deffile: git-lfs-1.1.1.def
Sanitizing environment
Adding base Singularity environment to container
Progress |===================================| 100.0%
Exporting contents of shub://shahzebsiddiqui/easybuild-framework:centos-7.3.1611 to /tmp/.singularity-build.pXLASd
User defined %runscript found! Taking priority.
Adding environment to container
Running post scriptlet
+ su - easybuild
== temporary log file in case of crash /scratch/tmp/eb-BQFO6l/easybuild-5o93q9.log
== resolving dependencies ...
== processing EasyBuild easyconfig /usr/easybuild/easyconfigs/g/git-lfs/git-lfs-1.1.1.eb
== building and installing git-lfs/1.1.1...
== fetching files...
== creating build dir, resetting environment...
== unpacking...
== patching...
== preparing...
== configuring...
== building...
== testing...
== installing...
== taking care of extensions...
== postprocessing...
== sanity checking...
== cleaning up...
== creating module...
== permissions...
== packaging...
== COMPLETED: Installation ended successfully
== Results of the build can be found in the log file(s) /app/software/git-lfs/1.1.1/easybuild/easybuild-git-lfs-1.1.1-20171102.224035.log
== Build succeeded for 1 out of 1
== Temporary log file(s) /scratch/tmp/eb-BQFO6l/easybuild-5o93q9.log* have been removed.
== Temporary directory /scratch/tmp/eb-BQFO6l has been removed.
+ rm -rf '/scratch/tmp/*'
+ rm -rf /scratch/build
+ rm -rf /scratch/sources
+ rm -rf /scratch/ebfiles_repo
Adding deffile section labels to container
Adding runscript
Found an existing definition file
Adding a bootstrap_history directory
Finalizing Singularity container
Calculating final size for metadata...
comm: file 2 is not in sorted order
comm: file 2 is not in sorted order
Environment variables were added, removed, and/or changed during bootstrap.
Variables unique to original image (shahzebsiddiqui/easybuild-framework:centos-7.3.1611)
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PS1=Singularity>
PWD=/home/siddis14/.local/easybuild/packages
SHLVL=1
_=/usr/bin/printenv
Variables unique to new image (/tmp/.singularity-build.pXLASd)
BASH_ENV=/usr/share/lmod/lmod/init/bash
EBDEVELGITMINLFS=/nfs/grid/software/RHEL7/easybuild/software/Core/git-lfs/1.1.1/easybuild/Core-git-lfs-1.1.1-easybuild-devel
EBROOTGITMINLFS=/nfs/grid/software/RHEL7/easybuild/software/Core/git-lfs/1.1.1
EBVERSIONGITMINLFS=1.1.1
HISTCONTROL=ignoredups
HISTSIZE=1000
HOSTNAME=amrndhl1157.pfizer.com
KDEDIRS=/usr
LANG=en_US.UTF-8
LESSOPEN=||/usr/bin/lesspipe.sh
_LMFILES_=/nfs/grid/software/RHEL7/easybuild/modules/all/Core/git-lfs/1.1.1.lua
LMOD_arch=x86_64
LMOD_CMD=/usr/share/lmod/lmod/libexec/lmod
LMOD_COLORIZE=yes
LMOD_DEFAULT_MODULEPATH=/nfs/grid/software/RHEL7/non-easybuild/modules/all:/nfs/grid/software/RHEL7/easybuild/modules/all/Core:/nfs/grid/software/moduledomains:/etc/modulefiles:/usr/share/modulefiles:/usr/share/modulefiles/Linux:/usr/share/modulefiles/Core:/usr/share/lmod/lmod/modulefiles/Core
LMOD_DIR=/usr/share/lmod/lmod/libexec/
LMOD_FULL_SETTARG_SUPPORT=no
LMOD_PKG=/usr/share/lmod/lmod
LMOD_PREPEND_BLOCK=normal
LMOD_RC=/nfs/grid/software/modulessetup/config/lmodrc.lua
LMOD_SETTARG_CMD=:
LMOD_sys=Linux
LOADEDMODULES=git-lfs/1.1.1
LOGNAME=root
LS_COLORS=
MAIL=/var/spool/mail/root
MANPATH=/usr/share/lmod/lmod/share/man::
MODULEPATH=/nfs/grid/software/RHEL7/non-easybuild/modules/all:/nfs/grid/software/RHEL7/easybuild/modules/all/Core:/nfs/grid/software/moduledomains:/etc/modulefiles:/usr/share/modulefiles:/usr/share/modulefiles/Linux:/usr/share/modulefiles/Core:/usr/share/lmod/lmod/modulefiles/Core
MODULEPATH_ROOT=/usr/share/modulefiles
MODULESHOME=/usr/share/lmod/lmod
_ModuleTable001_=X01vZHVsZVRhYmxlXz17WyJhY3RpdmVTaXplIl09MSxiYXNlTXBhdGhBPXsiL25mcy9ncmlkL3NvZnR3YXJlL1JIRUw3L25vbi1lYXN5YnVpbGQvbW9kdWxlcy9hbGwiLCIvbmZzL2dyaWQvc29mdHdhcmUvUkhFTDcvZWFzeWJ1aWxkL21vZHVsZXMvYWxsL0NvcmUiLCIvbmZzL2dyaWQvc29mdHdhcmUvbW9kdWxlZG9tYWlucyIsIi9ldGMvbW9kdWxlZmlsZXMiLCIvdXNyL3NoYXJlL21vZHVsZWZpbGVzIiwiL3Vzci9zaGFyZS9tb2R1bGVmaWxlcy9MaW51eCIsIi91c3Ivc2hhcmUvbW9kdWxlZmlsZXMvQ29yZSIsIi91c3Ivc2hhcmUvbG1vZC9sbW9kL21vZHVsZWZpbGVzL0NvcmUiLH0sWyJjX3JlYnVpbGRUaW1lIl09ZmFsc2UsWyJjX3Nob3J0VGltZSJdPWZhbHNlLGZhbWls
_ModuleTable002_=eT17fSxpbmFjdGl2ZT17fSxtVD17WyJnaXQtbGZzIl09e1siRk4iXT0iL25mcy9ncmlkL3NvZnR3YXJlL1JIRUw3L2Vhc3lidWlsZC9tb2R1bGVzL2FsbC9Db3JlL2dpdC1sZnMvMS4xLjEubHVhIixbImRlZmF1bHQiXT0wLFsiZnVsbE5hbWUiXT0iZ2l0LWxmcy8xLjEuMSIsWyJsb2FkT3JkZXIiXT0xLHByb3BUPXt9LFsic2hvcnQiXT0iZ2l0LWxmcyIsWyJzdGF0dXMiXT0iYWN0aXZlIix9LH0sbXBhdGhBPXsiL25mcy9ncmlkL3NvZnR3YXJlL1JIRUw3L25vbi1lYXN5YnVpbGQvbW9kdWxlcy9hbGwiLCIvbmZzL2dyaWQvc29mdHdhcmUvUkhFTDcvZWFzeWJ1aWxkL21vZHVsZXMvYWxsL0NvcmUiLCIvbmZzL2dyaWQvc29mdHdhcmUvbW9kdWxlZG9tYWlucyIsIi9ldGMvbW9k
_ModuleTable003_=dWxlZmlsZXMiLCIvdXNyL3NoYXJlL21vZHVsZWZpbGVzIiwiL3Vzci9zaGFyZS9tb2R1bGVmaWxlcy9MaW51eCIsIi91c3Ivc2hhcmUvbW9kdWxlZmlsZXMvQ29yZSIsIi91c3Ivc2hhcmUvbG1vZC9sbW9kL21vZHVsZWZpbGVzL0NvcmUiLH0sWyJzeXN0ZW1CYXNlTVBBVEgiXT0iL25mcy9ncmlkL3NvZnR3YXJlL1JIRUw3L25vbi1lYXN5YnVpbGQvbW9kdWxlcy9hbGwvOi9uZnMvZ3JpZC9zb2Z0d2FyZS9SSEVMNy9lYXN5YnVpbGQvbW9kdWxlcy9hbGwvQ29yZTovbmZzL2dyaWQvc29mdHdhcmUvbW9kdWxlZG9tYWluczovZXRjL21vZHVsZWZpbGVzOi91c3Ivc2hhcmUvbW9kdWxlZmlsZXM6L3Vzci9zaGFyZS9tb2R1bGVmaWxlcy9MaW51eDovdXNyL3NoYXJlL21vZHVsZWZp
_ModuleTable004_=bGVzL0NvcmU6L3Vzci9zaGFyZS9sbW9kL2xtb2QvbW9kdWxlZmlsZXMvQ29yZSIsWyJ2ZXJzaW9uIl09Mix9
_ModuleTable_Sz_=4
PATH=/nfs/grid/software/RHEL7/easybuild/software/Core/git-lfs/1.1.1:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/cfengine/bin
PS1=Singularity>
PWD=/home/siddis14/.local/easybuild/packages
QTDIR=/usr/lib64/qt-3.3
QT_GRAPHICSSYSTEM_CHECKED=1
QTINC=/usr/lib64/qt-3.3/include
QTLIB=/usr/lib64/qt-3.3/lib
QT_PLUGIN_PATH=/usr/lib64/kde4/plugins:/usr/lib/kde4/plugins
SHLVL=1
USER=root
_=/usr/bin/printenv
Skipping checks
Building Singularity image...
Singularity container built: git-lfs.img
Cleaning up...
[siddis14@amrndhl1157 easybuild-framework]$ ls -l ~/.local/easybuild/packages/git-lfs*
-rw-rw-r-- 1 siddis14 amer       542 Nov  2 18:40 /home/siddis14/.local/easybuild/packages/git-lfs-1.1.1.def
-rwxr-xr-x 1 siddis14 root 221814815 Nov  2 18:40 /home/siddis14/.local/easybuild/packages/git-lfs.img

to ensure this builds properly with Travis
Add option --container-path for controlling where to write container images.
container formats (squashfs, ext3, sandbox). This option only
affects when building container using --build-container=True.

.simg is used with squashfs, while .img is used with ext3
@shahzebsiddiqui
Copy link
Contributor Author

Singularity Options

  Singularity options:
    Options passed to EasyBuild for generating Singularity definition files. (configfile section singularity)

    --bootstrap-imagepath=BOOTSTRAP-IMAGEPATH
                        Image path used for localimage bootstrap type
    --build-container=BUILD-CONTAINER
                        Build container will require sudo privileges!  (def False)
    --container-path=CONTAINER-PATH
                        Path where container will be written. Defaults to $EASYBUILD_PACKAGEPATH
    --container-size=CONTAINER-SIZE
                        Size of container to allocate before building. Units in MB (def 1024)
    --image-format=IMAGE-FORMAT
                        Image format for singularity container. (type choice; def squashfs) (choices: squashfs, ext3, sandbox)
    --image-name=IMAGE-NAME
                        Custom name of image (defaults to name of easyconfig)
    --singularity       Enabling Singularity Integration (def False)
    --singularity-bootstrap=SINGULARITY-BOOTSTRAP
                        Singularity bootstrap agent (def shub)
    --singularity-os=SINGULARITY-OS
                        Singularity container operating system  (def centos)
    --singularity-os-release=SINGULARITY-OS-RELEASE
                        Singularity container operating system release  (def 7.3.1611)

@shahzebsiddiqui
Copy link
Contributor Author

shahzebsiddiqui commented Jan 8, 2018

Using example --container-path

[siddis14@amrndhl1157 easybuild-framework]$ ./eb --software=bzip2,1.0.6 --singularity --container-path=/tmp --build-container=True
== temporary log file in case of crash /tmp/eb-WZFC0t/easybuild-sxHNJe.log

WARNING: Found one or more non-allowed loaded (EasyBuild-generated) modules in current environment:
* Anaconda2/4.2.0

This is not recommended since it may affect the installation procedure(s) performed by EasyBuild.

To make EasyBuild allow particular loaded modules, use the --allow-loaded-modules configuration option.
To specify action to take when loaded modules are detected, use --detect-loaded-modules={error,ignore,purge,unload,warn}.

See http://easybuild.readthedocs.io/en/latest/Detecting_loaded_modules.html for more information.

Singularity tool found at /usr/local/bin/singularity
Singularity version is 2.4 or higher ... OK
Singularity Version is 2.4
Writing Singularity Definition File: /tmp/bzip2-1.0.6.def
[sudo] password for siddis14:
Creating empty 1024MiB image file: bzip2-1.0.6.simg
Formatting image with ext3 file system
Image is done: bzip2-1.0.6.simg
Building into existing container: bzip2-1.0.6.simg
Using container recipe deffile: bzip2-1.0.6.def
Sanitizing environment
Adding base Singularity environment to container
Progress |===================================| 100.0%
Exporting contents of shub://shahzebsiddiqui/easybuild-framework:centos-7.3.1611 to /tmp/.singularity-build.F5Lyjy
User defined %runscript found! Taking priority.
Adding environment to container
Lmod has detected the following error: The following module(s) are unknown:
"bzip2/1.0.6"

Please check the spelling or version number. Also try "module spider ..."




Running post scriptlet
+ su - easybuild
== temporary log file in case of crash /scratch/tmp/eb-pGGcaB/easybuild-4hb6pW.log
== resolving dependencies ...
== processing EasyBuild easyconfig /usr/easybuild/easyconfigs/b/bzip2/bzip2-1.0.6.eb
== building and installing bzip2/1.0.6...
== fetching files...
== creating build dir, resetting environment...
== unpacking...
== patching...
== preparing...
== configuring...
== building...
== testing...
== installing...
== taking care of extensions...
== postprocessing...
== sanity checking...
== cleaning up...
== creating module...
== permissions...
== packaging...
== COMPLETED: Installation ended successfully
== Results of the build can be found in the log file(s) /app/software/bzip2/1.0.6/easybuild/easybuild-bzip2-1.0.6-20180108.160743.log
== Build succeeded for 1 out of 1
== Temporary log file(s) /scratch/tmp/eb-pGGcaB/easybuild-4hb6pW.log* have been removed.
== Temporary directory /scratch/tmp/eb-pGGcaB has been removed.
+ rm -rf '/scratch/tmp/*'
+ rm -rf /scratch/build
+ rm -rf /scratch/sources
+ rm -rf /scratch/ebfiles_repo
Adding deffile section labels to container
Adding runscript
Found an existing definition file
Adding a bootstrap_history directory
Finalizing Singularity container
Calculating final size for metadata...
comm: file 2 is not in sorted order
comm: file 2 is not in sorted order
Environment variables were added, removed, and/or changed during bootstrap.
Variables unique to original image (shahzebsiddiqui/easybuild-framework:centos-7.3.1611)
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PS1=Singularity>
PWD=/tmp
SHLVL=1
_=/usr/bin/printenv
Variables unique to new image (/tmp/.singularity-build.F5Lyjy)
BASH_ENV=/usr/share/lmod/lmod/init/bash
HISTCONTROL=ignoredups
HISTSIZE=1000
HOSTNAME=amrndhl1157.pfizer.com
KDEDIRS=/usr
LANG=en_US.UTF-8
LESSOPEN=||/usr/bin/lesspipe.sh
LMOD_arch=x86_64
LMOD_CMD=/usr/share/lmod/lmod/libexec/lmod
LMOD_COLORIZE=yes
LMOD_DEFAULT_MODULEPATH=/nfs/grid/software/RHEL7/non-easybuild/modules/all:/nfs/grid/software/RHEL7/easybuild/modules/all/Core:/nfs/grid/software/moduledomains:/etc/modulefiles:/usr/share/modulefiles:/usr/share/modulefiles/Linux:/usr/share/modulefiles/Core:/usr/share/lmod/lmod/modulefiles/Core
LMOD_DIR=/usr/share/lmod/lmod/libexec/
LMOD_FULL_SETTARG_SUPPORT=no
LMOD_PKG=/usr/share/lmod/lmod
LMOD_PREPEND_BLOCK=normal
LMOD_RC=/nfs/grid/software/modulessetup/config/lmodrc.lua
LMOD_SETTARG_CMD=:
LMOD_sys=Linux
LOGNAME=root
LS_COLORS=
MAIL=/var/spool/mail/root
MANPATH=/usr/share/lmod/lmod/share/man::
MODULEPATH=/nfs/grid/software/RHEL7/non-easybuild/modules/all:/nfs/grid/software/RHEL7/easybuild/modules/all/Core:/nfs/grid/software/moduledomains:/etc/modulefiles:/usr/share/modulefiles:/usr/share/modulefiles/Linux:/usr/share/modulefiles/Core:/usr/share/lmod/lmod/modulefiles/Core
MODULEPATH_ROOT=/usr/share/modulefiles
MODULESHOME=/usr/share/lmod/lmod
_ModuleTable001_=X01vZHVsZVRhYmxlXz17WyJhY3RpdmVTaXplIl09MCxiYXNlTXBhdGhBPXsiL25mcy9ncmlkL3NvZnR3YXJlL1JIRUw3L25vbi1lYXN5YnVpbGQvbW9kdWxlcy9hbGwiLCIvbmZzL2dyaWQvc29mdHdhcmUvUkhFTDcvZWFzeWJ1aWxkL21vZHVsZXMvYWxsL0NvcmUiLCIvbmZzL2dyaWQvc29mdHdhcmUvbW9kdWxlZG9tYWlucyIsIi9ldGMvbW9kdWxlZmlsZXMiLCIvdXNyL3NoYXJlL21vZHVsZWZpbGVzIiwiL3Vzci9zaGFyZS9tb2R1bGVmaWxlcy9MaW51eCIsIi91c3Ivc2hhcmUvbW9kdWxlZmlsZXMvQ29yZSIsIi91c3Ivc2hhcmUvbG1vZC9sbW9kL21vZHVsZWZpbGVzL0NvcmUiLH0sWyJjX3JlYnVpbGRUaW1lIl09ZmFsc2UsWyJjX3Nob3J0VGltZSJdPWZhbHNlLGZhbWls
_ModuleTable002_=eT17fSxpbmFjdGl2ZT17fSxtVD17fSxtcGF0aEE9eyIvbmZzL2dyaWQvc29mdHdhcmUvUkhFTDcvbm9uLWVhc3lidWlsZC9tb2R1bGVzL2FsbCIsIi9uZnMvZ3JpZC9zb2Z0d2FyZS9SSEVMNy9lYXN5YnVpbGQvbW9kdWxlcy9hbGwvQ29yZSIsIi9uZnMvZ3JpZC9zb2Z0d2FyZS9tb2R1bGVkb21haW5zIiwiL2V0Yy9tb2R1bGVmaWxlcyIsIi91c3Ivc2hhcmUvbW9kdWxlZmlsZXMiLCIvdXNyL3NoYXJlL21vZHVsZWZpbGVzL0xpbnV4IiwiL3Vzci9zaGFyZS9tb2R1bGVmaWxlcy9Db3JlIiwiL3Vzci9zaGFyZS9sbW9kL2xtb2QvbW9kdWxlZmlsZXMvQ29yZSIsfSxbInN5c3RlbUJhc2VNUEFUSCJdPSIvbmZzL2dyaWQvc29mdHdhcmUvUkhFTDcvbm9uLWVhc3lidWlsZC9tb2R1
_ModuleTable003_=bGVzL2FsbC86L25mcy9ncmlkL3NvZnR3YXJlL1JIRUw3L2Vhc3lidWlsZC9tb2R1bGVzL2FsbC9Db3JlOi9uZnMvZ3JpZC9zb2Z0d2FyZS9tb2R1bGVkb21haW5zOi9ldGMvbW9kdWxlZmlsZXM6L3Vzci9zaGFyZS9tb2R1bGVmaWxlczovdXNyL3NoYXJlL21vZHVsZWZpbGVzL0xpbnV4Oi91c3Ivc2hhcmUvbW9kdWxlZmlsZXMvQ29yZTovdXNyL3NoYXJlL2xtb2QvbG1vZC9tb2R1bGVmaWxlcy9Db3JlIixbInZlcnNpb24iXT0yLH0=
_ModuleTable_Sz_=3
PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/cfengine/bin
PS1=Singularity>
PWD=/tmp
QTDIR=/usr/lib64/qt-3.3
QT_GRAPHICSSYSTEM_CHECKED=1
QTINC=/usr/lib64/qt-3.3/include
QTLIB=/usr/lib64/qt-3.3/lib
QT_PLUGIN_PATH=/usr/lib64/kde4/plugins:/usr/lib/kde4/plugins
SHLVL=1
USER=root
_=/usr/bin/printenv
Skipping checks
Building Singularity image...
Singularity container built: bzip2-1.0.6.simg
Cleaning up...
[siddis14@amrndhl1157 easybuild-framework]$ ls -l /tmp/bzip2*
-rw-rw-r-- 1 siddis14 amer       538 Jan  8 11:07 /tmp/bzip2-1.0.6.def
-rwxr-xr-x 1 root     root 218992671 Jan  8 11:07 /tmp/bzip2-1.0.6.simg
[siddis14@amrndhl1157 easybuild-framework]$ sudo singularity shell --writable /tmp/bzip2-1.0.6.simg
[sudo] password for siddis14:
ERROR  : Unable to open squashfs image in read-write mode: Read-only file system
ABORT  : Retval = 255

@shahzebsiddiqui
Copy link
Contributor Author

example with ext3 image format

[siddis14@amrndhl1157 easybuild-framework]$ ./eb --software=bzip2,1.0.6 --singularity --container-path=/tmp --image-format ext3 --build-container=True
== temporary log file in case of crash /tmp/eb-HUmbYX/easybuild-Cu08ob.log

WARNING: Found one or more non-allowed loaded (EasyBuild-generated) modules in current environment:
* Anaconda2/4.2.0

This is not recommended since it may affect the installation procedure(s) performed by EasyBuild.

To make EasyBuild allow particular loaded modules, use the --allow-loaded-modules configuration option.
To specify action to take when loaded modules are detected, use --detect-loaded-modules={error,ignore,purge,unload,warn}.

See http://easybuild.readthedocs.io/en/latest/Detecting_loaded_modules.html for more information.

Singularity tool found at /usr/local/bin/singularity
Singularity version is 2.4 or higher ... OK
Singularity Version is 2.4
Writing Singularity Definition File: /tmp/bzip2-1.0.6.def
Creating empty 1024MiB image file: bzip2-1.0.6.img
Formatting image with ext3 file system
Image is done: bzip2-1.0.6.img
Building into existing container: bzip2-1.0.6.img
Using container recipe deffile: bzip2-1.0.6.def
Sanitizing environment
Adding base Singularity environment to container
Progress |===================================| 100.0%
Exporting contents of shub://shahzebsiddiqui/easybuild-framework:centos-7.3.1611 to /tmp/.singularity-build.q8VtZr
User defined %runscript found! Taking priority.
Adding environment to container
Lmod has detected the following error: The following module(s) are unknown:
"bzip2/1.0.6"

Please check the spelling or version number. Also try "module spider ..."




Running post scriptlet
+ su - easybuild
== temporary log file in case of crash /scratch/tmp/eb-BvCaoM/easybuild-BXcfwO.log
== resolving dependencies ...
== processing EasyBuild easyconfig /usr/easybuild/easyconfigs/b/bzip2/bzip2-1.0.6.eb
== building and installing bzip2/1.0.6...
== fetching files...
== creating build dir, resetting environment...
== unpacking...
== patching...
== preparing...
== configuring...
== building...
== testing...
== installing...
== taking care of extensions...
== postprocessing...
== sanity checking...
== cleaning up...
== creating module...
== permissions...
== packaging...
== COMPLETED: Installation ended successfully
== Results of the build can be found in the log file(s) /app/software/bzip2/1.0.6/easybuild/easybuild-bzip2-1.0.6-20180108.162502.log
== Build succeeded for 1 out of 1
== Temporary log file(s) /scratch/tmp/eb-BvCaoM/easybuild-BXcfwO.log* have been removed.
== Temporary directory /scratch/tmp/eb-BvCaoM has been removed.
+ rm -rf '/scratch/tmp/*'
+ rm -rf /scratch/build
+ rm -rf /scratch/sources
+ rm -rf /scratch/ebfiles_repo
Adding deffile section labels to container
Adding runscript
Found an existing definition file
Adding a bootstrap_history directory
Finalizing Singularity container
Calculating final size for metadata...
comm: file 2 is not in sorted order
comm: file 2 is not in sorted order
Environment variables were added, removed, and/or changed during bootstrap.
Variables unique to original image (shahzebsiddiqui/easybuild-framework:centos-7.3.1611)
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PS1=Singularity>
PWD=/tmp
SHLVL=1
_=/usr/bin/printenv
Variables unique to new image (/tmp/.singularity-build.q8VtZr)
BASH_ENV=/usr/share/lmod/lmod/init/bash
HISTCONTROL=ignoredups
HISTSIZE=1000
HOSTNAME=amrndhl1157.pfizer.com
KDEDIRS=/usr
LANG=en_US.UTF-8
LESSOPEN=||/usr/bin/lesspipe.sh
LMOD_arch=x86_64
LMOD_CMD=/usr/share/lmod/lmod/libexec/lmod
LMOD_COLORIZE=yes
LMOD_DEFAULT_MODULEPATH=/nfs/grid/software/RHEL7/non-easybuild/modules/all:/nfs/grid/software/RHEL7/easybuild/modules/all/Core:/nfs/grid/software/moduledomains:/etc/modulefiles:/usr/share/modulefiles:/usr/share/modulefiles/Linux:/usr/share/modulefiles/Core:/usr/share/lmod/lmod/modulefiles/Core
LMOD_DIR=/usr/share/lmod/lmod/libexec/
LMOD_FULL_SETTARG_SUPPORT=no
LMOD_PKG=/usr/share/lmod/lmod
LMOD_PREPEND_BLOCK=normal
LMOD_RC=/nfs/grid/software/modulessetup/config/lmodrc.lua
LMOD_SETTARG_CMD=:
LMOD_sys=Linux
LOGNAME=root
LS_COLORS=
MAIL=/var/spool/mail/root
MANPATH=/usr/share/lmod/lmod/share/man::
MODULEPATH=/nfs/grid/software/RHEL7/non-easybuild/modules/all:/nfs/grid/software/RHEL7/easybuild/modules/all/Core:/nfs/grid/software/moduledomains:/etc/modulefiles:/usr/share/modulefiles:/usr/share/modulefiles/Linux:/usr/share/modulefiles/Core:/usr/share/lmod/lmod/modulefiles/Core
MODULEPATH_ROOT=/usr/share/modulefiles
MODULESHOME=/usr/share/lmod/lmod
_ModuleTable001_=X01vZHVsZVRhYmxlXz17WyJhY3RpdmVTaXplIl09MCxiYXNlTXBhdGhBPXsiL25mcy9ncmlkL3NvZnR3YXJlL1JIRUw3L25vbi1lYXN5YnVpbGQvbW9kdWxlcy9hbGwiLCIvbmZzL2dyaWQvc29mdHdhcmUvUkhFTDcvZWFzeWJ1aWxkL21vZHVsZXMvYWxsL0NvcmUiLCIvbmZzL2dyaWQvc29mdHdhcmUvbW9kdWxlZG9tYWlucyIsIi9ldGMvbW9kdWxlZmlsZXMiLCIvdXNyL3NoYXJlL21vZHVsZWZpbGVzIiwiL3Vzci9zaGFyZS9tb2R1bGVmaWxlcy9MaW51eCIsIi91c3Ivc2hhcmUvbW9kdWxlZmlsZXMvQ29yZSIsIi91c3Ivc2hhcmUvbG1vZC9sbW9kL21vZHVsZWZpbGVzL0NvcmUiLH0sWyJjX3JlYnVpbGRUaW1lIl09ZmFsc2UsWyJjX3Nob3J0VGltZSJdPWZhbHNlLGZhbWls
_ModuleTable002_=eT17fSxpbmFjdGl2ZT17fSxtVD17fSxtcGF0aEE9eyIvbmZzL2dyaWQvc29mdHdhcmUvUkhFTDcvbm9uLWVhc3lidWlsZC9tb2R1bGVzL2FsbCIsIi9uZnMvZ3JpZC9zb2Z0d2FyZS9SSEVMNy9lYXN5YnVpbGQvbW9kdWxlcy9hbGwvQ29yZSIsIi9uZnMvZ3JpZC9zb2Z0d2FyZS9tb2R1bGVkb21haW5zIiwiL2V0Yy9tb2R1bGVmaWxlcyIsIi91c3Ivc2hhcmUvbW9kdWxlZmlsZXMiLCIvdXNyL3NoYXJlL21vZHVsZWZpbGVzL0xpbnV4IiwiL3Vzci9zaGFyZS9tb2R1bGVmaWxlcy9Db3JlIiwiL3Vzci9zaGFyZS9sbW9kL2xtb2QvbW9kdWxlZmlsZXMvQ29yZSIsfSxbInN5c3RlbUJhc2VNUEFUSCJdPSIvbmZzL2dyaWQvc29mdHdhcmUvUkhFTDcvbm9uLWVhc3lidWlsZC9tb2R1
_ModuleTable003_=bGVzL2FsbC86L25mcy9ncmlkL3NvZnR3YXJlL1JIRUw3L2Vhc3lidWlsZC9tb2R1bGVzL2FsbC9Db3JlOi9uZnMvZ3JpZC9zb2Z0d2FyZS9tb2R1bGVkb21haW5zOi9ldGMvbW9kdWxlZmlsZXM6L3Vzci9zaGFyZS9tb2R1bGVmaWxlczovdXNyL3NoYXJlL21vZHVsZWZpbGVzL0xpbnV4Oi91c3Ivc2hhcmUvbW9kdWxlZmlsZXMvQ29yZTovdXNyL3NoYXJlL2xtb2QvbG1vZC9tb2R1bGVmaWxlcy9Db3JlIixbInZlcnNpb24iXT0yLH0=
_ModuleTable_Sz_=3
PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/cfengine/bin
PS1=Singularity>
PWD=/tmp
QTDIR=/usr/lib64/qt-3.3
QT_GRAPHICSSYSTEM_CHECKED=1
QTINC=/usr/lib64/qt-3.3/include
QTLIB=/usr/lib64/qt-3.3/lib
QT_PLUGIN_PATH=/usr/lib64/kde4/plugins:/usr/lib/kde4/plugins
SHLVL=1
USER=root
_=/usr/bin/printenv
Skipping checks
Building Singularity image...
Singularity container built: bzip2-1.0.6.img
Cleaning up...
[siddis14@amrndhl1157 easybuild-framework]$ sudo singularity shell --writable /tmp/bzip2-1.0.6.img
Singularity: Invoking an interactive shell within container...


import test.framework.asyncprocess as a
import test.framework.build_log as bl
import test.framework.config as c
import test.framework.containers as ct

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module level import not at top of file

"""
return ConfigurationVariables()['packagepath']

def container_path():

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

install_os_deps = ''
for ec in easyconfigs:
for osdep in ec['ec']['osdependencies']:
if isinstance(osdep, basestring):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined name 'basestring'

import test.framework.asyncprocess as a
import test.framework.build_log as bl
import test.framework.config as c
import test.framework.containers as ct

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module level import not at top of file

"""
return ConfigurationVariables()['packagepath']

def container_path():

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

install_os_deps = ''
for ec in easyconfigs:
for osdep in ec['ec']['osdependencies']:
if isinstance(osdep, basestring):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined name 'basestring'

@shahzebsiddiqui shahzebsiddiqui changed the title generating singularity definition files for centos image eb-singularity initial release (experimental) Apr 19, 2018
style fixes to make Hound CI happy
import test.framework.variables as v
import test.framework.yeb as y

# set plain text key ring to be used, so a GitHub token stored in it can be obtained without having to provide a password

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (121 > 120 characters)

import test.framework.variables as v
import test.framework.yeb as y

# set plain text key ring to be used, so a GitHub token stored in it can be obtained without having to provide a password

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (121 > 120 characters)

fix some more style issues in test/framework/suite.py
@boegel boegel changed the title eb-singularity initial release (experimental) add support for generating Singularity container recipes & (optionally) images via 'sudo singularity' (experimental feature) Apr 19, 2018
@boegel boegel merged commit 87c6cf6 into easybuilders:develop Apr 19, 2018
@boegel
Copy link
Member

boegel commented Apr 19, 2018

Thanks for all your work on this @shahzebsiddiqui, and @FooBarQuaxx for the valuable comments!

This initial support for Singularity integration will be a part of the next EasyBuild release (3.6.0), which should become available in the next couple of days...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants