From 0a0cba857391adbc527edd194c7833a61cdb2910 Mon Sep 17 00:00:00 2001 From: Diego Caspi Date: Wed, 18 Dec 2024 21:50:18 +0100 Subject: [PATCH] chore: ci errors solved Signed-off-by: Diego Caspi --- internal/directives/zz_config_types.go | 13 +++++++------ internal/gitprovider/azure/azure.go | 12 ++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/internal/directives/zz_config_types.go b/internal/directives/zz_config_types.go index 5ffe2e456..d97c0a2eb 100644 --- a/internal/directives/zz_config_types.go +++ b/internal/directives/zz_config_types.go @@ -187,8 +187,8 @@ type GitOpenPRConfig struct { CreateTargetBranch bool `json:"createTargetBranch,omitempty"` // Indicates whether to skip TLS verification when cloning the repository. Default is false. InsecureSkipTLSVerify bool `json:"insecureSkipTLSVerify,omitempty"` - // The name of the Git provider to use. Currently only 'github' and 'gitlab' are supported. - // Kargo will try to infer the provider if it is not explicitly specified. + // The name of the Git provider to use. Currently only 'github', 'gitlab' and 'azure' are + // supported. Kargo will try to infer the provider if it is not explicitly specified. Provider *Provider `json:"provider,omitempty"` // The URL of a remote Git repository to clone. RepoURL string `json:"repoURL"` @@ -232,8 +232,8 @@ type GitWaitForPRConfig struct { // This field references the 'prNumber' output from a previous step and uses it as the // number of the pull request to wait for. PRNumberFromStep string `json:"prNumberFromStep,omitempty"` - // The name of the Git provider to use. Currently only 'github' and 'gitlab' are supported. - // Kargo will try to infer the provider if it is not explicitly specified. + // The name of the Git provider to use. Currently only 'github', 'gitlab' and 'azure' are + // supported. Kargo will try to infer the provider if it is not explicitly specified. Provider *Provider `json:"provider,omitempty"` // The URL of a remote Git repository to clone. RepoURL string `json:"repoURL"` @@ -434,11 +434,12 @@ const ( Warehouse Kind = "Warehouse" ) -// The name of the Git provider to use. Currently only 'github' and 'gitlab' are supported. -// Kargo will try to infer the provider if it is not explicitly specified. +// The name of the Git provider to use. Currently only 'github', 'gitlab' and 'azure' are +// supported. Kargo will try to infer the provider if it is not explicitly specified. type Provider string const ( + Azure Provider = "azure" Github Provider = "github" Gitlab Provider = "gitlab" ) diff --git a/internal/gitprovider/azure/azure.go b/internal/gitprovider/azure/azure.go index 22d1f1410..dcf97bad5 100644 --- a/internal/gitprovider/azure/azure.go +++ b/internal/gitprovider/azure/azure.go @@ -6,12 +6,12 @@ import ( "net/url" "strings" - "github.com/akuity/kargo/internal/git" - "github.com/akuity/kargo/internal/gitprovider" - "k8s.io/utils/ptr" - "github.com/microsoft/azure-devops-go-api/azuredevops/v7" adogit "github.com/microsoft/azure-devops-go-api/azuredevops/v7/git" + "k8s.io/utils/ptr" + + "github.com/akuity/kargo/internal/git" + "github.com/akuity/kargo/internal/gitprovider" ) const ProviderName = "azure" @@ -214,7 +214,7 @@ func parseRepoURL(repoURL string) (string, string, string, error) { return "", "", "", fmt.Errorf("unsupported host %q", u.Host) } -// parseModernRepoURL parses a modern Azure DevOps repository URL. example: https://dev.azure.com/org/project/_git/repo +// parseModernRepoURL parses a modern Azure DevOps repository URL. func parseModernRepoURL(u *url.URL) (string, string, string, error) { parts := strings.Split(u.Path, "/") if len(parts) != 5 { @@ -223,7 +223,7 @@ func parseModernRepoURL(u *url.URL) (string, string, string, error) { return parts[1], parts[2], parts[4], nil } -// parseLegacyRepoURL parses a legacy Azure DevOps repository URL. example: https://org.visualstudio.com/project/_git/repo +// parseLegacyRepoURL parses a legacy Azure DevOps repository URL. func parseLegacyRepoURL(u *url.URL) (string, string, string, error) { organization := strings.TrimSuffix(u.Host, ".visualstudio.com") parts := strings.Split(u.Path, "/")