Bug 1432768 Linting compliance for image builder scripts r=Callek

MozReview-Commit-ID: 3TmtiB47Z5W

--HG--
extra : rebase_source : c66da9713e1732be6f5a6ba26d6b2a18ca17fa34
This commit is contained in:
Simon Fraser 2018-01-24 12:59:11 +00:00
parent e5a072e76a
commit 184caf15a0
4 changed files with 17 additions and 11 deletions

View File

@ -2,7 +2,7 @@
set -ve
test `whoami` == 'root'
test "$(whoami)" == 'root'
# lots of goodies in EPEL
yum install -y epel-release
@ -332,7 +332,7 @@ cd valgrind-$valgrind_version
patch -p0 < /tmp/valgrind-epochs.patch
./configure --prefix=/usr
make -j$(grep -c ^processor /proc/cpuinfo) install
make -j"$(grep -c ^processor /proc/cpuinfo)" install
# Git
cd $BUILD
@ -480,4 +480,4 @@ EOF
cd /
rm -rf $BUILD ~/.ccache ~/.cache ~/.npm
yum clean all
rm $0
rm "$0"

View File

@ -2,7 +2,7 @@
set -v -e
test `whoami` == 'root'
test "$(whoami)" == 'root'
apt-get update
apt-get install -y --force-yes --no-install-recommends \
@ -11,7 +11,7 @@ apt-get install -y --force-yes --no-install-recommends \
sudo
BUILD=/root/build
mkdir $BUILD
mkdir "$BUILD"
tooltool_fetch() {
cat >manifest.tt
@ -20,10 +20,11 @@ tooltool_fetch() {
}
cd $BUILD
# shellcheck disable=SC1091
. /tmp/install-mercurial.sh
cd /
rm -rf $BUILD
apt-get clean
apt-get autoclean
rm $0
rm "$0"

View File

@ -46,14 +46,14 @@ curl -s --fail \
| jq -jr '(.status + .progress, .error | select(. != null) + "\n"), .stream | select(. != null)'
# Exit non-zero if there is error entries in the log
if cat /tmp/docker-build.log | jq -se 'add | .error' > /dev/null; then
raise_error "Image build failed: `cat /tmp/docker-build.log | jq -rse 'add | .error'`";
if result=$(jq -se 'add | .error' /tmp/docker-build.log); then
raise_error "Image build failed: ${result}";
fi
# Sanity check that image was built successfully
if ! cat /tmp/docker-build.log | tail -n 1 | jq -r '.stream' | grep '^Successfully built' > /dev/null; then
if ! tail -n 1 /tmp/docker-build.log | jq -r '.stream' | grep '^Successfully built' > /dev/null; then
echo 'docker-build.log for debugging:';
cat /tmp/docker-build.log | tail -n 50;
tail -n 50 /tmp/docker-build.log;
raise_error "Image build log didn't with 'Successfully built'";
fi
@ -62,6 +62,8 @@ fi
# https://docs.docker.com/engine/reference/api/docker_remote_api_v1.18/
#
# The script will retry up to 10 times.
# Disable quoting error until fixing the / escaping
# shellcheck disable=SC2086
/usr/local/bin/download-and-compress \
http+unix://%2Fvar%2Frun%2Fdocker.sock/images/${IMAGE_NAME}:${HASH}/get \
/builds/worker/workspace/image.tar.zst.tmp \

View File

@ -20,7 +20,9 @@ apt-get install -y --no-install-recommends \
apt-get install -y python-pip
# Install mercurial
# shellcheck disable=SC1091
. /setup/common.sh
# shellcheck disable=SC1091
. /setup/install-mercurial.sh
# Install build-image.sh script
@ -32,6 +34,7 @@ chmod +x /usr/local/bin/download-and-compress
mkdir -p /builds/worker/workspace
# Install python-zstandard.
(
cd /setup
tooltool_fetch <<EOF
[
@ -44,7 +47,7 @@ tooltool_fetch <<EOF
}
]
EOF
cd -
)
/usr/bin/pip -v install /setup/zstandard-0.8.0.tar.gz