diff --git a/docs/Config.md b/docs/Config.md index d63987f065f..c127b0239ee 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -879,7 +879,7 @@ services: Where: - `gitDomain` stands for the domain used by git itself (i.e. the one present on clone URLs), e.g. `git.work.com` -- `provider` is one of `github`, `bitbucket`, `bitbucketServer`, `azuredevops`, `gitlab` or `gitea` +- `provider` is one of `github`, `bitbucket`, `bitbucketServer`, `azuredevops`, `azuredevopsServer`, `gitlab` or `gitea` - `webDomain` is the URL where your git service exposes a web interface and APIs, e.g. `gitservice.work.com` ## Predefined commit message prefix diff --git a/pkg/commands/hosting_service/definitions.go b/pkg/commands/hosting_service/definitions.go index ff872cd8c05..ba2737149f2 100644 --- a/pkg/commands/hosting_service/definitions.go +++ b/pkg/commands/hosting_service/definitions.go @@ -52,6 +52,18 @@ var azdoServiceDef = ServiceDefinition{ repoURLTemplate: "https://{{.webDomain}}/{{.org}}/{{.project}}/_git/{{.repo}}", } +var azdoServerServiceDef = ServiceDefinition{ + provider: "azuredevopsServer", + pullRequestURLIntoDefaultBranch: "/pullrequestcreate?sourceRef={{.From}}", + pullRequestURLIntoTargetBranch: "/pullrequestcreate?sourceRef={{.From}}&targetRef={{.To}}", + commitURL: "/commit/{{.CommitHash}}", + regexStrings: []string{ + `^git@.*/(?P.*)/(?P.*)/(?P.*?)(?:\.git)?$`, + `^(?Phttps?)://.*/(?P.*?)/(?P.*?)/_git/(?P.*?)(?:\.git)?$`, + }, + repoURLTemplate: "{{.scheme}}://{{.webDomain}}/{{.collection}}/{{.project}}/_git/{{.repo}}", +} + var bitbucketServerServiceDef = ServiceDefinition{ provider: "bitbucketServer", pullRequestURLIntoDefaultBranch: "/pull-requests?create&sourceBranch={{.From}}", @@ -78,6 +90,7 @@ var serviceDefinitions = []ServiceDefinition{ bitbucketServiceDef, gitLabServiceDef, azdoServiceDef, + azdoServerServiceDef, bitbucketServerServiceDef, giteaServiceDef, } diff --git a/pkg/commands/hosting_service/hosting_service_test.go b/pkg/commands/hosting_service/hosting_service_test.go index 4ce847bf76c..a3f32dd2440 100644 --- a/pkg/commands/hosting_service/hosting_service_test.go +++ b/pkg/commands/hosting_service/hosting_service_test.go @@ -388,7 +388,7 @@ func TestGetPullRequestURL(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature%2Fprofile-page&t=1", url) }, - expectedLoggedErrors: []string{"Unknown git service type: 'noservice'. Expected one of github, bitbucket, gitlab, azuredevops, bitbucketServer, gitea"}, + expectedLoggedErrors: []string{"Unknown git service type: 'noservice'. Expected one of github, bitbucket, gitlab, azuredevops, azuredevopsServer, bitbucketServer, gitea"}, }, { testName: "Escapes reserved URL characters in from branch name",