ShivamSharma43 opened a new pull request, #9403:
URL: https://github.com/apache/devlake/pull/9403

   ### Summary
   
   The Bamboo `convertDeployBuildsToDeploymentCommits` subtask parses the 
connection endpoint once for every deploy build. If the parse fails, it calls 
`log.Fatal`:
   
   ```go
   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](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to