-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Implement readTree for GitlabReader (#3547) #3673
Implement readTree for GitlabReader (#3547) #3673
Conversation
🦋 Changeset detectedLatest commit: d8e9b75 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
7994832
to
fcbb1a3
Compare
I think this looks like a good start! If you can get the tests fixed (mainly the call to getRequestOptions) i think we can merge this. |
fcbb1a3
to
c0048c6
Compare
Hi @hooloovooo, thank you for your comment and most of all apologies for the delay in pushing a fix! I have been away for a couple of days and did not get the chance to work on this. I went ahead and fixed the call to Let me know what you think! |
Hey @mateiidavid this needs a changeset :) |
* This change adds an implementation for the readTree method in GitlabReader. The implementation is similar to the readTree method in GithubReader with the exception of the 'path' variable used for subpaths in the archive. To facilitate this, GitlabIntegrationConfig now has an apiUrl field which was missing for Gitlab but was present for Bitbucket & GH. * As part of this change, there are also new tests added to GitlabReader to mirror what has been done with the GH reader. For now the archive format chosen is 'zip', follow-up action includes having a look at whether tar.gz is preferable. Signed-off-by: Matei David <madavid@expediagroup.com>
@benjdlambert ah thanks for bringing that up! First time contributing and I was unsure if a changeset is applicable here. I went ahead and created a changeset for both Lmk if I should amend anything :) will be super prompt about it. Thanks for your time! |
20f570d
to
4eafdec
Compare
Hey @mateiidavid perfect, one thing though. I think both of these changes can be |
That makes a lot of sense, should have probably clocked on to it @benjdlambert 😅. I have manually changed it to be a |
Hey, I just made a Pull Request!
✔️ Checklist
- [ ] Screenshots attached (for UI changes)What
Based on #3547 this PR adds an implementation for
readTree
inGitlabUrlReader
. As part of this change, I have also added a new field toGitlabIntegrationConfig
forapiUrl
-- the field was present in both Bitbucket and Github configurations, so I thought it would make sense as part of this change to add it in Gitlab too.The changes are quite straightforward, other than providing the implementation in the reader and touching the config, I have added in tests (with the same scenarios found in GH/Bitbucket readers) and made some smaller changes in the class, such as adding the TreeResponseFactory as a private field.
How
The implementation is similar to the one in the Github reader (and Bitbucket reader branch suggested in Implement readTree on GitlabUrlReader #3547). The main distinctions are around the url for the archive and the archive format. From what I have noticed, Gitlab download urls (regardless of whether it is hosted) follow the same pattern:
<protocol>://<host>/<org>/<repo>/-/archive/<branch-ref>/<repo>-<branch-ref>.<zip-fmt>
.When it comes to the format of the archive I have chosen to go with
.zip
. I'm not sure what the general consensus around this is; the Bitbucket example used zip and GH unpacks tarballs. I have added in aTODO
to keep track of this -- I can remove it or make the change directly based on feedback received.The final difference is in the path, Gitlab archives are named as
repo-branch
and contain the project tree, contrastingly, Github archives are named after a branch and have another directory inside with the repo name and the branch. Thought I'd put this in so it makes more sense when looking at the tests and the path.Let me know of any feedback in terms of implementation details and code style. :)
I am also unsure if this should contain a
changeset
would appreciate any info related to it.Signed-off-by: Matei David madavid@expediagroup.com