fix(registry): use RepositoryV2 displayer for list-v2 commands (#1797 / #1799) - #1925
Open
Kanika0306 wants to merge 3 commits into
Open
fix(registry): use RepositoryV2 displayer for list-v2 commands (#1797 / #1799)#1925Kanika0306 wants to merge 3 commits into
Kanika0306 wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1797 and #1799.
The
doctl registry repository list-v2anddoctl registries repository list-v2commands were registered usingdisplayerType(&displayers.Repository{})(the V1 displayer) instead ofdisplayerType(&displayers.RepositoryV2{}).As a result:
--formatflag validation and help strings forlist-v2only recognized V1 columns (Name,LatestTag,TagCount,UpdatedAt) and rejected V2-specific columns likeManifestCountorLatestManifest.--format Name,ManifestCount,UpdatedAt) failed column validation.Additionally,
overrideCmdNS(overrideNS)needed to be passed duringCmdBuilderinitialization so option execution correctly binds--formatflags under the command's config namespace.Changes Made
commands/registry.go:cmdListRepositoriesV2in bothdoctl registry repository list-v2anddoctl registries repository list-v2namespaces to usedisplayerType(&displayers.RepositoryV2{})andoverrideCmdNS(overrideNS).commands/displayers/registry.go:var _ Displayable = &RepositoryV2{}.commands/registry_test.go:fmtColsmatchesRepositoryV2{}.Cols().--formatoptions with V2 fields (Name,ManifestCount,LatestManifest,TagCount,LatestTag,UpdatedAt) across bothregistryandregistriesnamespaces.integration/registry_repo_list_v2_test.go&integration/registries_list_repositories_test.go:list-v2 --format Name,ManifestCount,UpdatedAt.integration/database_firewall_*.go:Descriptioncolumn output.Verification
Ran unit tests and integration tests: