Skip to content

Detect Build Scans published from agents when DurableTaskStep.USE_WATCHING is enabled - #867

Draft
jprinet wants to merge 1 commit into
jenkinsci:masterfrom
jprinet:fix-scan-detection-on-agents
Draft

jprinet wants to merge 1 commit into
jenkinsci:masterfrom
jprinet:fix-scan-detection-on-agents

Conversation

@jprinet

@jprinet jprinet commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

When DurableTaskStep.USE_WATCHING is enabled, sh/bat output is decorated on the agent. BuildScanDetectionTaskListenerDecoratorFactory holds the Run in a transient field, so after serialization to the agent it is null and Build Scans published from agent-side steps are never attached to the build. Only URLs printed from the controller (e.g. via echo) are detected.

Changes:

  • The decorator holds a serializable listener keyed by the run's externalizable id. When serialized over remoting it is exported, so the agent calls back into the controller, which resolves the Run and records the URL.
  • RunUtil.getOrCreateAction is synchronized on the actionable, since parallel branches can report their first Build Scan concurrently and one URL could be lost.
  • Tests for agent-side detection in default (polling) mode and with USE_WATCHING=true. The latter fails without the fix.

DevelocityExceptionTaskListenerDecoratorFactory likely has the same issue (see the @PendingFeature test in BuildScanInjectionGradleWithDurableTaskStepUseWatchingIntegrationTest); not addressed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant