Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed download of NATS Server for latest/main #711

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions buildOnTravis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ echo "build opts = " $3
echo "test opts = " $4

if [ "$NATS_TEST_SERVER_VERSION" != "" ]; then
rm -fr $HOME/nats-server*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

rel=$NATS_TEST_SERVER_VERSION
mkdir -p $HOME/nats-server-$rel
if [ "$rel" = "latest" ]; then
Expand All @@ -19,14 +20,33 @@ if [ "$NATS_TEST_SERVER_VERSION" != "" ]; then

if [ "$rel" != "${rel#v}" ] && wget https://github.com/nats-io/nats-server/releases/download/$rel/nats-server-$rel-linux-amd64.tar.gz; then
tar -xzf nats-server-$rel-linux-amd64.tar.gz
mv nats-server-$rel-linux-amd64 $HOME/nats-server-$rel
mv nats-server-$rel-linux-amd64 nats-server
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wallyqs should the retry logic be added to your script?

else
curl -sf "https://binaries.nats.dev/nats-io/nats-server/v2@$rel" | PREFIX=. sh
mv nats-server $HOME/nats-server-$rel
for c in 1 2 3 4 5
do
echo "Attempt $c to download binary for main"
rm ./nats-server
curl -sf "https://binaries.nats.dev/nats-io/nats-server/v2@$rel" | PREFIX=. sh
# We are sometimes getting nats-server of size 0. Make sure we have a
# working nats-server by making sure we get a version number.
v="$(./nats-server -v)"
if [ "$v" != "" ]; then
break
fi
done
fi
mv nats-server $HOME/nats-server-$rel
PATH=$HOME/nats-server-$rel:$PATH
fi

export NATS_TEST_SERVER_VERSION="$(nats-server -v)"
if [ "$NATS_TEST_SERVER_VERSION" = "" ]; then
echo "==============================================="
echo "= Unable to get the server version, aborting! ="
echo "==============================================="
exit 1
fi

if [ "$1" != "gcc" ]; then
if [ "$2" = "coverage" ]; then
# only coverage for gcc compiler
Expand Down Expand Up @@ -54,7 +74,6 @@ if [ $res -ne 0 ]; then
fi

export NATS_TEST_TRAVIS=yes
export NATS_TEST_SERVER_VERSION="$(nats-server -v)"
echo "Using NATS server version: $NATS_TEST_SERVER_VERSION"
ctest --timeout 60 --output-on-failure $4
res=$?
Expand Down