Auto-merge for PR #479 via VersionBot

Fix preloading and parsing of arguments in the dind supervisor
This commit is contained in:
resin-io-versionbot[bot] 2017-07-27 04:44:44 +00:00 committed by GitHub
commit e5cac89f1b
4 changed files with 27 additions and 5 deletions

View File

@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).
## v6.0.5 - 2017-07-27
* Allow building the supervisor source without optimizations for easier debugging with dindctl [Pablo Carranza Velez]
* Pull the supervisor image if it's not available when running with dindctl [Pablo Carranza Velez]
* Fix preloading and parsing of arguments in the dind supervisor [Pablo Carranza Velez]
## v6.0.4 - 2017-07-26
* Fix the message shown when docker gives a 500 error when starting a container [Pablo Carranza Velez]

21
dindctl
View File

@ -46,13 +46,14 @@ SUPERVISOR_EXTRA_MOUNTS=""
DIST_MOUNTED="false"
DIND_IMAGE="resin-supervisor-dind"
PRELOADED_IMAGE=""
OPTIMIZE="true"
function showHelp {
cat $THIS_FILE | awk '{if(/^#/)print;else exit}' | tail -n +2 | sed 's/\#//' | sed 's|dindctl|'$THIS_FILE'|'
}
function parseOptions {
while [[ $# -gt 1 ]]
while [[ $# -ge 1 ]]
do
case $1 in
--mount-dist)
@ -80,6 +81,9 @@ function parseOptions {
ARCH="$2"
shift || { echo "--arch provided not specified" && exit 1; }
;;
--no-optimize)
OPTIMIZE="false"
;;
*)
echo "Warning: unknown argument: $arg"
;;
@ -97,8 +101,13 @@ function buildSupervisor {
}
function buildSupervisorSrc {
echo "Rebuilding supervisor source"
( cd "$SUPERVISOR_BASE_DIR" && npm run build )
if [ "$OPTIMIZE" = "true" ]; then
echo "Rebuilding supervisor source"
( cd "$SUPERVISOR_BASE_DIR" && npm install && npm run build )
else
echo "Rebuilding supervisor source without optimizations"
( cd "$SUPERVISOR_BASE_DIR" && npm install && npm run build-no-optimize )
fi
}
function refreshSupervisorSrc {
@ -115,12 +124,17 @@ function runDind {
if [ "$PRELOADED_IMAGE" = "true" ]; then
echo "Running with preloaded apps"
fi
if ! ( docker inspect $SUPERVISOR_IMAGE &> /dev/null ); then
echo "$SUPERVISOR_IMAGE not available locally, pulling"
docker pull $SUPERVISOR_IMAGE
fi
echo "Starting dind supervisor"
make -C "$SUPERVISOR_BASE_DIR" \
ARCH="$ARCH" \
SUPERVISOR_IMAGE="$SUPERVISOR_IMAGE" \
PASSWORDLESS_DROPBEAR="$PASSWORDLESS_DROPBEAR" \
SUPERVISOR_EXTRA_MOUNTS="$SUPERVISOR_EXTRA_MOUNTS" \
PRELOADED_IMAGE="$PRELOADED_IMAGE" \
IMAGE="$DIND_IMAGE" \
run-supervisor
}
@ -159,5 +173,6 @@ else
;;
*)
showHelp
;;
esac
fi

View File

@ -1,7 +1,7 @@
{
"name": "resin-supervisor",
"description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.",
"version": "6.0.4",
"version": "6.0.5",
"license": "Apache-2.0",
"repository": {
"type": "git",
@ -10,6 +10,7 @@
"scripts": {
"start": "./entry.sh",
"build": "webpack --optimize-minimize",
"build-no-optimize": "webpack",
"lint": "resin-lint src/",
"versionist": "versionist"
},

View File

@ -8,7 +8,7 @@ Before=openvpn-resin.service
WorkingDirectory=/usr/src/app
EnvironmentFile=/usr/src/app/config/env
EnvironmentFile=/usr/src/app/config/localenv
ExecStartPre=/bin/bash -c 'if [ "${PRELOADED_IMAGE}" == "true" ]; then /usr/bin/docker pull $(jq ".[0].imageId" ${APPS_PATH}); fi'
ExecStartPre=/bin/bash -c 'if [ "${PRELOADED_IMAGE}" == "true" ]; then /usr/bin/docker pull $(jq --raw-output ".[0].imageId" ${APPS_PATH}); fi'
ExecStartPre=/usr/bin/docker load --input /usr/src/supervisor-image.tar
ExecStartPre=-/usr/bin/docker kill resin_supervisor
ExecStartPre=-/usr/bin/docker rm resin_supervisor