Restructure config for Azure DevOps scaffolder

This commit is contained in:
Mattias Frinnström
2020-09-23 08:13:40 +00:00
parent 56a9f8389b
commit 0f732731ef
3 changed files with 10 additions and 14 deletions
+1 -3
View File
@@ -133,10 +133,8 @@ scaffolder:
$secret:
env: GITLAB_ACCESS_TOKEN
azure:
baseUrl: https://dev.azure.com/{your-organization}
api:
organization:
$secret:
env: AZURE_ORGANIZATION
token:
$secret:
env: AZURE_PRIVATE_TOKEN
@@ -246,17 +246,16 @@ scaffolder:
#### Azure DevOps
For Azure DevOps we support both the preparer and publisher stage with the
configuration of a private access token (PAT) when needed. For the publisher
it's also required to define the organization that you want to create the
repository in.
configuration of a private access token (PAT). For the publisher it's also
required to define the base URL for the client to connect to the service. This
will hopefully support on-prem installations as well but that has not been
verified.
```yaml
scaffolder:
azure:
baseUrl: https://dev.azure.com/{your-organization}
api:
organization:
$secret:
env: AZURE_ORGANIZATION
token:
$secret:
env: AZURE_PRIVATE_TOKEN
+4 -5
View File
@@ -116,15 +116,14 @@ export default async function createPlugin({
}
}
const azureConfig = config.getOptionalConfig('scaffolder.azure.api');
const azureConfig = config.getOptionalConfig('scaffolder.azure');
if (azureConfig) {
try {
const organization = azureConfig.getString('organization');
const azureToken = azureConfig.getString('token');
const baseUrl = azureConfig.getString('baseUrl');
const azureToken = azureConfig.getConfig('api').getString('token');
const serverUrl = `https://dev.azure.com/${organization}`;
const authHandler = getPersonalAccessTokenHandler(azureToken);
const webApi = new WebApi(serverUrl, authHandler);
const webApi = new WebApi(baseUrl, authHandler);
const azureClient = await webApi.getGitApi();
const azurePublisher = new AzurePublisher(azureClient, azureToken);