Repository navigation
feat: Bitbucket Pipelines logs for --logs and get_failed_logs - #28
Conversation
The Bitbucket client now implements github.RunLogReader: for a failed build
status linking to a Pipelines result, it lists the pipeline's steps by build
number, downloads the log of the first failed step, and keeps the output of
the last script command ("+ <command>") up to the teardown. When there is no
log (no pipeline scope, or a timeout), the step's error message is shown
instead. Other CI systems are listed with their link, as before.
Also: github.Client gets GetText (raw GET, tail-limited, counted), and
GetJobLog now counts its request too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 802c2ab076
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| reason := step.State.Result.Error.Message // e.g. "Exceeded build time limit of 120 minutes." | ||
|
|
||
| logPath := fmt.Sprintf("%s/pipelines/%s/steps/%s/log", repoPath(workspace, repo), url.PathEscape(step.Pipeline.UUID), url.PathEscape(step.UUID)) |
There was a problem hiding this comment.
Use the known pipeline identifier when constructing the log URL
For a steps response matching the documented Bitbucket API schema, the step has its own uuid but no embedded pipeline.uuid. Consequently, step.Pipeline.UUID remains empty and this constructs /pipelines//steps/{step}/log, preventing log retrieval even with the correct token scope. The new fixture supplies an embedded pipeline that masks this case. Reuse the pipeline identifier used to list the steps, or explicitly retrieve its UUID, rather than requiring it in each step.
Useful? React with 👍 / 👎.
| end := len(lines) | ||
| for i := start; i < len(lines); i++ { | ||
| if teardownLine.MatchString(lines[i]) { | ||
| end = i |
There was a problem hiding this comment.
Exclude after-script output before selecting the failure excerpt
For steps with after-script, Bitbucket runs those commands even when the main script fails. This extraction only stops at test-report or artifact-scanning messages, so cleanup output remains in the excerpt and sufficiently verbose cleanup pushes the actual failure out of the last maxLines lines. When command matching falls back to any + line, it can instead select a cleanup command outright. Identify the after-script boundary before selecting the failed command and trimming its output so --logs and get_failed_logs retain the actual failure.
Useful? React with 👍 / 👎.
What
prw checks --logs,prw wait --logsand MCPget_failed_logsnow show, for each failed Bitbucket Pipelines build, the output of the script command that failed in its first failed step.GET /pipelines/{N}/steps/→ first FAILED/ERROR step →GET /pipelines/{pipeline}/steps/{step}/log(tail 4 MiB) → from the last+ <script command>line up to the teardown.github.Client.GetText(raw GET), andGetJobLognow counts toward the requests-per-hour figure.Test plan
go test -race ./...,go vet ./...FailedJobLogsprw checks --logson atlassian/atlassian-connect-express PR 552 shows the timeout reason of pipeline #2435🤖 Generated with Claude Code