Skip to content

Commit

Permalink
Use stricter bash options
Browse files Browse the repository at this point in the history
  • Loading branch information
GollyTicker committed Oct 7, 2023
1 parent 5852fee commit 8745b5e
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 35 deletions.
2 changes: 1 addition & 1 deletion dev/generate-local.Dockerfile.sh
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
set -euo pipefail

# Concatenate the dev dockerfile and the final release dockerfile to get the combined one
cat dev/builder.local.Dockerfile <(echo "# ==================") release/final.Dockerfile >dev/generated.local.Dockerfile
4 changes: 2 additions & 2 deletions doc/generate-docs.sh
@@ -1,9 +1,9 @@
#!/bin/bash
set -e
set -euo pipefail

WORKING_DIR="$1"

if [[ "$WORKING_DIR" == "" ]]; then
if [[ ! -v WORKING_DIR ]]; then
echo "Please provide the working directory as a a docker-mount friendly path."
exit 1
fi
Expand Down
4 changes: 2 additions & 2 deletions release/0-get-latest-dependencies-versions.sh
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
set -euo pipefail

LATEST_VERSION=""

Expand Down Expand Up @@ -67,7 +67,7 @@ retrieveLatestVersion() {

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

if [[ "$LATEST_VERSION" == "" ]]; then
if [[ ! -v LATEST_VERSION ]]; then
echo "Found tags after filtering:"
echo "$FILTERED_TAGS"
echo "Error: Could not find latest $TYPE for github.com/$REPO with filter $TAG_FILTER"
Expand Down
2 changes: 1 addition & 1 deletion release/10-get-protoc-binaries.sh
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
set -euo pipefail

source release/source.sh

Expand Down
2 changes: 1 addition & 1 deletion release/20-install-go.sh
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
set -euo pipefail
set -x

# Installs Go inside a GitHub action VM / Docker container environment
Expand Down
2 changes: 1 addition & 1 deletion release/30-build-go-archive.sh
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
set -euo pipefail

source release/source.sh

Expand Down
2 changes: 1 addition & 1 deletion release/40-generate-Dockerfile.sh
@@ -1,3 +1,3 @@
#!/bin/bash
set -e
set -euo pipefail
cat release/builder.Dockerfile <(echo "# ==================") release/final.Dockerfile >release/generated.Dockerfile
4 changes: 2 additions & 2 deletions release/source.sh
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
set -euo pipefail

# PRECONDITION: git fetch origin --tags

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

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

GIT_TAG="$(git tag --points-at HEAD --sort -version:refname | head -n 1)"
if [[ "$GIT_TAG" != "" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion test/suite/copy-test-results-output-to-expected.sh
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
set -euo pipefail

source test/suite/setup.sh

Expand Down
2 changes: 1 addition & 1 deletion test/suite/linux/install-test-remove.sh
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
set -euo pipefail

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

Expand Down
28 changes: 14 additions & 14 deletions test/suite/linux/package-alpine.sh
@@ -1,23 +1,23 @@
#!/bin/bash
set -e
set -euo pipefail
set -x

setup() {
# Install powershell + curl + gcompat

apk add --no-cache curl gcompat \
ca-certificates \
less \
ncurses-terminfo-base \
krb5-libs \
libgcc \
libintl \
libssl1.1 \
libstdc++ \
tzdata \
userspace-rcu \
zlib \
icu-libs
ca-certificates \
less \
ncurses-terminfo-base \
krb5-libs \
libgcc \
libintl \
libssl1.1 \
libstdc++ \
tzdata \
userspace-rcu \
zlib \
icu-libs

apk -X https://dl-cdn.alpinelinux.org/alpine/edge/main add --no-cache lttng-ust
# todo. auto-updating url?
Expand All @@ -40,4 +40,4 @@ export -f install
remove() {
apk del protocurl
}
export -f remove
export -f remove
4 changes: 2 additions & 2 deletions test/suite/linux/package-debian.sh
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
set -euo pipefail

setup() {
apt-get update -q
Expand All @@ -21,4 +21,4 @@ export -f install
remove() {
dpkg --remove protocurl
}
export -f remove
export -f remove
4 changes: 2 additions & 2 deletions test/suite/setup.sh
Expand Up @@ -9,7 +9,7 @@ PROTOCURL_IMAGE=""
PROTOCURL_IMAGE_ORIGINAL=""
buildProtocurl() {
set -e
if [[ "$PROTOCURL_RELEASE_VERSION" != "" ]]; then
if [[ -v PROTOCURL_RELEASE_VERSION ]]; then
export PROTOCURL_IMAGE_ORIGINAL="qaware/protocurl:$PROTOCURL_RELEASE_VERSION"
export PROTOCURL_IMAGE="qaware/protocurl:$PROTOCURL_RELEASE_VERSION-test"
echo "Pulling $PROTOCURL_IMAGE_ORIGINAL ..." && docker pull $PROTOCURL_IMAGE_ORIGINAL && echo "Done."
Expand Down Expand Up @@ -52,7 +52,7 @@ COPY --from=builder /lib64*/ld-linux-*.so.2 /lib64/
grep "^ENTRYPOINT " release/final.Dockerfile >>$TMP_DOCKERFILE
remove-leading-spaces-inplace $TMP_DOCKERFILE

cat $TMP_DOCKERFILE | docker build --target final -t $PROTOCURL_IMAGE -f - .
cat $TMP_DOCKERFILE | docker build --target final -t $PROTOCURL_IMAGE -q -f - .
echo "Done."
}
export -f buildProtocurl
Expand Down
10 changes: 6 additions & 4 deletions test/suite/test.sh
@@ -1,14 +1,16 @@
set -e
#!/bin/bash

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

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

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

WORKING_DIR="$1"

export RUN_CLIENT="docker run --rm -v $WORKING_DIR/test/proto:/proto --network host"

export SHOW_LOGS="docker logs"
Expand Down

0 comments on commit 8745b5e

Please sign in to comment.