Skip to content

Commit

Permalink
support docker compose v2
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Callaway <[email protected]>
  • Loading branch information
bobcallaway authored and cpanato committed Jul 20, 2024
1 parent 02e4223 commit a83ba57
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/sharding-e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@ set -ex
# Things to install first:
# - jq, createtree

docker_compose="docker compose"
if ! ${docker_compose} version >/dev/null 2>&1; then
docker_compose="docker-compose"
fi

# Spin up services as usual

echo "Installing createtree..."
go install github.com/google/trillian/cmd/createtree@latest

echo "starting services"
docker-compose up -d --build
${docker_compose} up -d --build
rm ~/.rekor/state.json || true

echo "building CLI"
Expand Down Expand Up @@ -62,7 +67,7 @@ function waitForRekorServer () {
count=0

echo -n "waiting up to 60 sec for system to start"
until [ $(docker-compose ps | grep -c "(healthy)") == 3 ];
until [ $(${docker_compose} ps | grep -c "(healthy)") == 3 ];
do
if [ $count -eq 6 ]; then
echo "! timeout reached"
Expand All @@ -82,12 +87,12 @@ function waitForRekorServer () {
function collectLogsOnFailure () {
if [[ "$1" -ne "0" ]]; then
echo "failure detected, collecting docker-compose logs"
docker-compose logs --no-color > /tmp/docker-compose.log
${docker_compose} logs --no-color > /tmp/docker-compose.log
exit $1
elif docker-compose logs --no-color | grep -q "panic: runtime error:" ; then
elif ${docker_compose} logs --no-color | grep -q "panic: runtime error:" ; then
# if we're here, we found a panic
echo "failing due to panics detected in logs"
docker-compose logs --no-color > /tmp/docker-compose.log
${docker_compose} logs --no-color > /tmp/docker-compose.log
exit 1
fi
exit 0
Expand Down Expand Up @@ -187,7 +192,7 @@ EOF

# Spin up the new Rekor

docker-compose -f $COMPOSE_FILE up -d
${docker_compose} -f $COMPOSE_FILE up -d
waitForRekorServer
$REKOR_CLI loginfo --rekor_server http://localhost:3000

Expand Down

0 comments on commit a83ba57

Please sign in to comment.