Skip to content

Git Gateway support for BitBucket #20

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

Merged
merged 3 commits into from
Jul 20, 2018
Merged

Git Gateway support for BitBucket #20

merged 3 commits into from
Jul 20, 2018

Conversation

Benaiah
Copy link
Contributor

@Benaiah Benaiah commented Jul 19, 2018

- Summary

Adds BitBucket support to Git Gateway, including logic to refresh access tokens using a provided refresh token, OAuth client ID, and OAuth client secret.

This PR needs link rewriting added before it's merged. Link rewriting has been added.

- Test plan

Tested manually.

- Description for the changelog

Git gateway support for BitBucket

@Benaiah Benaiah changed the title (WIP) Git Gateway support for BitBucket Git Gateway support for BitBucket Jul 19, 2018
api/bitbucket.go Outdated
}

func rewriteLinksInBitBucketResponse(resp *http.Response, endpointAPIURL, proxyAPIURL string) error {
body, err := ioutil.ReadAll(resp.Body)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs to correctly handle gzipped content - it currently causes an error if you request gzipped content.

api/bitbucket.go Outdated
switch resp.Header.Get("Content-Encoding") {
case "gzip":
bodyReader, err = gzip.NewReader(resp.Body)
defer bodyReader.Close()
Copy link
Contributor

Choose a reason for hiding this comment

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

the defer probably needs to go after checking the error.

api/bitbucket.go Outdated
if err != nil {
return err
}
w.Close()
Copy link
Contributor

Choose a reason for hiding this comment

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

this should go after w := szip.NewWriter with a defer

api/bitbucket.go Outdated
}

newBody, err := json.Marshal(b)
println(newBody)
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this.

@Benaiah
Copy link
Contributor Author

Benaiah commented Jul 20, 2018

@calavera updated with requested changes.

Copy link
Contributor

@calavera calavera left a comment

Choose a reason for hiding this comment

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

LGTM

@calavera calavera merged commit 8180932 into master Jul 20, 2018
@calavera calavera deleted the bitbucket branch July 20, 2018 14:58
@amarpathak
Copy link

amarpathak commented Jan 27, 2020

So do we have git gateway support with bitbucket ?

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