Skip to content

fix(runners): build Azure Pipelines run link from the collection URI - #3847

Merged
migmartri merged 2 commits into
mainfrom
fix/azure-pipeline-run-link
Nov 23, 2026
Merged

migmartri merged 2 commits into
mainfrom
fix/azure-pipeline-run-link

Conversation

@migmartri

@migmartri migmartri commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

The Azure Pipelines runner now builds the run link from SYSTEM_TEAMFOUNDATIONCOLLECTIONURI and falls back to SYSTEM_TEAMFOUNDATIONSERVERURI. On Azure DevOps Server (self-hosted), the server URI has no collection segment, so the run link we recorded did not open the run. On Azure DevOps Services both variables have the same value, so links there do not change.

The runner now also:

  • returns an empty link when the base URI, the project, or the build ID is missing, instead of a broken relative URL
  • escapes the project name in the path
  • adds the job logs deep link (view=logs&j=...) only when SYSTEM_JOBID is set

The control plane records this link as the job and runner URL of the workflow run.

Fixes #3845

AI disclosure: this change was written with the help of Claude Code.

🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri

View guided diff

Use SYSTEM_TEAMFOUNDATIONCOLLECTIONURI, falling back to
SYSTEM_TEAMFOUNDATIONSERVERURI, so the run link also works on Azure
DevOps Server, where the server URI has no collection segment. Return
an empty link when the base URI, project or build ID is missing, and
only add the job logs deep link when SYSTEM_JOBID is set.

Fixes #3845

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 349d093c-9e39-4126-b6b2-b2b6e878ba09
@migmartri migmartri self-assigned this Nov 23, 2026
@chainloop-platform

chainloop-platform Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

PR validation — ✅ 3 passing

Status Policy Material Messages
✅ Passed pr-min-approvals pr-info -
✅ Passed pr-description-required pr-info -
✅ Passed pr-user-story-linked pr-info -

View attestation ↗

AI Session Checks — 🟢 89% · ✅ 0 failing

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟢 89% 1 ✅ 0 100% AI / 0% Human 2 +137 / -19 16m14s

🟢 89% — 100% AI — ✅ All policies passing

Nov 23, 2026 11:06 UTC · 16m14s · $6.55 · 214 in / 85.3k out · claude-code 2.1.330 (claude-opus-5-5)

View session details ↗

Change Summary

Prefers the collection URI with server fallback and returns empty links for missing required variables. Escapes project names, includes job logs conditionally, and adds regression cases for hosted and self-hosted runs.

AI Session Overall Score

🟢 89% — Focused runner fix with passing regressions; user confirmation of the link remains outstanding.

AI Session Analysis Breakdown

🟢 96% · scope-discipline

No notes.

🟢 95% · solution-quality

🟢 Early validation and structured path/query construction address broken links at their source. · High Impact

🟢 93% · context-and-planning

No notes.

🟢 91% · user-trust-signal

No notes.

🟢 88% · alignment

🟢 Reported collection precedence, fallback, missing-variable guards, and conditional job links match the resulting runner. · High Impact

🟡 79% · verification

🟢 Named runner regressions pass for Services, Server collections, escaped spaces, and missing variables. · High Impact

🟠 The active user never confirms the generated link opens the intended run. · Medium Severity

💡 Confirm the generated link opens the intended run before accepting the change.


File Attribution

████████████████████ 100% AI / 0% Human

Status Attribution File Lines
modified ai pkg/attestation/crafter/runners/azurepipeline_test.go +100 / -4
modified ai pkg/attestation/crafter/runners/azurepipeline.go +37 / -15

Policies (4)

Status Policy Material Messages
✅ Passed ai-config-ai-agents-allowed ai-coding-session-349d09 -
✅ Passed ai-config-no-dangerous-commands ai-coding-session-349d09 -
✅ Passed ai-config-no-secrets ai-coding-session-349d09 -
✅ Passed ai-config-mcp-servers-allowed ai-coding-session-349d09 -

Security Checks — ✅ 6 passing

✅ AI Security Analysis

Nothing this change touches re-opens a recorded security fix.

View in Chainloop ↗ · How this works ↗

✅ secret-scan

Status Policy Messages
✅ Passed secrets-detection -

✅ sast-scan

Status Policy Messages
✅ Passed owasp-top10-2025 -
✅ Passed sast -
✅ Passed cwe-top25 -
✅ Passed cwe-top26-40-cusp -
Scans not applied (3)
Scan Reason
vulnerability-scan no manifest/lockfile changed
github-actions-scan no workflow files changed
iac-scan no IaC files changed

View attestation ↗


Powered by Chainloop and Chainloop Trace

@migmartri
migmartri requested a review from a team November 23, 2026 11:15

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="pkg/attestation/crafter/runners/azurepipeline.go">

<violation number="1" location="pkg/attestation/crafter/runners/azurepipeline.go:103">
P2: `JoinPath` requires escaped path elements, but this passes the raw project name. A project containing `%` can make `JoinPath` silently retain the base path and produce a link without the project or results route; pass `url.PathEscape(project)` here.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

URL.JoinPath expects escaped elements and silently keeps the base path
when an element does not unescape, so a project name with a percent
sign dropped the project and results route from the run link.

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 349d093c-9e39-4126-b6b2-b2b6e878ba09
@migmartri
migmartri merged commit 6aebbb8 into main Nov 23, 2026
21 of 22 checks passed
@migmartri
migmartri deleted the fix/azure-pipeline-run-link branch November 23, 2026 15:11
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.

Azure Pipelines: record a usable link to the pipeline run

2 participants