mirror of
https://github.com/weaveworks/scope.git
synced 2026-02-14 18:09:59 +00:00
Clean up lint errors in shell scripts
This commit is contained in:
52
bin/release
52
bin/release
@@ -39,7 +39,7 @@ setup() {
|
||||
else
|
||||
echo "Cannot determine version - multiple tags point at HEAD:" >&2
|
||||
for TAG in $HEAD_TAGS; do
|
||||
echo -e "\t$TAG" >&2
|
||||
echo -e "\\t$TAG" >&2
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
@@ -65,8 +65,8 @@ build() {
|
||||
|
||||
echo "== Clone repo at $LATEST_TAG for version $VERSION"
|
||||
if [ -d "$RELEASE_DIR" ]; then
|
||||
echo -e "\u2757 Release directory $RELEASE_DIR already exists, you may want to" >&2
|
||||
echo -e "\trm -rf $RELEASE_DIR" >&2
|
||||
echo -e "\\u2757 Release directory $RELEASE_DIR already exists, you may want to" >&2
|
||||
echo -e "\\trm -rf $RELEASE_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -78,7 +78,7 @@ build() {
|
||||
## Check that the top changelog entry is this version
|
||||
if ! latest_changelog=$(perl -nle'print $& if m{(?<=^## Release ).*}' ./CHANGELOG.md | head -1) \
|
||||
|| ! [ "$latest_changelog" = "$VERSION" ]; then
|
||||
echo -e "\u2757 Latest changelog entry \"$latest_changelog\" does not match the release version $VERSION" >&2
|
||||
echo -e "\\u2757 Latest changelog entry \"$latest_changelog\" does not match the release version $VERSION" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -93,7 +93,7 @@ build() {
|
||||
if make tests SUDO="$SUDO"; then
|
||||
echo -e '\u2713 Tests pass'
|
||||
else
|
||||
echo -e "\u2757 Tests failed, probably best not publish this one" >&2
|
||||
echo -e "\\u2757 Tests failed, probably best not publish this one" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -119,20 +119,20 @@ draft() {
|
||||
|
||||
## Check that the tag exists by looking at github
|
||||
if ! curl -sSf "https://api.github.com/repos/$GITHUB_USER/scope/git/tags/$LATEST_TAG_SHA" >/dev/null 2>&1; then
|
||||
echo -e "\u2757 Tag $LATEST_TAG is not on GitHub, or is not the same as the local tag" >&2
|
||||
echo -e "\thttps://github.com/$GITHUB_USER/scope/tags" >&2
|
||||
echo -e "\\u2757 Tag $LATEST_TAG is not on GitHub, or is not the same as the local tag" >&2
|
||||
echo -e "\\thttps://github.com/$GITHUB_USER/scope/tags" >&2
|
||||
echo "You may need to" >&2
|
||||
echo -e "\tgit push git@github.com:$GITHUB_USER/scope $LATEST_TAG"
|
||||
echo -e "\\tgit push git@github.com:$GITHUB_USER/scope $LATEST_TAG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "\u2713 Tag $LATEST_TAG exists in GitHub repo $GITHUB_USER/scope"
|
||||
echo -e "\\u2713 Tag $LATEST_TAG exists in GitHub repo $GITHUB_USER/scope"
|
||||
|
||||
## Check that the version does not already exist by looking at github
|
||||
## releases
|
||||
if github-release info --user "$GITHUB_USER" --repo scope --tag "$LATEST_TAG" >/dev/null 2>&1; then
|
||||
echo -e "\u2757 Release $LATEST_TAG already exists on GitHub" >&2
|
||||
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG" >&2
|
||||
echo -e "\\u2757 Release $LATEST_TAG already exists on GitHub" >&2
|
||||
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -144,7 +144,7 @@ draft() {
|
||||
fi
|
||||
|
||||
echo "== Creating GitHub release $RELEASE_ARGS $RELEASE_NAME $VERSION"
|
||||
github-release release $RELEASE_ARGS \
|
||||
github-release release "$RELEASE_ARGS" \
|
||||
--user "$GITHUB_USER" \
|
||||
--repo scope \
|
||||
--tag "$LATEST_TAG" \
|
||||
@@ -159,7 +159,7 @@ draft() {
|
||||
--file "./scope"
|
||||
|
||||
echo "** Draft $TYPE $RELEASE_NAME $VERSION created at"
|
||||
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
|
||||
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
|
||||
}
|
||||
|
||||
publish() {
|
||||
@@ -177,22 +177,22 @@ publish() {
|
||||
--tag "$LATEST_TAG"
|
||||
|
||||
echo "** Pre-release $RELEASE_NAME $VERSION published at"
|
||||
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
|
||||
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
|
||||
else
|
||||
echo "== Sanity checks"
|
||||
if ! [ "$LATEST_TAG_COMMIT_SHA" == "$LATEST_RELEASE_COMMIT_SHA" ]; then
|
||||
echo -e "\u2757 The tag latest_release does not point to the same commit as $LATEST_TAG" >&2
|
||||
echo -e "\\u2757 The tag latest_release does not point to the same commit as $LATEST_TAG" >&2
|
||||
echo "You may need to" >&2
|
||||
echo -e "\tgit tag -af latest_release $LATEST_TAG" >&2
|
||||
echo -e "\\tgit tag -af latest_release $LATEST_TAG" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## Check that the 'latest_release' tag exists by looking at github
|
||||
if ! curl -sSf "https://api.github.com/repos/$GITHUB_USER/scope/git/tags/$LATEST_RELEASE_SHA" >/dev/null 2>&1; then
|
||||
echo -e "\u2757 Tag latest_release is not on GitHub, or is not the same as the local tag" >&2
|
||||
echo -e "\thttps://github.com/$GITHUB_USER/scope/tags" >&2
|
||||
echo -e "\\u2757 Tag latest_release is not on GitHub, or is not the same as the local tag" >&2
|
||||
echo -e "\\thttps://github.com/$GITHUB_USER/scope/tags" >&2
|
||||
echo "You may need to" >&2
|
||||
echo -e "\tgit push -f git@github.com:$GITHUB_USER/scope latest_release" >&2
|
||||
echo -e "\\tgit push -f git@github.com:$GITHUB_USER/scope latest_release" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo '** Sanity checks OK for publishing tag' "$LATEST_TAG" as "$DOCKERHUB_USER/scope:$VERSION"
|
||||
@@ -229,8 +229,8 @@ publish() {
|
||||
--file "./scope"
|
||||
|
||||
echo "** Release $RELEASE_NAME $VERSION published at"
|
||||
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
|
||||
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/latest_release"
|
||||
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
|
||||
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/latest_release"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -254,19 +254,19 @@ push_images() {
|
||||
|
||||
usage() {
|
||||
echo "Usage:"
|
||||
echo -e "\t./bin/release build"
|
||||
echo -e "\\t./bin/release build"
|
||||
echo "-- Build artefacts for the latest version tag"
|
||||
echo -e "\t./bin/release draft"
|
||||
echo -e "\\t./bin/release draft"
|
||||
echo "-- Create draft release with artefacts in GitHub"
|
||||
echo -e "\t./bin/release publish"
|
||||
echo -e "\\t./bin/release publish"
|
||||
echo "-- Publish the GitHub release and update DockerHub"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Ensure required tooling is installed
|
||||
if ! which github-release >/dev/null; then
|
||||
if ! command -v github-release >/dev/null; then
|
||||
echo "Please install git-release:" >&2
|
||||
echo -e "\tgo get github.com/weaveworks/github-release" >&2
|
||||
echo -e "\\tgo get github.com/weaveworks/github-release" >&2
|
||||
echo "and create a git token per https://github.com/weaveworks/github-release" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
set -e
|
||||
|
||||
./in_parallel.sh "make RM=" "$(find . -maxdepth 2 -name "*.go" -printf "%h\n" | sort -u | sed -n 's/\.\/\(.*\)/\1\/\1/p')"
|
||||
./in_parallel.sh "make RM=" "$(find . -maxdepth 2 -name "*.go" -printf "%h\\n" | sort -u | sed -n 's/\.\/\(.*\)/\1\/\1/p')"
|
||||
|
||||
@@ -23,7 +23,7 @@ while true; do
|
||||
rand=$(((RANDOM % max_dialer) + 1))
|
||||
container=${dialer[$rand]}
|
||||
docker rm -f "$container" >/dev/null &
|
||||
unset dialer[$rand]
|
||||
unset "dialer[$rand]"
|
||||
dialer=("${dialer[@]}")
|
||||
fi
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ function generate_latest_map() {
|
||||
func (m ${latest_map_type}) String() string {
|
||||
buf := bytes.NewBufferString("{")
|
||||
for _, val := range m {
|
||||
fmt.Fprintf(buf, "%s: %s,\n", val.key, val.String())
|
||||
fmt.Fprintf(buf, "%s: %s,\\n", val.key, val.String())
|
||||
}
|
||||
fmt.Fprintf(buf, "}")
|
||||
return buf.String()
|
||||
|
||||
@@ -20,7 +20,7 @@ PROBEID=$(docker_on "$HOST1" logs weavescope 2>&1 | grep "probe starting" | sed
|
||||
# container's PATH settings are respected, which isn't the case for
|
||||
# login shells.
|
||||
PIPEID=$(curl -s -f -X POST "http://$HOST1:4040/api/control/$PROBEID/$CID;<container>/docker_exec_container" | jq -r '.pipe')
|
||||
assert "(sleep 1 && echo 'echo \$PATH' && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb" "/ # 6necho \$PATH\n/home:/usr/bin\n/ # 6n"
|
||||
assert "(sleep 1 && echo 'echo \$PATH' && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb" "/ # 6necho \$PATH\\n/home:/usr/bin\\n/ # 6n"
|
||||
|
||||
assert_raises "curl -f -X POST 'http://$HOST1:4040/api/control/$PROBEID/$CID;<container>/docker_stop_container'"
|
||||
|
||||
|
||||
@@ -15,6 +15,6 @@ HOSTID=$($SSH "$HOST1" hostname)
|
||||
|
||||
# Execute 'echo foo' in the host tty and check its output
|
||||
PIPEID=$(curl -s -f -X POST "http://$HOST1:4040/api/control/$PROBEID/$HOSTID;<host>/host_exec" | jq -r '.pipe')
|
||||
assert "(sleep 1 && echo \"PS1=''; echo foo\" && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb | tail -n 1" "foo\n"
|
||||
assert "(sleep 1 && echo \"PS1=''; echo foo\" && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb | tail -n 1" "foo\\n"
|
||||
|
||||
scope_end_suite
|
||||
|
||||
6
scope
6
scope
@@ -18,7 +18,7 @@ SCOPE_IMAGE="$SCOPE_IMAGE_NAME:$IMAGE_VERSION"
|
||||
# with care.
|
||||
SCOPE_CONTAINER_NAME="${SCOPE_CONTAINER_NAME:-weavescope}"
|
||||
SCOPE_APP_CONTAINER_NAME="${SCOPE_APP_CONTAINER_NAME:-weavescope-app}"
|
||||
IP_REGEXP="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
|
||||
IP_REGEXP="[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}"
|
||||
IP_ADDR_CMD="find /sys/class/net -type l | xargs -n1 basename | grep -vE 'docker|veth|lo' | \
|
||||
xargs -n1 ip addr show | grep inet | awk '{ print \$2 }' | grep -oE '$IP_REGEXP'"
|
||||
LISTENING_IP_ADDR_CMD="for I in \$( $IP_ADDR_CMD ); do if curl -m 1 -s \${I}:4040 > /dev/null ; then echo \${I}; fi; done"
|
||||
@@ -112,11 +112,11 @@ check_docker_version() {
|
||||
}
|
||||
|
||||
check_probe_only() {
|
||||
echo "${ARGS}" | grep -q -E "\-\-no\-app|\-\-service\-token|\-\-probe\-only"
|
||||
echo "${ARGS}" | grep -q -E -e "--no-app|--service-token|--probe-only"
|
||||
}
|
||||
|
||||
check_listen_address_arg() {
|
||||
echo "${ARGS}" | grep -q -E "\-\-app\.http\.address"
|
||||
echo "${ARGS}" | grep -q -E -e "--app\\.http\\.address"
|
||||
}
|
||||
|
||||
check_docker_for_mac() {
|
||||
|
||||
Reference in New Issue
Block a user