Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: GitHub downloader should do a GET and retry, trying to discover the correct URL #171

Merged
merged 4 commits into from
Nov 22, 2023

Conversation

disq
Copy link
Member

@disq disq commented Nov 22, 2023

GitHub now sometimes returns 302 on a HEAD
It seems to return 401 in tests. So we now do a GET and retry on 401/429.

Extracted from #170

@github-actions github-actions bot added fix and removed fix labels Nov 22, 2023
@erezrokah
Copy link
Member

erezrokah commented Nov 22, 2023

GitHub now sometimes returns 302 on a HEAD

Does 302 means it's a valid URL? Maybe we should treat it the same as StatusOK

Also can you give an example for a URL that returned 302 for a HEAD request?

@disq disq changed the title fix: GitHub downloader fix: GitHub downloader should retry certain status codes trying to discover the correct URL Nov 22, 2023
@github-actions github-actions bot added fix and removed fix labels Nov 22, 2023
// Check server response
if resp.StatusCode == http.StatusNotFound {
err := retry.Do(func() error {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, downloadURL, nil)
Copy link
Member Author

Choose a reason for hiding this comment

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

HEAD still returns 401 so it's GET now.

@disq disq changed the title fix: GitHub downloader should retry certain status codes trying to discover the correct URL fix: GitHub downloader should do a GET and retry, trying to discover the correct URL Nov 22, 2023
@github-actions github-actions bot added fix and removed fix labels Nov 22, 2023
@disq disq merged commit abb3bd7 into main Nov 22, 2023
11 checks passed
@disq disq deleted the fix/github-downloader branch November 22, 2023 10:13
kodiakhq bot pushed a commit that referenced this pull request Nov 22, 2023
🤖 I have created a release *beep* *boop*
---


## [1.14.1](v1.14.0...v1.14.1) (2023-11-22)


### Bug Fixes

* **deps:** Update module github.com/cloudquery/cloudquery-api-go to v1.4.6 ([#164](#164)) ([9d20b63](9d20b63))
* **deps:** Update module github.com/cloudquery/cloudquery-api-go to v1.5.0 ([#166](#166)) ([0a09610](0a09610))
* **deps:** Update module github.com/cloudquery/cloudquery-api-go to v1.5.1 ([#167](#167)) ([13802a1](13802a1))
* **deps:** Update module github.com/cloudquery/cloudquery-api-go to v1.6.0 ([#168](#168)) ([f382c2c](f382c2c))
* GitHub downloader should do a GET and retry, trying to discover the correct URL ([#171](#171)) ([abb3bd7](abb3bd7))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants