From 1f55c86fac9ba69f2e35b73b644070c54d353fec Mon Sep 17 00:00:00 2001 From: Sylvester Joosten <sjoosten@anl.gov> Date: Sat, 25 Jul 2020 00:52:26 -0500 Subject: [PATCH] prepared container for v2.0.1 --- .gitlab-ci.yml | 2 ++ README.md | 63 ++++++++++++++++++++++++++++++++++++++++++------- deploy.py | 18 ++++++++++---- install/util.py | 6 ++--- 4 files changed, 74 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c6c1300d3..f30a21a87 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -56,6 +56,7 @@ eic_builder_singularity: tags: - sodium dind only: + - staging - tags when: manual script: @@ -75,6 +76,7 @@ eic_singularity: tags: - sodium dind only: + - staging - tags script: - cp containers/release/eic.def . diff --git a/README.md b/README.md index 280b54ef1..b47cdf837 100644 --- a/README.md +++ b/README.md @@ -15,33 +15,80 @@ cd eic_container modelefile will be installed to `$PREFIX/../../etc/modulefiles`. You can use the `-v` flag to select the version you want to deploy, or omit the flag if you want to install the master build. The recommended stable - release version is `v2.0.0`. + release version is `v2.0.1`. ```bash -./deploy.py -v 2.0.0 <PREFIX> +./deploy.py -v 2.0.1 <PREFIX> ``` Available flags: ```bash -v VERSION, --version VERSION - (opt.) project version. Default: current git branch/tag. + (opt.) project version. Default: current version (in repo). -b BIND_PATHS, --bind-path BIND_PATHS (opt.) extra bind paths for singularity. -m MODULE_PATH, --module-path MODULE_PATH (opt.) Root module path where you want to install a modulefile. D: <prefix>/../../etc/modulefiles + -l, --local Local deploy, will not install the modulefiles (you will have + to run the launcher scripts from their relative paths). -f, --force Force-overwrite already downloaded container with the same name. - --install-builder BUILDER - (opt.) Install fat builder image, instead of normal - slim image ``` -3. To use the container: load the modulefile, and then use the included apps as if - they are native apps on your system! +3. To use the container in installed mode, you can load the modulefile, + and then use the included apps as if they are native apps on your system! ```bash module load eic_container ``` +4. To use the container in local mode, you can run the runscripts (under `$PREFIX/bin`) + manually. + 4. (Advanced) If you need to add additional bind directives for the internal singularity container, you can add them with the `-b` flag. Run `./deploy.py -h` to see a list of all supported options. + +Usage +----- + +### A. Running the singularity development environment with modulefiles + +1. Add the installed modulefile to your module path, e.g., +```bash +module use <prefix>/../../etc/modulefiles +``` + +2. Load the eic container +```bash +module load eic_container +``` + +3. To start a shell in the container environment, do +```bash +eic-shell +``` + +### B. Running the singularity development locally (without modulefiles) + +1. This is assuming you deployed with the `-l` flag to a prefix `$PREFIX`: +```bash +./deploy.py $PREFIX +``` + +2. To start a shell in the container environment, do +```bash +$PREFIX/bin/eic-shell +``` + +### C. Using the docker container for your CI purposes + +1. To load the container environment in your run scripts, you can + - launch the script or program using `eic-shell`, + - or `source /etc/eic-env.sh` at the start of your commands. + +2. If using this container as a basis for a new container, you can direction access + the full container environment from a docker `RUN` shell command with no further + action needed. For the most optimal experience, you can install your software to + `/opt/view` to fully integrate with the existing environment. Depending on your + use case, installation to `/usr/local` may also work, but this might require you + to write and run additional environment scripts. diff --git a/deploy.py b/deploy.py index 43b998050..c19229310 100755 --- a/deploy.py +++ b/deploy.py @@ -24,7 +24,7 @@ GROUP_NAME='containers' PROJECT_NAME='eic_container' IMAGE_ROOT='eic' -PROGRAMS = [('eic_shell', '/usr/bin/bash'), +PROGRAMS = ['eic-shell', 'root', 'ipython'] @@ -45,7 +45,7 @@ if __name__ == "__main__": '-v', '--version', dest='version', default=project_version(), - help='(opt.) project version. Default: current git branch/tag.') + help='(opt.) project version. Default: current version (in repo).') parser.add_argument( '-f', '--force', action='store_true', @@ -60,6 +60,12 @@ if __name__ == "__main__": '-m', '--module-path', dest='module_path', help='(opt.) Root module path where you want to install a modulefile. D: <prefix>/../../etc/modulefiles') + parser.add_argument( + '-l', '--local', + action='store_true', + dest='local', + help='Local deploy, will not install the modulefiles (you will have to run' + 'the launchers scripts from their relative paths).') parser.add_argument( '--install-builder', dest='builder', @@ -100,7 +106,10 @@ if __name__ == "__main__": libexecdir = '{}/libexec'.format(args.prefix) root_prefix = os.path.abspath('{}/..'.format(args.prefix)) moduledir = '{}/{}'.format(args.module_path, PROJECT_NAME) - for dir in [bindir, libdir, libexecdir, moduledir]: + dirs = [bindir, libdir, libexecdir] + if not args.local: + dirs.append(moduledir) + for dir in dirs: print(' -', dir) smart_mkdir(dir) @@ -123,7 +132,8 @@ if __name__ == "__main__": print('WARNING: Container found at', container) print(' ---> run with -f to force a re-download') - make_modulefile(PROJECT_NAME, version, moduledir, bindir) + if not args.local: + make_modulefile(PROJECT_NAME, version, moduledir, bindir) ## configure the application launchers print('Configuring applications launchers: ') diff --git a/install/util.py b/install/util.py index 47cb594a6..e3b2a86b5 100644 --- a/install/util.py +++ b/install/util.py @@ -32,7 +32,7 @@ def smart_mkdir(dir): def project_version(): '''Return the project version based on the current git branch/tag.''' - ## Shell command to get the current git version - git_version_cmd = 'git symbolic-ref -q --short HEAD || git describe --tags --exact-match' + ## Shell command to get the current project version + version_cmd = 'cat VERSION' ## Strip will remove the leading \n character - return os.popen(git_version_cmd).read().strip() + return os.popen(version_cmd).read().strip() -- GitLab