Skip to content

fix(azuredevops): handle 204 No Content in collectApiTimelineRecords timeline response#8958

Open
bujjibabukatta wants to merge 1 commit into
apache:mainfrom
bujjibabukatta:fix/#8944
Open

fix(azuredevops): handle 204 No Content in collectApiTimelineRecords timeline response#8958
bujjibabukatta wants to merge 1 commit into
apache:mainfrom
bujjibabukatta:fix/#8944

Conversation

@bujjibabukatta

Copy link
Copy Markdown
Contributor

Summary

Fixes the collectApiTimelineRecords subtask failing when the Azure DevOps
Timeline API returns 204 No Content for deleted or empty builds.

Root Cause

ignoreInvalidTimelineResponse() only guarded against 404 Not Found.
When a 204 No Content response was received, execution fell through to
io.ReadAll(res.Body) on an empty body. While the downstream empty-body
check would eventually skip the record, reading the body of a 204 response
before checking the status code is unsafe — some HTTP clients/proxies set
Body = nil on 204, which causes a nil-pointer panic.

Fix

Added an explicit http.StatusNoContent guard alongside the existing
http.StatusNotFound check, before the body is ever read.

Changes

  • tasks/shared.go — extend the status guard in ignoreInvalidTimelineResponse
    to include 204 No Content
  • tasks/shared_test.go — add TestIgnoreInvalidTimelineResponse_204 to
    cover the new guard

Testing

All existing tests continue to pass. New test TestIgnoreInvalidTimelineResponse_204
verifies that a 204 response returns api.ErrIgnoreAndContinue without
reading the body.

Related

Closes #8944

@bujjibabukatta

Copy link
Copy Markdown
Contributor Author

Hi @klesh could you please review and approve pull request?

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.

[Bug][AzureDevOps_GO plugin] collectApiTimelineRecords subtask doesn't treat 204 No Content as graceful skip for Timeline API

1 participant