Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Friendlier error message on update repo #903

Merged
merged 7 commits into from
Apr 9, 2021
Merged

Friendlier error message on update repo #903

merged 7 commits into from
Apr 9, 2021

Conversation

fernandobelettizup
Copy link
Contributor

@fernandobelettizup fernandobelettizup commented Apr 8, 2021

Description

This pull request improves the error message when update repo breaks in case of repositories changing visibility or being deleted.

New error messages follows:
Error: could not retrieve new versions for selected repository
Please check if it still exists or changed visiblity
Try adding it again using:
rit add repo

image

Additionaly I'm adding @fernandobelettizup to code owners and contributors list.

How to verify it

Steps:

  1. Clone this PR;
  2. Build rit;
  3. Using rit add repo add a public formula repository;
  4. Delete or change its visibility;
  5. Try updating it with rit update repo

Changelog

Friendlier error message on update repo

Signed-off-by: fernandobelettizup <fernando.beletti@zup.com.br>
Signed-off-by: fernandobelettizup <fernando.beletti@zup.com.br>
Signed-off-by: fernandobelettizup <fernando.beletti@zup.com.br>
@fernandobelettizup fernandobelettizup added ✔️ ready-for-review ready for review and removed 🚧 WIP Work in Progress labels Apr 8, 2021
pkg/git/bitbucket/repository.go Outdated Show resolved Hide resolved
Signed-off-by: fernandobelettizup <fernando.beletti@zup.com.br>
Copy link
Contributor

@GuillaumeFalourd GuillaumeFalourd left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏼
Well done! 🚀

@GuillaumeFalourd GuillaumeFalourd self-requested a review April 8, 2021 18:57
Copy link
Contributor

@henriquemoraeszup henriquemoraeszup left a comment

Choose a reason for hiding this comment

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

Missing the tests for this case, you will have to simulate a 404 error

pkg/git/gitlab/repository.go Outdated Show resolved Hide resolved
@brunasilvazup brunasilvazup added waiting reply Waiting for an answer to a comment and removed ✔️ ready-for-review ready for review labels Apr 8, 2021
@fernandobelettizup fernandobelettizup added the 🚧 WIP Work in Progress label Apr 8, 2021
Signed-off-by: fernandobelettizup <fernando.beletti@zup.com.br>
@fernandobelettizup
Copy link
Contributor Author

Missing the tests for this case, you will have to simulate a 404 error

Added 404 error tests for each repo provider.
In addition, a 403 error test was added to Bitbucket repository tests file.
That being, because Github and Gitlab API returns a 404 error if the repo gets deleted or changed visibility, but when it comes to Bitbucket you can also get a 403 error if the repo became private.

@fernandobelettizup fernandobelettizup added the ❓ question Further information is requested label Apr 8, 2021
Signed-off-by: fernandobelettizup <fernando.beletti@zup.com.br>
@fernandobelettizup fernandobelettizup added ✔️ ready-for-review ready for review and removed 🚧 WIP Work in Progress ❓ question Further information is requested waiting reply Waiting for an answer to a comment labels Apr 9, 2021
Signed-off-by: fernandobelettizup <fernando.beletti@zup.com.br>
Copy link
Contributor

@henriquemoraeszup henriquemoraeszup left a comment

Choose a reason for hiding this comment

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

Nice job! 👏

@fernandobelettizup fernandobelettizup merged commit e669ace into ZupIT:master Apr 9, 2021
@henriquemoraeszup
Copy link
Contributor

@lucasdittrichzup this has been merged, but should still be tested in QA

maurineimirandazup pushed a commit to maurineimirandazup/ritchie-cli that referenced this pull request Apr 19, 2021
* Changing error message when repository version cannot be retrieved

Signed-off-by: fernandobelettizup <fernando.beletti@zup.com.br>

* added not found status for bitbucket repos

Signed-off-by: fernandobelettizup <fernando.beletti@zup.com.br>

* adding @fernandobelettizup to code owners list

Signed-off-by: fernandobelettizup <fernando.beletti@zup.com.br>

* moved error message to git package

Signed-off-by: fernandobelettizup <fernando.beletti@zup.com.br>

* added tests simulating 404 errors for each provider

Signed-off-by: fernandobelettizup <fernando.beletti@zup.com.br>

* extracted status code check to a single function

Signed-off-by: fernandobelettizup <fernando.beletti@zup.com.br>

* changes made to CODEOWNERS

Signed-off-by: fernandobelettizup <fernando.beletti@zup.com.br>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 improvement Improvement in features ✔️ ready-for-review ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Friendlier error message on update repo
5 participants