Skip to content

Commit

Permalink
Fix AKS autogeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-c-martin committed Feb 6, 2024
1 parent 6c9d1df commit 5a89656
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/generate-single.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
required: true
default: 'main'
single_path:
description: 'The path to generate types for (e.g. "compute", or "keyvault").'
description: 'The path to generate types for (e.g. "compute/resource-manager", or "keyvault/resource-manager").'
required: true

jobs:
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
run: |
npm run generate-single -- \
--local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs" \
--base-path '${{ github.event.inputs.single_path }}/resource-manager'
--base-path '${{ github.event.inputs.single_path }}'
working-directory: generator

- name: Create Pull Request
Expand Down
19 changes: 13 additions & 6 deletions generator/autogenlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,16 @@ const disabledProviders: AutoGenConfig[] = [
disabledForAutogen: true
},
{
// Disabled temporally due to unsupported directory structure
basePath: 'containerservice/resource-manager',
basePath: 'containerservice/resource-manager/Microsoft.ContainerService/aks',
namespace: 'Microsoft.ContainerService',
disabledForAutogen: true,
useNamespaceFromConfig: true,
suffix: 'Aks'
},
{
basePath: 'containerservice/resource-manager/Microsoft.ContainerService/fleet',
namespace: 'Microsoft.ContainerService',
useNamespaceFromConfig: true,
suffix: 'Fleet'
},
];

Expand Down Expand Up @@ -1160,10 +1166,11 @@ export function findAutogenEntries(basePath: string): AutoGenConfig[] {
return autoGenList.filter(w => lowerCaseEquals(w.basePath, basePath));
}

export function findOrGenerateAutogenEntries(basePath: string, namespaces: string[]): AutoGenConfig[] {
const entries = findAutogenEntries(basePath).filter(e => namespaces.some(ns => lowerCaseEquals(e.namespace, ns)));
export function findOrGenerateAutogenEntries(basePath: string, detectedNamespaces: string[]): AutoGenConfig[] {
const entries = findAutogenEntries(basePath)
.filter(e => e.useNamespaceFromConfig || detectedNamespaces.some(ns => lowerCaseEquals(e.namespace, ns)));

for (const namespace of namespaces) {
for (const namespace of detectedNamespaces) {
if (!entries.some(e => lowerCaseEquals(e.namespace, namespace))) {
// Generate configuration for any RPs not explicitly declared in the autogen list
entries.push({
Expand Down
1 change: 1 addition & 0 deletions generator/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface AutoGenConfig {
disabledForAutogen?: true,
basePath: string,
namespace: string,
useNamespaceFromConfig?: boolean,
readmeFile?: string,
readmeTag?: ReadmeTag,
suffix?: string,
Expand Down

0 comments on commit 5a89656

Please sign in to comment.