Parallelize Docker builds

Log output to docker/logs.
This commit is contained in:
Andrew Schwartzmeyer committed 2016-09-12 15:01:19 -07:00
1 parent 002d2a6911
commit f0314cd86e
3 files changed
+17 -7

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
logs/*.log
packages/
unstable/*/bootstrap.ps1
+14 -6
View File
@@ -21,12 +21,18 @@ if [[ -z $DISTROS ]]; then
fi
for build in $BUILDS; do
# cd so $distro is only the distro name
pushd "$build"
# each distro can be done in parallel; but stable must be done before unstable
for distro in $DISTROS; do
logfile="$build-$distro.log"
if [[ "$TEST" -eq 1 ]]; then logfile="test-$logfile"; fi
mkdir -p logs
logfile="logs/$logfile"
echo "Logging to docker/$logfile"
(
image="powershell/powershell:$build-$distro"
cd "$build"
if [[ "$TEST" -eq 1 ]]; then
echo "Testing $image"
echo "LOG: testing $image"
command="cd PowerShell; Import-Module ./build.psm1; Install-Dotnet -NoSudo; Start-PSPester -powershell powershell -Pester ./src/Modules/Shared/Pester"
# clone repo for stable images because it's not already done
if [[ "$build" = stable ]]; then
@@ -34,9 +40,9 @@ for build in $BUILDS; do
fi
# run Pester tests inside container
# RUNARGS can be set in the environment
docker run -it $RUNARGS "$image" -c "$command"
docker run $RUNARGS "$image" -c "$command"
else
echo "Building $image"
echo "LOG: building $image"
# copy the common script because it lives outside the docker build context
if [[ "$build" = unstable ]]; then
cp bootstrap.ps1 "$distro"
@@ -46,6 +52,8 @@ for build in $BUILDS; do
# BUILDARGS can be set in the environment
docker build $buildargs $BUILDARGS -t "$image" "$distro"
fi
) &>> "$logfile" &
done
popd
echo "Waiting for $build containers to finish; tail the logs for more information."
wait
done
-1
View File
@@ -1 +0,0 @@
*/bootstrap.ps1