Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
EIC
Project Juggler
Commits
46ad787f
Commit
46ad787f
authored
Nov 10, 2020
by
Sylvester Joosten
Browse files
Added singularity build
parent
4173d689
Changes
6
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
46ad787f
...
...
@@ -22,7 +22,7 @@ compile:
-
cd /tmp && git clone --depth=1 https://eicweb.phy.anl.gov/EIC/eicd.git && mkdir eicd_build && cd eicd_build && cmake ../eicd/. && make -j20 install
-
cd $homedir && ls -lrth && mkdir build && cd build && cmake .. && make -j10
docker
_image
:
docker
:build
:
image
:
eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_dind:latest
stage
:
docker_build
rules
:
...
...
@@ -37,10 +37,10 @@ docker_image:
-
cd containers/docker
-
make build-nc
docker
_image_
push
:
docker
:
push:
image
:
eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_dind:latest
stage
:
docker_push
needs
:
[
"
docker
_image
"
]
needs
:
[
"
docker
:build
"
]
rules
:
-
if
:
'
$CI_PIPELINE_SOURCE
==
"merge_request_event"'
when
:
never
...
...
@@ -53,7 +53,7 @@ docker_image_push:
-
cd containers/docker
-
make push
docker
_tag
:
docker
:release
:
image
:
eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_dind:latest
stage
:
docker_build
rules
:
...
...
@@ -63,3 +63,32 @@ docker_tag:
script
:
-
cd containers/docker && make release
docker:singularity:
image
:
eicweb.phy.anl.gov:4567/containers/image_recipes/ubuntu_dind:latest
stage
:
docker_push
needs
:
[
"
docker:build"
]
rules
:
-
if
:
'
$CI_PIPELINE_SOURCE
==
"merge_request_event"'
when
:
never
-
if
:
'
$CI_COMMIT_BRANCH
!=
"master"'
when
:
never
-
when
:
on_success
tags
:
-
silicon
script
:
-
cp containers/singularity/juggler.def .
-
/bin/bash .gitlabci/setup.sh
-
/bin/bash .gitlabci/build.sh juggler.def
-
mkdir -p build
-
cp juggler.sif build/.
-
cp juggler.def build/.
artifacts
:
expire_in
:
90 days
paths
:
-
build/juggler.sif
-
build/juggler.def
.gitlabci/build.sh
0 → 100644
View file @
46ad787f
#!/bin/bash
# build.sh will build a Singularity container. It's not overly complicated.
#
# USAGE: build.sh --uri collection-name/container-name --cli registry Singularity
# build.sh --uri collection-name/container-name --cli registry
# build.sh Singularity
# Copyright (C) 2017-2018 Vanessa Sochat.
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
# 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 GNU Affero General Public
# License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
set
-o
errexit
set
-o
nounset
function
usage
()
{
echo
"USAGE: build [recipe] [options]"
echo
""
echo
"OPTIONS:
Image Format
--uri -u if uploading, a uri to give to sregistry
--cli -c the sregistry client to use (if uploading)
--help -h show this help and exit
"
}
# --- Option processing --------------------------------------------------------
uri
=
""
cli
=
""
tag
=
""
while
true
;
do
case
${
1
:-}
in
-h
|
--help
|
help
)
usage
exit
0
;;
-u
|
-uri
)
shift
uri
=
"
${
1
:-}
"
shift
;;
-t
|
--tag
)
shift
tag
=
"
${
1
:-}
"
shift
;;
-c
|
--cli
)
shift
cli
=
"
${
1
:-}
"
shift
;;
\?
)
printf
"illegal option: -%s
\n
"
"
${
1
:-}
"
>
&2
usage
exit
1
;;
-
*
)
printf
"illegal option: -%s
\n
"
"
${
1
:-}
"
>
&2
usage
exit
1
;;
*
)
break
;
;;
esac
done
################################################################################
### Recipe File ################################################################
################################################################################
if
[
$#
==
0
]
;
then
recipe
=
"Singularity"
else
recipe
=
$1
fi
echo
""
echo
"Image Recipe:
${
recipe
}
"
################################################################################
### Storage Client #############################################################
################################################################################
is_valid_client
()
{
local
e
match
=
"
$1
"
shift
for
e
;
do
[[
"
$e
"
==
"
$match
"
]]
&&
return
0
;
done
return
1
}
# Test if client is valid
clients
=(
"google-storage"
"registry"
"globus"
"dropbox"
"google-drive"
)
if
[
"
${
cli
}
"
!=
""
]
;
then
is_valid_client
"
${
cli
}
"
"
${
clients
[@]
}
"
if
[
$?
-ne
0
]
;
then
echo
"
${
cli
}
is not a valid choice! Choose from
${
clients
[@]
}
"
;
exit
1
fi
echo
"Storage Client:
${
cli
}
"
else
echo
"Storage Client: none"
fi
################################################################################
### Build! #####################################################################
################################################################################
# Continue if the image recipe is found
if
[
-f
"
$recipe
"
]
;
then
imagefile
=
"
`
basename
${
recipe
}
.def
`
.sif"
echo
"Creating
$imagefile
using
$recipe
..."
singularity build
$imagefile
$recipe
# If the image is successfully built, test it and upload (examples)
if
[
-f
"
${
imagefile
}
"
]
;
then
# Example testing using run (you could also use test command)
echo
"Testing the image... Marco!"
singularity
exec
$imagefile
echo
"Polo!"
# Example sregistry commands to push to endpoints
if
[
"
${
cli
}
"
!=
""
]
;
then
# If the uri isn't provided, he gets a robot name
if
[
"
${
uri
}
"
==
""
]
;
then
uri
=
$(
python
-c
"from sregistry.logger.namer import RobotNamer; bot=RobotNamer(); print(bot.generate())"
)
fi
# If a tag is provided, add to uri
if
[
"
${
tag
}
"
!=
""
]
;
then
uri
=
"
${
uri
}
:
${
tag
}
"
fi
echo
"Pushing
${
uri
}
to
${
cli
}
://"
echo
"SREGISTRY_CLIENT=
${
cli
}
sregistry push --name
${
uri
}
${
imagefile
}
"
SREGISTRY_CLIENT
=
"
${
cli
}
"
sregistry push
--name
"
${
uri
}
"
"
${
imagefile
}
"
else
echo
"Skipping upload. Image
$imagefile
is finished!"
fi
fi
else
echo
"Singularity recipe
${
recipe
}
not found!"
exit
1
fi
.gitlabci/setup.sh
0 → 100644
View file @
46ad787f
#!/bin/bash
#apt-get update && apt-get install -y wget git \
# build-essential \
# squashfs-tools \
# libtool \
# autotools-dev \
# libarchive-dev \
# automake \
# autoconf \
# uuid-dev \
# libssl-dev \
# python-pip
#
#
### Somehow sed cant find /etc/sudoers
##sed -i -e 's/^Defaults\tsecure_path.*$//' /etc/sudoers
#
## Check Python
#
#echo "Python Version:"
#python --version
#pip install sregistry[all]
#sregistry version
#
#echo "sregistry Version:"
#
## Install Singularity
#
#cd /tmp && \
# rm -rf singularity && \
# git clone -b vault/release-2.5 https://www.github.com/sylabs/singularity.git
# cd singularity && \
# ./autogen.sh && \
# ./configure --prefix=/usr/local && \
# make -j8 && make install
.gitlabci/sregistry-gitlab.png
0 → 100644
View file @
46ad787f
37.4 KB
.gitlabci/sregistry-gitlab.xcf
0 → 100644
View file @
46ad787f
File added
containers/singularity/juggler.def
0 → 100644
View file @
46ad787f
Bootstrap: docker
From: eicweb.phy.anl.gov:4567/juggler/juggler:latest
%help
singularity container for Juggler development
%help
EIC software container (for Juggler/Recon development)
Tools:
- eic_shell: start shell in the eic container
%labels
Maintainer "Whitney Armstrong, Sylvester Joosten"
Version v1-dev
%post -c /bin/bash
echo " -------------------------------------------------"
echo " ===> Image setup complete"
echo " -------------------------------------------------"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment