build: Lint shell scripts, and make all shell scripts lint cleanly

This commit is contained in:
James Nugent
2017-09-08 19:42:42 -05:00
parent 9ec82bc545
commit e8c17e2aba
8 changed files with 32 additions and 27 deletions

View File

@@ -1,14 +1,14 @@
#!/usr/bin/env bash
# First get the OS-specific packages
GOOS=windows go get $DEP_ARGS github.com/StackExchange/wmi
GOOS=windows go get $DEP_ARGS github.com/shirou/w32
GOOS=linux go get $DEP_ARGS github.com/docker/docker/pkg/mount
GOOS=linux go get $DEP_ARGS github.com/opencontainers/runc/libcontainer/cgroups/fs
GOOS=linux go get $DEP_ARGS github.com/opencontainers/runc/libcontainer/configs
GOOS=linux go get $DEP_ARGS github.com/coreos/go-systemd/util
GOOS=linux go get $DEP_ARGS github.com/coreos/go-systemd/dbus
GOOS=windows go get "${DEP_ARGS}" github.com/StackExchange/wmi
GOOS=windows go get "${DEP_ARGS}" github.com/shirou/w32
GOOS=linux go get "${DEP_ARGS}" github.com/docker/docker/pkg/mount
GOOS=linux go get "${DEP_ARGS}" github.com/opencontainers/runc/libcontainer/cgroups/fs
GOOS=linux go get "${DEP_ARGS}" github.com/opencontainers/runc/libcontainer/configs
GOOS=linux go get "${DEP_ARGS}" github.com/coreos/go-systemd/util
GOOS=linux go get "${DEP_ARGS}" github.com/coreos/go-systemd/dbus
# Get the rest of the deps
DEPS=$(go list -f '{{range .TestImports}}{{.}} {{end}}' ./...)
go get $DEP_ARGS ./... $DEPS
go get "${DEP_ARGS}" ./... "${DEPS}"

View File

@@ -3,7 +3,7 @@ set -e
# Get the version from the command line
VERSION=$1
if [ -z $VERSION ]; then
if [ -z "${VERSION}" ]; then
echo "Please specify a version. (format: 0.4.0-rc1)"
exit 1
fi
@@ -14,10 +14,10 @@ while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
# Change into that dir because we expect that
cd $DIR
cd "${DIR}"
# Generate the tag.
if [ -z $NOTAG ]; then
if [ -z "${NOTAG}" ]; then
echo "==> Tagging..."
git commit --allow-empty -a --gpg-sign=348FFC4C -m "Release v$VERSION"
git tag -a -m "Version $VERSION" -s -u 348FFC4C "v${VERSION}" master
@@ -26,21 +26,19 @@ fi
# Zip all the files
rm -rf ./pkg/dist
mkdir -p ./pkg/dist
for FILENAME in $(find ./pkg -mindepth 1 -maxdepth 1 -type f); do
FILENAME=$(basename $FILENAME)
cp ./pkg/${FILENAME} ./pkg/dist/nomad_${VERSION}_${FILENAME}
done
find ./pkg -mindepth 1 -maxdepth 1 -type f -exec cp ./pkg/{} ./pkg/dist/nomad_"${VERSION}"_{} \;
# Make the checksums
pushd ./pkg/dist
shasum -a256 * > ./nomad_${VERSION}_SHA256SUMS
if [ -z $NOSIGN ]; then
shasum -a256 ./* > "./nomad_${VERSION}_SHA256SUMS"
if [ -z "${NOSIGN}" ]; then
echo "==> Signing..."
gpg --default-key 348FFC4C --detach-sig ./nomad_${VERSION}_SHA256SUMS
gpg --default-key 348FFC4C --detach-sig "./nomad_${VERSION}_SHA256SUMS"
fi
popd
# Upload
if [ -z $HC_RELEASE ]; then
hc-releases upload $DIR/pkg/dist && hc-releases publish
if [ -z "${HC_RELEASE}" ]; then
hc-releases upload "${DIR}/pkg/dist" && hc-releases publish
fi

View File

@@ -1,7 +1,7 @@
#!/bin/bash
if [[ "$USER" != "vagrant" ]]; then
echo "WARNING: This script is intended to be run from Nomad's Vagrant"
read -rsp $'Press any key to continue anyway...\n' -n1 key
read -rsp $'Press any key to continue anyway...\n' -n1
fi
set -e
@@ -12,7 +12,7 @@ if [[ ! -a /usr/local/bin/weave ]]; then
sudo chmod a+x /usr/local/bin/weave
fi
weave launch || echo "weave running"
eval $(weave env)
eval "$(weave env)"
if curl -s localhost:8500 > /dev/null; then
echo "Consul running"

View File

@@ -5,8 +5,10 @@ export PING_SLEEP=60
bash -c "while true; do echo \$(date) - building ...; sleep $PING_SLEEP; done" &
PING_LOOP_PID=$!
trap "kill $PING_LOOP_PID" EXIT HUP INT QUIT TERM
trap 'kill ${PING_LOOP_PID}' EXIT HUP INT QUIT TERM
make check
make checkscripts
make test
TEST_OUTPUT=$?

View File

@@ -6,10 +6,10 @@ DOCKER_VERSION="1.10.3"
sudo stop docker
sudo rm -rf /var/lib/docker
sudo rm -f `which docker`
sudo rm -f "$(which docker)"
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install -y --force-yes -o Dpkg::Options::="--force-confnew" docker-engine=$DOCKER_VERSION-0~`lsb_release -cs`
sudo apt-get install -y --force-yes -o Dpkg::Options::="--force-confnew" docker-engine="$DOCKER_VERSION-0~$(lsb_release -cs)"
docker version

View File

@@ -12,7 +12,7 @@ function install_go() {
wget -q -O /tmp/go.tar.gz ${download}
tar -C /tmp -xvf /tmp/go.tar.gz
tar -C /tmp -xf /tmp/go.tar.gz
sudo mv /tmp/go /usr/local
sudo chown -R root:root /usr/local/go
}