Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.core
Commits
2a4476b0
Commit
2a4476b0
authored
May 05, 2017
by
Philip ABBET
Browse files
[buildout] Will now propose to download missing docker images
parent
472a3552
Pipeline
#8855
passed with stage
in 5 minutes and 10 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
buildout.cfg
View file @
2a4476b0
[buildout]
index = https://pypi.org/simple
parts = scripts
cxx_integers_echo
_algorithm
parts = scripts
docker_images cxx
_algorithm
s
extensions = mr.developer
auto-checkout = *
develop = .
...
...
@@ -15,19 +15,16 @@ beat.backend.python = git https://gitlab.idiap.ch/beat/beat.backend.python
[scripts]
recipe = bob.buildout:scripts
[
cxx_integers_echo_algorithm
]
[
docker_images
]
recipe = collective.recipe.cmd
cmds = cd beat/core/test/prefix/algorithms/user/
tar -cf cxx_integers_echo.tar cxx_integers_echo/
docker run -dti --name build docker.idiap.ch/beat/beat.env.client:1.0.0 > /dev/null
docker cp cxx_integers_echo.tar build:/tmp/cxx_integers_echo.tar
docker exec build bash -c 'cd /tmp ; tar -xf /tmp/cxx_integers_echo.tar'
docker exec build bash -c 'cd /tmp/cxx_integers_echo ; mkdir build ; cd build ; cmake .. ; make'
docker cp build:/tmp/cxx_integers_echo/1.so cxx_integers_echo/.
docker stop build > /dev/null
docker rm build > /dev/null
rm cxx_integers_echo.tar
cd ../../../../../..
uninstall_cmds = rm -f beat/core/test/prefix/algorithms/user/cxx_integers_echo/1.so
cmds = ./buildout_pull_images.sh
uninstall_cmds =
on_install = true
on_update = true
[cxx_algorithms]
recipe = collective.recipe.cmd
cmds = ./buildout_compile_cxx_algorithm.sh build
uninstall_cmds = ./buildout_compile_cxx_algorithm cleanup
on_install = true
on_update = true
buildout_compile_cxx_algorithm.sh
0 → 100755
View file @
2a4476b0
#! /bin/bash
ALGORITHMS_ROOT
=
"beat/core/test/prefix/algorithms/user"
DOCKER_IMAGE
=
"docker.idiap.ch/beat/beat.env.client:1.0.0"
BEAT_CORE_PATH
=
$(
dirname
"
$0
"
)
cd
$BEAT_CORE_PATH
# Compilation of the algorithm
if
[
"
$1
"
==
"build"
]
;
then
cd
$ALGORITHMS_ROOT
tar
-cf
cxx_integers_echo.tar cxx_integers_echo/
docker run
-dti
--name
build
$DOCKER_IMAGE
>
/dev/null
docker
cp
cxx_integers_echo.tar build:/tmp/cxx_integers_echo.tar
docker
exec
build bash
-c
'cd /tmp ; tar -xf /tmp/cxx_integers_echo.tar'
docker
exec
build bash
-c
'cd /tmp/cxx_integers_echo ; mkdir build ; cd build ; cmake .. ; make'
docker
cp
build:/tmp/cxx_integers_echo/1.so cxx_integers_echo/.
docker stop build
>
/dev/null
docker
rm
build
>
/dev/null
rm
cxx_integers_echo.tar
fi
# Cleanup of the compiled algorithms
if
[
"
$1
"
==
"clean"
]
;
then
rm
-f
"
$ALGORITHMS_ROOT
/cxx_integers_echo/1.so"
fi
buildout_pull_images.sh
0 → 100755
View file @
2a4476b0
#! /bin/bash
IMAGES
=(
docker.idiap.ch/beat/beat.env.system.python:system
docker.idiap.ch/beat/beat.env.db.examples:1.0.0
docker.idiap.ch/beat/beat.env.cxx:1.0.1
docker.idiap.ch/beat/beat.env.client:1.0.0
)
# Find all the missing images
declare
-a
MISSING_IMAGES
for
IMAGE
in
${
IMAGES
[@]
}
;
do
IMAGE_HASH
=
$(
docker images
-q
$IMAGE
)
if
[
-z
"
$IMAGE_HASH
"
]
;
then
MISSING_IMAGES+
=(
$IMAGE
)
fi
done
# If there are some images missing, ask the user if he wants to download them
if
[
${#
MISSING_IMAGES
[@]
}
-gt
0
]
;
then
echo
"--------------------------------------------------------------------------------------"
echo
"The following docker images are required (at least for the tests), but were not found:"
echo
for
IMAGE
in
${
MISSING_IMAGES
[@]
}
;
do
echo
" -
$IMAGE
"
done
echo
read
-p
"Do you want to install them now? (yes/no) "
-n
1
-r
echo
if
[[
$REPLY
=
~ ^[Yy]
$
]]
;
then
# Log in the registry if needed
if
!
grep
-q
"docker.idiap.ch"
~/.docker/config.json
;
then
docker login docker.idiap.ch
fi
# Pull the images
for
IMAGE
in
${
MISSING_IMAGES
[@]
}
;
do
echo
CMD
=
"docker pull
$IMAGE
"
echo
">
$CMD
"
$CMD
done
fi
fi
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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