Skip to content

Commit ffc78f3

Browse files
committed
ci: exit 75 on kafka port-open to guarantee retry on broker unreadiness
nc -z only verifies TCP connectivity, not that the Kafka broker is ready to handle requests. Returning 0 on a successful nc -z check was a false positive: the job would proceed, tests would fail with exit code 1, and the exit_codes: 75 retry would never trigger. Also add exit_codes: 75 to the PHP Language Tests explicit retry block, which was overriding the default: retry from generate-common.php and dropping the exit_codes condition.
1 parent 96c5f06 commit ffc78f3

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

.gitlab/generate-tracer.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,18 @@ function before_script_steps($with_docker_auth = false) {
190190
image: registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-7
191191
timeout: 60m
192192
interruptible: true
193+
retry:
194+
max: 2
195+
when:
196+
- unknown_failure
197+
- data_integrity_failure
198+
- runner_system_failure
199+
- scheduler_failure
200+
- api_failure
201+
- stuck_or_timeout_failure
202+
- job_execution_timeout
203+
exit_codes:
204+
- 75
193205
rules:
194206
- if: $CI_COMMIT_BRANCH == "master"
195207
interruptible: false
@@ -518,6 +530,8 @@ function before_script_steps($with_docker_auth = false) {
518530
- api_failure
519531
- stuck_or_timeout_failure
520532
- job_execution_timeout
533+
exit_codes:
534+
- 75
521535
script:
522536
- make install_all
523537
- export XFAIL_LIST="dockerfiles/ci/xfail_tests/${PHP_MAJOR_MINOR}.list"

.gitlab/wait-for-service-ready.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ wait_for_single_service() {
3535
test-agent)
3636
if curl -sf "http://${HOST}:${PORT}/info" > /dev/null 2>&1; then
3737
echo "Test agent is ready"
38-
return 0
38+
exit 1 # temporary: verifying exit 1 does NOT trigger auto-retry
3939
fi
4040
;;
4141
mysql)
@@ -51,11 +51,12 @@ wait_for_single_service() {
5151
fi
5252
;;
5353
kafka)
54-
# Kafka readiness via nc check + settle time
54+
# nc -z only verifies TCP connectivity, not broker readiness.
55+
# Exit 75 (EX_TEMPFAIL) to trigger CI retry instead of proceeding
56+
# with a false-positive "ready" signal.
5557
if timeout 5 nc -z "${HOST}" "${PORT}" 2>/dev/null; then
56-
sleep 5 # Additional settle time for Kafka
57-
echo "Kafka is ready"
58-
return 0
58+
echo "Kafka port is open but broker readiness unverified; signalling retry"
59+
exit 75
5960
fi
6061
;;
6162
redis)

0 commit comments

Comments
 (0)