Restructure config for Azure DevOps scaffolder
This commit is contained in:
+1
-3
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user