docker / hub-tool

🧪 Docker Hub experimental CLI tool
Apache License 2.0
330 stars 64 forks source link

Fixes #178 #203

Closed converge closed 2 years ago

converge commented 2 years ago

- What I did

Fix one of the bugs reported by https://github.com/docker/hub-tool/issues/178 and improve error handling for the repository deletion. The repository cannot be deleted if Docker Hub username is not provided.

how to reproduce the issue:

# 1
hub-tool repo rm test
# 2
the output is a successful message because the HTTP response is not validated.

- How I did it

  1. The fix includes the username to the repository deletion endpoint
  2. Adds new error handler for HTTP Not Found
  3. In case the repository doesn't exist, there is a proper error response: Error: resource not found
  4. Improves the error message, making it clear which repository was deleted
  5. Improve how URL is built before requesting the API

- How to verify it

The impacted changes can be tested via:

./hub-tool repo rm repository-name

- Description for the changelog

Allow repository deletion by using repository name only (without username) and add error handler for resource/repository not found.

p.s: this PR doesn't fix one of the reported errors:

Error: operation not permitted error

Since this is an ongoing discussion: https://github.com/docker/hub-tool/issues/172

- A picture of a cute animal (not mandatory)

silvin-lubecki commented 2 years ago

By the way @converge the linter is complaining 🦁 https://github.com/docker/hub-tool/runs/5968337414?check_suite_focus=true#step:5:11