Consolidate exec package with go-execute

This patch consolidates the exec package for docker build so that
it uses the the go-execute package used in other OpenFaaS projects.

The aim is to allow for conditional printing of stdio whilst also
being able to capture the output.

In a future PR a CLI animation can replace the Docker build, which
will be default, but optional. If an error is found then the
result of the build will be buffered and available to print to the
user.

This change stops Docker from printing progress bars when
downloading layers. Instead a line is printed when pulling and
when a layer is complete.

* Tested for faas-cli build with multiple functions using the
sample stack.yml and --parallel=1/4.

* Adds StreamStdio option and updates Docker build version to use
Go 1.12.

* Add complete build time to output

* Add duration of each build to output

* Add --quiet flag for faas-cli build

* The --quiet flag hides output from Docker during the execution
of the docker build.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd)
2019-12-06 14:08:37 +00:00
committed by Alex Ellis
parent 83fd873d45
commit 38ecd73a60
14 changed files with 159 additions and 51 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
export eTAG="latest-dev"
echo $1
@@ -8,8 +8,14 @@ fi
echo Building openfaas/faas-cli:$eTAG
docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy -t openfaas/faas-cli:$eTAG . && \
docker create --name faas-cli openfaas/faas-cli:$eTAG && \
docker cp faas-cli:/usr/bin/faas-cli . && \
docker rm -f faas-cli
docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy -t openfaas/faas-cli:$eTAG .
if [ $? == 0 ] ; then
docker create --name faas-cli openfaas/faas-cli:$eTAG && \
docker cp faas-cli:/usr/bin/faas-cli . && \
docker rm -f faas-cli
else
exit 1
fi