Skip to content

Commit

Permalink
Add hosting service definition for Azure DevOps Server
Browse files Browse the repository at this point in the history
  • Loading branch information
chuseman committed Nov 26, 2024
1 parent c3cf48c commit cece62c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions pkg/commands/hosting_service/definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<collection>.*)/(?P<project>.*)/(?P<repo>.*?)(?:\.git)?$`,
`^(?P<scheme>https?)://.*/(?P<collection>.*?)/(?P<project>.*?)/_git/(?P<repo>.*?)(?:\.git)?$`,
},
repoURLTemplate: "{{.scheme}}://{{.webDomain}}/{{.collection}}/{{.project}}/_git/{{.repo}}",
}

var bitbucketServerServiceDef = ServiceDefinition{
provider: "bitbucketServer",
pullRequestURLIntoDefaultBranch: "/pull-requests?create&sourceBranch={{.From}}",
Expand All @@ -78,6 +90,7 @@ var serviceDefinitions = []ServiceDefinition{
bitbucketServiceDef,
gitLabServiceDef,
azdoServiceDef,
azdoServerServiceDef,
bitbucketServerServiceDef,
giteaServiceDef,
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/hosting_service/hosting_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit cece62c

Please sign in to comment.