summaryrefslogtreecommitdiff
path: root/start-container-docker.sh
diff options
context:
space:
mode:
Diffstat (limited to 'start-container-docker.sh')
-rwxr-xr-xstart-container-docker.sh17
1 files changed, 11 insertions, 6 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh
index 3a214425..4cf58796 100755
--- a/start-container-docker.sh
+++ b/start-container-docker.sh
@@ -15,7 +15,7 @@ set -e -o pipefail
# - definition of ${session_host} and ${session_port}, can be used for
# a remote connexion to the container
usage() {
- echo "Usage: $0 [--arch container-arch] --distro flavour [--docker_opts opts] [--dryrun true/false] [--label label] [--newuser username:[uid]] [--node node] [--prefix prefix] [--session-host host] [--session-name name] [--ssh_info true/false] [--task {build|test}] [--user user] [--weight weight] [--verbose true/false]"
+ echo "Usage: $0 [--arch container-arch] --distro flavour [--docker_opts opts] [--dryrun true/false] [--label label] [--newuser username:[uid]] [--node node] [--prefix prefix] [--session-host host] [--session-name name] [--ssh_info true/false] [--task {build|test|bench}] [--user user] [--weight weight] [--verbose true/false]"
echo
echo " container-arch: architecture (eg: amd64, i386, arm64, armhf)"
echo " distro: distribution (eg: trusty)"
@@ -28,7 +28,7 @@ usage() {
echo " useful if the name resolution does not work correctly"
echo " session-name: session, in case the default '$BUILD_NUMBER-$JOB_NAME' is not suitable"
echo " ssh_info: set $ssh_host and $ssh_port env variables in the container"
- echo " task: type of container (build or test, default=build)"
+ echo " task: type of container (build, test or bench, default=build)"
echo " user: remote user to use in the container."
echo " weight: container weight, reserves resources. Default=1"
echo " verbose: whether enable verbose output. Default=false"
@@ -157,7 +157,7 @@ if $dryrun; then
dryruncmd="echo"
fi
-if [ x"$node" = x"" -a x"$label" != x"" ]; then
+if [ x"$node" = x"" -a x"$session_host" = x"" -a x"$label" != x"" ]; then
node=$(print_node_with_least_containers "$label")
if [ x"$node" = x"" ]; then
echo "ERROR: Cannot find node for $label"
@@ -208,7 +208,7 @@ if [ x"$distro" = x"default" ]; then
distro="trusty-tcwg-tested"
fi
-image=linaro/ci-${container_arch}-tcwg-${task}-ubuntu:${distro}
+image=linaro/ci-${container_arch}-tcwg-build-ubuntu:${distro}
# Avoid connexion sharing because of race conditions with parallel
# builds
@@ -228,10 +228,15 @@ SECURITY="${SECURITY} --security-opt seccomp:unconfined"
# Reserve resources according to weight and task
nproc=$($SSH $session_host nproc --all)
-memory=$(print_memory_limit "$task" "$weight" "$nproc")
pids=$(print_pids_limit "$task" "$weight")
cpus=$(print_cpu_shares "$task" "$weight")
+memory=$(print_memory_limit "$task" "$weight" "$nproc")
+memory_opt="--memory=${memory}M"
+if [ x"$memory" = x"unlimited" ]; then
+ memory_opt=""
+fi
+
if [ x"${JOB_NAME:+set}" = x"set" ]; then
job_name="$JOB_NAME"
fi
@@ -290,7 +295,7 @@ echo "DEBUG: starting docker on $session_host from $(hostname), date $(date)"
docker_run=($DOCKER run --name $session_name -dtP \
"${bind_mounts_opt[@]}" \
${SECURITY} \
- --memory=${memory}M \
+ ${memory_opt} \
--pids-limit=${pids} \
--cpu-shares=${cpus} \
$cpuset_opt \