Skip to content

Commit

Permalink
add docker compose logs if docker compose up, failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Slach committed Aug 28, 2024
1 parent 3cf4b55 commit a171539
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,22 @@ jobs:
docker compose -f "${CUR_DIR}/${COMPOSE_FILE}" --progress=quiet pull
pids=()
project_ids=()
for ((i = 0; i < RUN_PARALLEL; i++)); do
docker compose -f ${CUR_DIR}/${COMPOSE_FILE} --project-name project${i} --progress plain up -d &
pids+=($!)
project_ids+=("project${i}")
done
for pid in "${pids[@]}"; do
for index in "${!pids[@]}"; do
pid=${pids[index]}
project_id=${project_ids[index]}
if wait "$pid"; then
echo "$pid docker compose up successful"
else
echo "$pid the docker compose up failed. Exiting."
docker compose -f ${CUR_DIR}/${COMPOSE_FILE} --project-name project${i} --progress plain logs
echo "$pid the docker compose up failed."
exit 1 # Exit with an error code if any command fails
fi
done
Expand Down
9 changes: 7 additions & 2 deletions test/integration/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,21 @@ export RUN_PARALLEL=${RUN_PARALLEL:-1}
docker compose -f ${CUR_DIR}/${COMPOSE_FILE} --progress=quiet pull

pids=()
project_ids=()
for ((i = 0; i < RUN_PARALLEL; i++)); do
docker compose -f ${CUR_DIR}/${COMPOSE_FILE} --project-name project${i} --progress plain up -d &
pids+=($!)
project_ids+=("project${i}")
done

for pid in "${pids[@]}"; do
for index in "${!pids[@]}"; do
pid=${pids[index]}
project_id=${project_ids[index]}
if wait "$pid"; then
echo "$pid docker compose up successful"
else
echo "$pid docker compose up failed. Exiting."
docker compose -f ${CUR_DIR}/${COMPOSE_FILE} --project-name project${i} --progress plain logs
echo "$pid the docker compose up failed."
exit 1 # Exit with an error code if any command fails
fi
done
Expand Down

0 comments on commit a171539

Please sign in to comment.