fix(ci): hold the MariaDB lane's sdk-java lock once per job (#14896) (#14903)

* fix(ci): hold the MariaDB lane's sdk-java lock once per job (#14896)

Co-authored-by: Qwen-Coder <[email protected]>

* test(ci): pin the merged MariaDB step's order and SpotBugs witness

The single-step merge dropped guarantees that the two-step layout got for
free from step boundaries, and one witness became satisfiable by prose:

- spotbugs-gate matched `verify` anywhere in the step body, and the merged
  step's own comments explain the incident with the word 'verify' twice.
  A later narrowing to `clean test` would stay green. Match `clean verify`
  on command lines only.
- seed-before-write-back was a step-order invariant; both strings now live
  in one body with presence assertions only, and the write-back's warning
  arm swallows the ordering failure. Pin seed < install < verify <
  write-back.
- `working-directory:` applied to the whole step and could not be
  misplaced; its `cd` replacement is positional inside the body. Pin it
  between the two Maven runs.
- Drop the finder arm that matched the deleted `working-directory:`
  property: no step in either inspected job carries it any more.

---------

Co-authored-by: Qwen-Coder <[email protected]>
Co-authored-by: 易良 <[email protected]>
Co-authored-by: Shaojin Wen <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-10-21 00:53:44 +08:00
1 parent 8a79f8c680
commit b05be4cd23
4 files changed
+114 -89

No files matched your search

+21 -29
View File
@@ -437,15 +437,15 @@ jobs:
# pool-safe: the database is a per-job service container on a random host
# port, and every Maven run holds the test job's per-host sdk-java lock.
runs-on: '${{ (github.repository == ''QwenLM/qwen-code'' && vars.MAINTAINER_ECS_RUNNER_DISABLED != ''true'' && (github.event_name != ''pull_request'' && github.event_name != ''pull_request_review'' || github.event.pull_request.head.repo.full_name == github.repository || contains(fromJSON(''["OWNER","MEMBER","COLLABORATOR"]''), github.event.pull_request.author_association))) && fromJSON(''["self-hosted", "linux", "x64", "ecs-qwen"]'') || fromJSON(''["ubuntu-latest"]'') }}'
# On the pool this job takes the per-host sdk-java lock once per
# Maven step — two acquisitions today — behind the fast tier's ~925 s
# hold. Run 39229303984's fast-tier job exhausted the old 60-minute
# wait before Maven started, so each acquisition now waits 90 minutes.
# The ceiling absorbs both waits, the ~50 minutes of measured Maven
# work, 30 minutes of uncapped setup and margin: 280. Hosted lanes
# never take the lock and inherit this ceiling as a bound, not as an
# expected duration.
timeout-minutes: 280
# On the pool this job takes the per-host sdk-java lock once, around the
# single step that runs both Maven commands. Run 39353663670's verify
# acquisition waited the full 90 minutes after the install step released
# the lock, so a per-step lock let this job lose its place in the host
# queue between installing and verifying. The ceiling absorbs that wait,
# the ~60 minutes of measured Maven work, and 30 minutes of uncapped
# setup plus 20 minutes of margin: 200. Hosted lanes never take the lock
# and inherit this ceiling as a bound, not as an expected duration.
timeout-minutes: 200
services:
mariadb:
image: 'mariadb:10.11.18'
@@ -646,16 +646,21 @@ jobs:
sleep $((attempt * 15))
done
- name: 'Install Managed Agent dependencies'
- name: 'Install and verify Managed Agent dependencies, tests, Checkstyle, and MySQL integration'
env:
# Job-local repo, shared with the verify step below (pinned in
# scripts/tests/sdk-java-workflow.test.js): the per-step lock is
# released at each step boundary, so the fixed 0.1.0-alpha release
# coordinates must not round-trip through the host-shared ~/.m2,
# where another run's same-coordinate jars would win the resolve.
# Job-local repo: the host-shared ~/.m2 can already hold another
# run's same-coordinate fixed release jars, so both Maven runs
# resolve from this job's seeded copy (pinned in
# scripts/tests/sdk-java-workflow.test.js).
MAVEN_ARGS: '--settings ${{ runner.temp }}/setup-java-m2/settings.xml --toolchains ${{ runner.temp }}/setup-java-m2/toolchains.xml -Dmaven.repo.local=${{ runner.temp }}/m2-repo'
MYSQL_PORT: "${{ job.services.mariadb.ports['3306'] }}"
run: |-
set -o pipefail
mkdir -p "${HOME}/.cache/qwen-code-ci"
# One acquisition spans both Maven runs: run 39353663670's verify
# step waited the full 90 minutes after the install step released
# the lock, so a per-step lock let this job lose its place in the
# host queue between installing and verifying.
exec 9>"${HOME}/.cache/qwen-code-ci/sdk-java-tests.lock"
if ! flock --wait 5400 9; then
echo "::error::sdk-java host lock not acquired within 90 minutes"
@@ -665,20 +670,7 @@ jobs:
# so it and the egress proxy keep paying off for the job-local copy.
cp -aln "${HOME}/.m2/repository" "${RUNNER_TEMP}/m2-repo" 2>/dev/null || true
mvn --batch-mode --no-transfer-progress -f packages/sdk-java/qwencode/pom.xml -DskipTests -Dgpg.skip=true -Dmaven.javadoc.skip=true install
- name: 'Run Managed Agent tests, Checkstyle, and MySQL integration'
working-directory: 'packages/managed-agent-server'
env:
MAVEN_ARGS: '--settings ${{ runner.temp }}/setup-java-m2/settings.xml --toolchains ${{ runner.temp }}/setup-java-m2/toolchains.xml -Dmaven.repo.local=${{ runner.temp }}/m2-repo'
MYSQL_PORT: "${{ job.services.mariadb.ports['3306'] }}"
run: |-
set -o pipefail
mkdir -p "${HOME}/.cache/qwen-code-ci"
exec 9>"${HOME}/.cache/qwen-code-ci/sdk-java-tests.lock"
if ! flock --wait 5400 9; then
echo "::error::sdk-java host lock not acquired within 90 minutes"
exit 1
fi
cd packages/managed-agent-server
mvn --batch-mode --no-transfer-progress -Pmysql-integration \
-Dmysql.url="jdbc:mysql://127.0.0.1:${MYSQL_PORT}/managed_agent_test?createDatabaseIfNotExist=true&allowPublicKeyRetrieval=true&useSSL=false" \
-Dmysql.user=root -Dmysql.password=runtime-broker clean verify checkstyle:check