-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathdocker-deployment-tests.sh
More file actions
executable file
·28 lines (24 loc) · 1.13 KB
/
docker-deployment-tests.sh
File metadata and controls
executable file
·28 lines (24 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash
# run the build in a docker container
set -ex
# find the dir two levels up from here, home of all the repositories
COMPUTED_ROOT="$(readlink -e "$(dirname "$0")/../../")"
# NTECH_ROOT should be the same, but if available use it so user can do their own thing.
NTECH_ROOT=${NTECH_ROOT:-$COMPUTED_ROOT}
name=cfengine-deployment-tests
# todo, check the image against the Dockerfile for up-to-date ness?
if ! docker images | grep $name; then
docker build -t $name -f "${NTECH_ROOT}/buildscripts/ci/Dockerfile-$name" . || true
fi
# todo, check if already running and up-to-date?
# we want a fresh container, stop and remove any that exist by this $name
if docker ps -a | grep $name; then
docker ps -a | grep $name | awk '{print $1}' | xargs docker stop
docker ps -a | grep $name | awk '{print $1}' | xargs docker rm
fi
docker run -d --privileged -v "${NTECH_ROOT}":/data --name $name $name || true
if [ ! -d "${NTECH_ROOT}/artifacts" ]; then
echo "${NTECH_ROOT}/artifacts directory should exist and have a cfengine-nova-hub package there"
exit 1
fi
docker exec -i $name bash -c 'cd /data; ./buildscripts/ci/deployment-tests.sh'