-
Notifications
You must be signed in to change notification settings - Fork 0
feat: ✨ Implement azdo service-endpoint list command and some bug fixes
#135
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
Merged
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
Add UniqueByString and UniqueErrors helpers to deduplicate slices based on fmt.Stringer.String() and error.Error() respectively.
Add RemoteSet.MarshalLogArray and Remote.MarshalLogObject implementations to enable structured logging of git remote information via zap. The methods serialize remote entries and their fields (Name, Resolved, FetchURL, PushURL), safely handling nil URLs. This allows remotes to be included directly in zap logs as objects/arrays for better observability without changing existing behavior.
Introduce package-level error variables to represent common failure cases when resolving organizations: - ErrURLNotFoundForOrganization: failed to get URL for organization - ErrOrganizationNotFound: organization not found - ErrDefaultOrganizationNotSet: no default organization defined
Update auth_config to use errors.As when detecting KeyNotFoundError, add structured zap logging when retrieving organization URLs, and return specific sentinel errors for missing URL, missing default organization, and unknown organization.
Return a clear error when the repository has no configured remotes and wrap the specific organization-mapping error when remotes cannot be mapped to an organization. Also add debug logging of the resolved remotes. This prevents nil or confusing results from TranslateRemotes and provides better diagnostics for configuration issues.
Introduce concurrent checks per organization using goroutines and a sync.WaitGroup to improve responsiveness when verifying authentication status. Pre-parse configuration and organization URLs, validate that the configured URL matches the organization name, and propagate detailed errors for mismatches or API failures.
Capture error returned by TranslateRemotes and assert.NoError to ensure any unexpected errors cause the test to fail.
Add unit tests for OrganizationFromURL covering dev.azure.com https, visualstudio.com https, ssh URLs, invalid path, and non-AzDO URLs. Tests set AZDO_CONFIG_DIR to use test config and assert expected organization names and error messages.
Add OrganizationFromURL to extract an Azure DevOps organization from a validated URL. The helper supports dev.azure.com and visualstudio.com host styles and handles SSH/path variants. This simplifies organization extraction logic and centralizes validation/error handling.
Add logging and error aggregation when translating git remotes to AzDO remotes. Introduce a zap Array encoder helper for RemoteSet, import required packages, and change TranslateRemotes to return (RemoteSet, error). Collect and deduplicate errors from URL translation and Repository parsing, and return a joined error when no remotes were produced.
Add support for the Azure DevOps serviceendpoint client throughout the codebase. This includes: - expose ServiceEndpoint in the ClientFactory interface and implement it in internal/azdo/factory.go - import the serviceendpoint package in connection.go - update mocks to include ServiceEndpoint methods - update vendor to include the new modules
Add a new service-endpoint top-level command and implement a fully featured list subcommand for listing service connections within a project.
Replace linear slices.Contains lookup with a hashset for faster ID membership checks and preallocate the filtered slice to reduce allocations.
Clarify in help and reference docs that string flags like --auth-scheme, --endpoint-id, and --name accept multiple values either by repeating the flag or by separating values with a comma.
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.
Closes: #65