Commit 1e309b66 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

scripts: PACKER_NO_BUILD_PARALLEL to build in sequence

parent 6511b189
...@@ -26,6 +26,9 @@ if [ "$(go env GOOS)" = "windows" ]; then ...@@ -26,6 +26,9 @@ if [ "$(go env GOOS)" = "windows" ]; then
EXTENSION=".exe" EXTENSION=".exe"
fi fi
# Make sure that if we're killed, we kill all our subprocseses
trap "kill 0" SIGINT SIGTERM EXIT
# If we're building a race-enabled build, then set that up. # If we're building a race-enabled build, then set that up.
if [ ! -z $PACKER_RACE ]; then if [ ! -z $PACKER_RACE ]; then
echo -e "${OK_COLOR}--> Building with race detection enabled${NO_COLOR}" echo -e "${OK_COLOR}--> Building with race detection enabled${NO_COLOR}"
...@@ -50,7 +53,16 @@ waitAll() { ...@@ -50,7 +53,16 @@ waitAll() {
fi fi
} }
echo -e "${OK_COLOR}--> NOTE: Compilation of components will be done in parallel.${NO_COLOR}" waitSingle() {
if [ ! -z $PACKER_NO_BUILD_PARALLEL ]; then
waitAll
fi
}
if [ -z $PACKER_NO_BUILD_PARALLEL ]; then
echo -e "${OK_COLOR}--> NOTE: Compilation of components " \
"will be done in parallel.${NO_COLOR}"
fi
# Compile the main Packer app # Compile the main Packer app
echo -e "${OK_COLOR}--> Compiling Packer${NO_COLOR}" echo -e "${OK_COLOR}--> Compiling Packer${NO_COLOR}"
...@@ -62,6 +74,8 @@ go build \ ...@@ -62,6 +74,8 @@ go build \
-o bin/packer${EXTENSION} . -o bin/packer${EXTENSION} .
) & ) &
waitSingle
# Go over each plugin and build it # Go over each plugin and build it
for PLUGIN in $(find ./plugin -mindepth 1 -maxdepth 1 -type d); do for PLUGIN in $(find ./plugin -mindepth 1 -maxdepth 1 -type d); do
PLUGIN_NAME=$(basename ${PLUGIN}) PLUGIN_NAME=$(basename ${PLUGIN})
...@@ -73,6 +87,8 @@ for PLUGIN in $(find ./plugin -mindepth 1 -maxdepth 1 -type d); do ...@@ -73,6 +87,8 @@ for PLUGIN in $(find ./plugin -mindepth 1 -maxdepth 1 -type d); do
-v \ -v \
-o bin/packer-${PLUGIN_NAME}${EXTENSION} ${PLUGIN} -o bin/packer-${PLUGIN_NAME}${EXTENSION} ${PLUGIN}
) & ) &
waitSingle
done done
waitAll waitAll
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment