Skip to content

Commit

Permalink
ducktape: retry tinygo command
Browse files Browse the repository at this point in the history
Tinygo has some race/bugs where it fails due to
tinygo-org/tinygo#4206

Add retries to mitigate.

Signed-off-by: Tyler Rockwood <[email protected]>
  • Loading branch information
rockwotj committed Apr 16, 2024
1 parent 3ed09f5 commit 0c1661a
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions tests/docker/ducktape-deps/tinygo-wasi-transforms
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,38 @@
set -e
set -x

function retry {
local retries=$1
shift

local count=0
until "$@"; do
exit=$?
wait=$((2 ** $count))
count=$(($count + 1))
if [ $count -lt $retries ]; then
echo "Retry $count/$retries exited $exit, retrying..."
else
echo "Retry $count/$retries exited $exit, no more retries left."
return $exit
fi
done
return 0
}

mkdir -p /opt/transforms/tinygo/

cd /transform-sdk/go/transform/internal/testdata

tinygo build -target wasi -opt=z \
retry 5 tinygo build -target wasi -opt=z \
-panic print -scheduler none \
-o "/opt/transforms/tinygo/identity.wasm" ./identity

tinygo build -target wasi -opt=z \
retry 5 tinygo build -target wasi -opt=z \
-panic print -scheduler none \
-o "/opt/transforms/tinygo/identity_logging.wasm" ./identity_logging

tinygo build -target wasi -opt=z \
retry 5 tinygo build -target wasi -opt=z \
-panic print -scheduler none \
-o "/opt/transforms/tinygo/tee.wasm" ./tee

Expand Down

0 comments on commit 0c1661a

Please sign in to comment.