Skip to content

fix(bamboo): return an error instead of log.Fatal on a bad endpoint - #9403

Merged
klesh merged 1 commit into
apache:mainfrom
ShivamSharma43:fix/bamboo-endpoint-parse-error
Nov 19, 2026
Merged

klesh merged 1 commit into
apache:mainfrom
ShivamSharma43:fix/bamboo-endpoint-parse-error

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Summary

The Bamboo convertDeployBuildsToDeploymentCommits subtask parses the connection endpoint once for every deploy build. If the parse fails, it calls log.Fatal:

u, err := url.Parse(data.ApiClient.GetEndpoint())
if err != nil {
	log.Fatal(err)
}

log.Fatal calls os.Exit(1). A connection endpoint that url.Parse rejects, for example a non-numeric port (http://bamboo.example.com:port/rest/api/latest/), doesn't just fail this subtask. It kills the whole DevLake server process, with every other pipeline running in it, and no error is recorded for the task.

Changes:

  • tasks/deploy_build_to_deployment_commit_convertor.go: the endpoint is parsed once, before the query, and a parse error is returned as the subtask error (failed to parse the Bamboo endpoint). The base URL is then reused for each row, so the endpoint isn't re-parsed per build. The log import goes away. The generated deployment URLs don't change.
  • tasks/deploy_build_to_deployment_commit_convertor_test.go (new): runs the subtask with an endpoint that has an invalid port and checks that it returns that error without querying the database. With the old code the subtask queries the database before it looks at the endpoint, so the test fails (mock: I don't know what to return because the method call was unexpected). In a real run it would reach log.Fatal on the first row.

The e2e snapshots don't change.

Does this close any open issues?

No issue is open for this. The bug is described above.

Screenshots

N/A

Other Information

  • go test ./plugins/bamboo/tasks/: pass. The bamboo e2e tests need E2E_DB_URL, which I didn't run locally. Their output can't change, because the base URL is built the same way as before.
  • go vet ./plugins/bamboo/... and gofmt: clean.
  • No open PR touches the bamboo plugin.
  • Suggested label: pr-type/bug-fix.
  • AI assistance disclosure: I prepared this change with Claude Code (Claude Opus 5.5), reviewed the diff and ran the tests. The commit has a Generated-by: trailer, following the ASF generative tooling guidance.

🤖 Generated with Claude Code

ConvertDeployBuildsToDeploymentCommits parsed the connection endpoint
for every deploy build and called log.Fatal if it failed, so an
endpoint that url.Parse rejects (e.g. a non-numeric port) exited the
whole DevLake process instead of failing the subtask.

Parse the endpoint once before the query, return the parse error, and
add a unit test for it.

Generated-by: Claude Code (Claude Opus 5.5)

Signed-off-by: Shivam Sharma <192242476+ShivamSharma43@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 17, 2026 05:51

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@klesh
klesh merged commit 52ce3cd into apache:main Nov 19, 2026
10 checks passed
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.

3 participants