Skip to content

Commit 8745b5e

Browse files
committed
Use stricter bash options
1 parent 5852fee commit 8745b5e

14 files changed

+37
-35
lines changed

Diff for: dev/generate-local.Dockerfile.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e
2+
set -euo pipefail
33

44
# Concatenate the dev dockerfile and the final release dockerfile to get the combined one
55
cat dev/builder.local.Dockerfile <(echo "# ==================") release/final.Dockerfile >dev/generated.local.Dockerfile

Diff for: doc/generate-docs.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
2-
set -e
2+
set -euo pipefail
33

44
WORKING_DIR="$1"
55

6-
if [[ "$WORKING_DIR" == "" ]]; then
6+
if [[ ! -v WORKING_DIR ]]; then
77
echo "Please provide the working directory as a a docker-mount friendly path."
88
exit 1
99
fi

Diff for: release/0-get-latest-dependencies-versions.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e
2+
set -euo pipefail
33

44
LATEST_VERSION=""
55

@@ -67,7 +67,7 @@ retrieveLatestVersion() {
6767

6868
LATEST_VERSION="$(echo "$FILTERED_TAGS" | $LATEST_VERSION_EXTRACTOR -n 1)"
6969

70-
if [[ "$LATEST_VERSION" == "" ]]; then
70+
if [[ ! -v LATEST_VERSION ]]; then
7171
echo "Found tags after filtering:"
7272
echo "$FILTERED_TAGS"
7373
echo "Error: Could not find latest $TYPE for github.com/$REPO with filter $TAG_FILTER"

Diff for: release/10-get-protoc-binaries.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e
2+
set -euo pipefail
33

44
source release/source.sh
55

Diff for: release/20-install-go.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e
2+
set -euo pipefail
33
set -x
44

55
# Installs Go inside a GitHub action VM / Docker container environment

Diff for: release/30-build-go-archive.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e
2+
set -euo pipefail
33

44
source release/source.sh
55

Diff for: release/40-generate-Dockerfile.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
2-
set -e
2+
set -euo pipefail
33
cat release/builder.Dockerfile <(echo "# ==================") release/final.Dockerfile >release/generated.Dockerfile

Diff for: release/source.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e
2+
set -euo pipefail
33

44
# PRECONDITION: git fetch origin --tags
55

@@ -12,7 +12,7 @@ export BUILD_ARCH="$(uname -m | sed "s/x86_64/amd64/" | sed "s/x86_32/386/" | se
1212
git config versionsort.suffix -
1313
# See: https://github.com/git/git/blob/master/Documentation/config/versionsort.txt
1414

15-
if [[ "$VVERSION" == "" ]]; then
15+
if [[ ! -v VVERSION ]]; then
1616

1717
GIT_TAG="$(git tag --points-at HEAD --sort -version:refname | head -n 1)"
1818
if [[ "$GIT_TAG" != "" ]]; then

Diff for: test/suite/copy-test-results-output-to-expected.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e
2+
set -euo pipefail
33

44
source test/suite/setup.sh
55

Diff for: test/suite/linux/install-test-remove.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e
2+
set -euo pipefail
33

44
# should be run inside ./test folder within a container to test packaged linux releases
55

Diff for: test/suite/linux/package-alpine.sh

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
#!/bin/bash
2-
set -e
2+
set -euo pipefail
33
set -x
44

55
setup() {
66
# Install powershell + curl + gcompat
77

88
apk add --no-cache curl gcompat \
9-
ca-certificates \
10-
less \
11-
ncurses-terminfo-base \
12-
krb5-libs \
13-
libgcc \
14-
libintl \
15-
libssl1.1 \
16-
libstdc++ \
17-
tzdata \
18-
userspace-rcu \
19-
zlib \
20-
icu-libs
9+
ca-certificates \
10+
less \
11+
ncurses-terminfo-base \
12+
krb5-libs \
13+
libgcc \
14+
libintl \
15+
libssl1.1 \
16+
libstdc++ \
17+
tzdata \
18+
userspace-rcu \
19+
zlib \
20+
icu-libs
2121

2222
apk -X https://dl-cdn.alpinelinux.org/alpine/edge/main add --no-cache lttng-ust
2323
# todo. auto-updating url?
@@ -40,4 +40,4 @@ export -f install
4040
remove() {
4141
apk del protocurl
4242
}
43-
export -f remove
43+
export -f remove

Diff for: test/suite/linux/package-debian.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e
2+
set -euo pipefail
33

44
setup() {
55
apt-get update -q
@@ -21,4 +21,4 @@ export -f install
2121
remove() {
2222
dpkg --remove protocurl
2323
}
24-
export -f remove
24+
export -f remove

Diff for: test/suite/setup.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ PROTOCURL_IMAGE=""
99
PROTOCURL_IMAGE_ORIGINAL=""
1010
buildProtocurl() {
1111
set -e
12-
if [[ "$PROTOCURL_RELEASE_VERSION" != "" ]]; then
12+
if [[ -v PROTOCURL_RELEASE_VERSION ]]; then
1313
export PROTOCURL_IMAGE_ORIGINAL="qaware/protocurl:$PROTOCURL_RELEASE_VERSION"
1414
export PROTOCURL_IMAGE="qaware/protocurl:$PROTOCURL_RELEASE_VERSION-test"
1515
echo "Pulling $PROTOCURL_IMAGE_ORIGINAL ..." && docker pull $PROTOCURL_IMAGE_ORIGINAL && echo "Done."
@@ -52,7 +52,7 @@ COPY --from=builder /lib64*/ld-linux-*.so.2 /lib64/
5252
grep "^ENTRYPOINT " release/final.Dockerfile >>$TMP_DOCKERFILE
5353
remove-leading-spaces-inplace $TMP_DOCKERFILE
5454

55-
cat $TMP_DOCKERFILE | docker build --target final -t $PROTOCURL_IMAGE -f - .
55+
cat $TMP_DOCKERFILE | docker build --target final -t $PROTOCURL_IMAGE -q -f - .
5656
echo "Done."
5757
}
5858
export -f buildProtocurl

Diff for: test/suite/test.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
set -e
1+
#!/bin/bash
22

3-
# Test suite: Starts the server and sends multiple requests against it to check the log output
3+
set -euo pipefail
44

5-
WORKING_DIR="$1"
5+
# Test suite: Starts the server and sends multiple requests against it to check the log output
66

7-
if [[ "$WORKING_DIR" == "" ]]; then
7+
if [[ "$#" == 0 ]]; then
88
echo "Please provide the working directory as a a docker-mount friendly path."
99
exit 1
1010
fi
1111

12+
WORKING_DIR="$1"
13+
1214
export RUN_CLIENT="docker run --rm -v $WORKING_DIR/test/proto:/proto --network host"
1315

1416
export SHOW_LOGS="docker logs"

0 commit comments

Comments
 (0)