digitalocean / digitalocean/doctl

registries repository delete-tag returns success for images that don't exist

Open
#1,790 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
3.4k
Forks
496
Avg merge
1d 2h
Merged PRs (30d)
31

Description

**Describe the Issue:**

Hi there, I'm seeing that `doctl registries repository delete-tag` always returns `Successfully deleted 1 tag(s)`, so long as the requested registry exists.

I have made the following requests, all with the same output:

Request delete on repository that doesn't exist:
```
> doctl registries repository delete-tag my-registry not-a-repository my-tag
Successfully deleted 1 tag(s)
```

Request delete on tag that doesn't exist:
```
> doctl registries repository delete-tag my-registry my-repository not-a-tag
Successfully deleted 1 tag(s)
```

The CLI does error when I request delete on a registry that doesn't exist:
```
> doctl registries repository delete-tag not-a-registry my-repository my-tag
{"errors":[{"detail":"DELETE https://api.digitalocean.com/v2/registries/not-a-registry/repositories/my-repository/tags/my-tag: 404 (request \"requestId\") registry does not exist"}]}
```

Could the CLI be modified to more closely resemble the [API definition](https://docs.digitalocean.com/reference/api/digitalocean/#tag/Container-Registry/operation/registry_delete_repositoryTag)? For example, it would be great if when delete is requested on a tag that doesn't exist, the CLI returned 404.

As an aside, I notice there are `doctl registry` and `doctl registries` commands. Is there one that I should prefer over the other? For example, for `delete-tag`, I see these two versions:
- https://docs.digitalocean.com/reference/doctl/reference/registry/repository/delete-tag/
- https://docs.digitalocean.com/reference/doctl/reference/registries/repository/delete-tag/

Of note, the `doctl registry` versions of the same commands simply return nothing in all of the following cases:
- requesting delete on a tag that doesn't exist
- requesting delete on a repository that doesn't exist
- requesting delete on a tag that does exist
- In this case, the tag is correctly deleted. But I don't get any feedback in the CLI that deletion was successful.

**Environment:**

- doctl version: 1.147.0-release
- OS: macOS Sequoia
- Installation method: installed with `brew`

**Additional Details:**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.