-
Notifications
You must be signed in to change notification settings - Fork 7
/
azure_devops.go
38 lines (33 loc) · 1.07 KB
/
azure_devops.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"os"
"github.com/jonhadfield/githosts-utils"
"gitlab.com/tozd/go/errors"
)
func AzureDevOps(backupDir string) *ProviderBackupResults {
logger.Println("backing up Azure DevOps repos")
azureDevOpsHost, err := githosts.NewAzureDevOpsHost(githosts.NewAzureDevOpsHostInput{
Caller: appName,
HTTPClient: httpClient,
BackupDir: backupDir,
DiffRemoteMethod: os.Getenv(envAzureDevOpsCompare),
UserName: os.Getenv(envAzureDevOpsUserName),
PAT: os.Getenv(envAzureDevOpsPAT),
Orgs: getOrgsListFromEnvVar(envAzureDevOpsOrgs),
BackupsToRetain: getBackupsToRetain(envAzureDevOpsBackups),
LogLevel: getLogLevel(),
})
if err != nil {
return &ProviderBackupResults{
Provider: providerNameAzureDevOps,
Results: githosts.ProviderBackupResult{
BackupResults: []githosts.RepoBackupResults{},
Error: errors.Wrap(err, "failed to create AzureDevOps host"),
},
}
}
return &ProviderBackupResults{
Provider: providerNameAzureDevOps,
Results: azureDevOpsHost.Backup(),
}
}