Skip to content

Commit 9c45201

Browse files
committed
Merge pull request #4154 from Joshua-Anderson/add-shellcheck-mesos
test(mesos): run shell scripts through shellcheck
2 parents f921345 + 5561e12 commit 9c45201

5 files changed

Lines changed: 17 additions & 13 deletions

File tree

mesos/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ COMPONENT = $(notdir $(repo_path))
1717
GO_PACKAGES = pkg/boot pkg/confd pkg/etcd pkg/fleet pkg/log pkg/net pkg/os pkg/types
1818
GO_PACKAGES_REPO_PATH = $(addprefix $(repo_path)/,$(GO_PACKAGES))
1919

20+
SHELL_SCRIPTS = $(shell find "." -name '*.sh')
21+
2022
MASTER_IMAGE = $(IMAGE_PREFIX)mesos-master:$(BUILD_TAG)
2123
MASTER_DEV_IMAGE = $(REGISTRY)$(MASTER_IMAGE)
2224
MARATHON_IMAGE = $(IMAGE_PREFIX)mesos-marathon:$(BUILD_TAG)
@@ -129,3 +131,4 @@ test-style:
129131
@for i in $(addsuffix /...,$(GO_PACKAGES)); do \
130132
$(GOLINT) $$i; \
131133
done
134+
shellcheck $(SHELL_SCRIPTS)

mesos/build-marathon-jar.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ if [[ -z $DOCKER_BUILD ]]; then
1010
exit 1
1111
fi
1212

13+
# shellcheck disable=SC2034
1314
DEBIAN_FRONTEND=noninteractive
1415

1516
apt-get update && apt-get install --no-install-recommends -y \
@@ -20,12 +21,14 @@ apt-get update && apt-get install --no-install-recommends -y \
2021
curl -SsL -O http://dl.bintray.com/sbt/debian/sbt-0.13.5.deb && \
2122
dpkg -i sbt-0.13.5.deb
2223

23-
curl -sSL https://github.com/mesosphere/marathon/archive/v$MARATHON_VERSION.tar.gz | tar -xzf - -C /opt
24-
ln -s /opt/marathon-$MARATHON_VERSION /app
25-
ln -s /opt/marathon-$MARATHON_VERSION /marathon
24+
curl -sSL "https://github.com/mesosphere/marathon/archive/v$MARATHON_VERSION.tar.gz" | tar -xzf - -C /opt
25+
ln -s "/opt/marathon-$MARATHON_VERSION" /app
26+
ln -s "/opt/marathon-$MARATHON_VERSION" /marathon
2627

2728
cd /app
2829

30+
# Word splitting wanted in this situation.
31+
# shellcheck disable=SC2046
2932
sbt assembly && \
3033
mv $(find target -name 'marathon-assembly-*.jar' | sort | tail -1) ./ && \
3134
rm -rf target/* ~/.sbt ~/.ivy2 && \
@@ -35,4 +38,3 @@ sbt assembly && \
3538
apt-get clean -y && \
3639
rm -rf /tmp/* /var/tmp/* && \
3740
rm -rf /var/lib/apt/lists/*
38-

mesos/build-marathon.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@ cd /tmp
1616

1717
mkdir -p /opt
1818

19-
curl -sSL https://github.com/mesosphere/marathon/archive/v$MARATHON_VERSION.tar.gz | tar -xzf - -C /opt
20-
ln -s /opt/marathon-$MARATHON_VERSION /app
21-
ln -s /opt/marathon-$MARATHON_VERSION /marathon
19+
curl -sSL "https://github.com/mesosphere/marathon/archive/v$MARATHON_VERSION.tar.gz" | tar -xzf - -C /opt
20+
ln -s "/opt/marathon-$MARATHON_VERSION" /app
21+
ln -s "/opt/marathon-$MARATHON_VERSION" /marathon
2222

23-
mkdir -p /opt/marathon-$MARATHON_VERSION/target
24-
ln -s /marathon-assembly.jar /opt/marathon-$MARATHON_VERSION/target/marathon-assembly-$MARATHON_VERSION.jar
23+
mkdir -p "/opt/marathon-$MARATHON_VERSION/target"
24+
ln -s "/marathon-assembly.jar /opt/marathon-$MARATHON_VERSION/target/marathon-assembly-$MARATHON_VERSION.jar"
2525

2626
apt-get autoremove -y --purge && \
2727
apt-get clean -y && \
2828
rm -Rf /usr/share/man /usr/share/doc && \
2929
rm -rf /tmp/* /var/tmp/* && \
3030
rm -rf /var/lib/apt/lists/*
31-

mesos/build-mesos.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ if [[ -z $DOCKER_BUILD ]]; then
1010
exit 1
1111
fi
1212

13+
# shellcheck disable=SC2034
1314
DEBIAN_FRONTEND=noninteractive
1415

1516
echo "deb http://repos.mesosphere.io/ubuntu/ trusty main" > /etc/apt/sources.list.d/mesosphere.list
1617

1718
apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF
1819

1920
apt-get update && \
20-
apt-get -y install mesos=$MESOS
21+
apt-get -y install mesos="$MESOS"
2122

2223
apt-get autoremove -y --purge && \
2324
apt-get clean -y && \
2425
rm -Rf /usr/share/man /usr/share/doc && \
2526
rm -rf /tmp/* /var/tmp/* && \
2627
rm -rf /var/lib/apt/lists/*
27-

mesos/zookeeper/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# fail on any command exiting non-zero
44
set -eo pipefail
55

6-
if [[ -z $DOCKER_BUILD ]]; then
6+
if [ -z "$DOCKER_BUILD" ]; then
77
echo
88
echo "Note: this script is intended for use by the Dockerfile and not as a way to build zoopeeper locally"
99
echo

0 commit comments

Comments
 (0)