Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Print more information about background processes

Christophe Bliard48fd44a74d43
diff --git a/docker/ci/entrypoint.sh b/docker/ci/entrypoint.sh
index 9e706e466b1..50b36ac5c1b 100755
--- a/docker/ci/entrypoint.sh
+++ b/docker/ci/entrypoint.sh
@@ -35,23 +35,32 @@ trap cleanup INT TERM EXIT
declare -a pids=()
run_background() {
- # Run the command in the background
- "$@" &
+ # Run the command in the background
+ "$@" &
- # Store the PID of the background process
- local pid=$!
- pids+=("$pid")
+ # Store the PID of the background process
+ local pid=$!
+ pids+=("$pid")
+
+ echo "[background] Started background process $pid: $@"
}
wait_for_background() {
- for pid in "${pids[@]}"; do
+ # Make a copy of the pids array
+ local waiting_pids=("${pids[@]}")
+ echo "[background] Waiting for background processes ${waiting_pids[@]} to finish..."
+ # Reset the global pids array to empty
+ pids=()
+
+ for pid in "${waiting_pids[@]}"; do
wait "$pid"
# Check the exit status of each background process
if [ $? -ne 0 ]; then
- echo "Command with PID $pid failed"
+ echo "[background] Command with PID $pid failed"
exit 1
fi
done
+ echo "[background] All background processes ${waiting_pids[@]} finished"
}
execute() {
@@ -107,9 +116,9 @@ setup_tests() {
execute_quiet "cp docker/ci/database.yml config/"
create_db_cluster
- execute "gem install bundler --no-document"
+ execute "gem install bundler --no-document"
- run_background execute "BUNDLE_JOBS=8 bundle install --quiet && bundle clean --force && echo BUNDLE DONE"
+ run_background execute "BUNDLE_JOBS=8 bundle install --quiet && bundle clean --force && echo BUNDLE DONE"
run_background execute "JOBS=8 time npm install --quiet && npm prune --quiet && echo NPM DONE"
wait_for_background