Skip to content

Commit dddf398

Browse files
authored
Fix/bug container install (#459)
* fixing bug with adding singularity container * also fixing circle ci tests! the container and environment file should be added to the container base, and the module file alongside modules. Without this fix all are installed to containers Signed-off-by: vsoch <[email protected]> Co-authored-by: vsoch <[email protected]>
1 parent 3473fc9 commit dddf398

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ install_podman: &install_podman
6161
name: Install Podman
6262
command: |-
6363
. /etc/os-release
64-
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/testing/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:testing.list
65-
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/testing/xUbuntu_${VERSION_ID}/Release.key | sudo apt-key add -
64+
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
65+
wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_${VERSION_ID}/Release.key -O- | sudo apt-key add -
6666
sudo apt-get update -qq
6767
sudo apt-get -qq -y install podman
6868

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are:
1414
The versions coincide with releases on pip. Only major versions will be released as tags on Github.
1515

1616
## [0.0.x](https://github.scom/singularityhub/singularity-hpc/tree/master) (0.0.x)
17+
- fixing bug with container install (does not honor module directory) (0.0.36)
1718
- `.version` file should be written in top level of module folders [#450](https://github.com/singularityhub/singularity-hpc/issues/450) (0.0.35)
1819
- tcl module functions need `$@` to handle additional arguments
1920
- Tcl modules use shell functions for bash, to export to child shells (0.0.34)

shpc/main/container/singularity.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def add(self, sif, module_name, modulefile, template, **kwargs):
7575
"""
7676
Manually add a registry container.
7777
"""
78+
module_dir = os.path.dirname(modulefile)
79+
7880
# Ensure the container exists
7981
sif = os.path.abspath(sif)
8082
if not os.path.exists(sif):
@@ -92,8 +94,7 @@ def add(self, sif, module_name, modulefile, template, **kwargs):
9294

9395
# The user can have a different container directory defined
9496
container_dir = self.container_dir(module_name)
95-
module_path = os.path.join(container_dir, modulefile)
96-
shpc.utils.mkdirp([container_dir])
97+
shpc.utils.mkdirp([container_dir, module_dir])
9798

9899
# Name the container appropriately
99100
name = module_name.replace("/", "-")
@@ -105,14 +106,14 @@ def add(self, sif, module_name, modulefile, template, **kwargs):
105106
parsed_name = ContainerName(module_name)
106107

107108
self.install(
108-
module_path,
109+
modulefile,
109110
dest,
110111
module_name,
111112
template,
112113
parsed_name=parsed_name,
113114
features=kwargs.get("features"),
114115
)
115-
self.add_environment(container_dir, {}, self.settings.environment_file)
116+
self.add_environment(module_dir, {}, self.settings.environment_file)
116117
logger.info("Module %s was created." % (module_name))
117118

118119
def install(
@@ -144,7 +145,8 @@ def install(
144145
)
145146

146147
# Remove any previous containers
147-
for older in glob("%s%s*.sif" % (module_path, os.sep)):
148+
container_dir = os.path.dirname(container_path)
149+
for older in glob("%s%s*.sif" % (container_dir, os.sep)):
148150
if older == container_path:
149151
continue
150152
os.remove(older)

shpc/main/modules/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ def add(self, sif, module_name, **kwargs):
146146
"""
147147
module_name = self.add_namespace(module_name)
148148
template = self._load_template(self.templatefile)
149-
self.container.add(sif, module_name, self.modulefile, template, **kwargs)
149+
modulefile = os.path.join(self.settings.module_base, module_name.replace(":", os.sep), self.modulefile)
150+
self.container.add(sif, module_name, modulefile, template, **kwargs)
150151

151152
def get(self, module_name, env_file=False):
152153
"""

shpc/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
__copyright__ = "Copyright 2021, Vanessa Sochat"
33
__license__ = "MPL 2.0"
44

5-
__version__ = "0.0.35"
5+
__version__ = "0.0.36"
66
AUTHOR = "Vanessa Sochat"
77
NAME = "singularity-hpc"
88
PACKAGE_URL = "https://github.com/singularityhub/singularity-hpc"

0 commit comments

Comments
 (0)