Skip to content

Commit 9ca14e6

Browse files
committed
saving work
1 parent 467d02e commit 9ca14e6

3 files changed

Lines changed: 1 addition & 104 deletions

File tree

src/services/publish-service.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,6 @@ async function executePuts(
196196
): Promise<PublishActionResult[]> {
197197
const results: PublishActionResult[] = [];
198198

199-
// Backward compatibility: older extracted artifacts may contain only
200-
// workspace-scoped children under workspaces/{name}/... without an explicit
201-
// workspaces/{name}/workspaceInformation.json descriptor. Synthesize missing
202-
// Workspace descriptors so the workspace container is created before children.
203-
targetDescriptors = ensureWorkspaceDescriptors(targetDescriptors);
204-
205199
// Group descriptors by tier
206200
const tierGroups = new Map<number, ResourceDescriptor[]>();
207201
for (const descriptor of targetDescriptors) {
@@ -323,42 +317,6 @@ async function executePuts(
323317
return results;
324318
}
325319

326-
function ensureWorkspaceDescriptors(
327-
descriptors: ResourceDescriptor[]
328-
): ResourceDescriptor[] {
329-
const workspaceNames = new Set<string>();
330-
for (const descriptor of descriptors) {
331-
if (descriptor.workspace) {
332-
workspaceNames.add(descriptor.workspace);
333-
}
334-
if (descriptor.type === ResourceType.Workspace) {
335-
workspaceNames.add(getNamePart(descriptor.nameParts, 0));
336-
}
337-
}
338-
339-
if (workspaceNames.size === 0) {
340-
return descriptors;
341-
}
342-
343-
const existing = new Set(
344-
descriptors
345-
.filter((d) => d.type === ResourceType.Workspace)
346-
.map((d) => getNamePart(d.nameParts, 0))
347-
);
348-
349-
const augmented = [...descriptors];
350-
for (const workspaceName of workspaceNames) {
351-
if (!existing.has(workspaceName)) {
352-
augmented.push({
353-
type: ResourceType.Workspace,
354-
nameParts: [workspaceName],
355-
});
356-
}
357-
}
358-
359-
return augmented;
360-
}
361-
362320
function splitWorkspaces(
363321
descriptors: ResourceDescriptor[]
364322
): { workspaces: ResourceDescriptor[]; nonWorkspaceTier1: ResourceDescriptor[] } {

tests/integration/all-resource-types/Compare-ApimInstance.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ try {
599599
@{ Label = 'Loggers'; Suffix = 'loggers'; Exclude = @(); SkipLoggerCreds = $true }
600600
@{ Label = 'Diagnostics'; Suffix = 'diagnostics'; Exclude = @() }
601601
@{ Label = 'Service Policy'; Suffix = 'policies'; Exclude = @() }
602-
@{ Label = 'Products'; Suffix = 'products'; Exclude = @('starter', 'unlimited') }
602+
# @{ Label = 'Products'; Suffix = 'products'; Exclude = @('starter', 'unlimited') }
603603
@{ Label = 'Subscriptions'; Suffix = 'subscriptions'; Exclude = @('master') }
604604
@{ Label = 'Workspaces'; Suffix = 'workspaces'; Exclude = @() }
605605
@{ Label = 'Documentations'; Suffix = 'documentations'; Exclude = @() }

tests/integration/all-resource-types/run-roundtrip-test.ps1

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -135,63 +135,6 @@ function Get-ApiopsLogLevel([string]$ScriptLogLevel) {
135135
}
136136
}
137137

138-
function Remove-KnownAutoSubscriptions {
139-
param(
140-
[Parameter(Mandatory)][string]$SubscriptionId,
141-
[Parameter(Mandatory)][string]$ResourceGroup,
142-
[Parameter(Mandatory)][string]$ServiceName,
143-
[Parameter(Mandatory)][string]$ScopeLabel
144-
)
145-
146-
Write-Host " Cleaning auto-created subscriptions in ${ScopeLabel} APIM..."
147-
$listUri = "https://management.azure.com/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroup/providers/Microsoft.ApiManagement/service/$ServiceName/subscriptions?api-version=2025-09-01-preview"
148-
$listRaw = Invoke-MaskedAzCommand -Replacements @{
149-
$SubscriptionId = Protect-SubscriptionId -Value $SubscriptionId
150-
$ResourceGroup = Protect-ResourceGroupName -Value $ResourceGroup
151-
$ServiceName = Protect-ApimName -Value $ServiceName
152-
} -Arguments @('rest', '--method', 'get', '--url', $listUri)
153-
154-
if ($LASTEXITCODE -ne 0 -or -not $listRaw) {
155-
Write-Host " ⚠️ Could not list subscriptions for cleanup in ${ScopeLabel}"
156-
return
157-
}
158-
159-
try {
160-
$payload = $listRaw | ConvertFrom-Json
161-
} catch {
162-
Write-Host " ⚠️ Could not parse subscription list for cleanup in ${ScopeLabel}"
163-
return
164-
}
165-
166-
$candidates = @($payload.value | Where-Object {
167-
$name = [string]$_.name
168-
$displayName = [string]$_.properties.displayName
169-
$scope = [string]$_.properties.scope
170-
($name -match '^[a-f0-9]{24}$') -and [string]::IsNullOrEmpty($displayName) -and ($scope -match '/products/.+$')
171-
})
172-
173-
if ($candidates.Count -eq 0) {
174-
Write-Host " No auto-created subscriptions found in ${ScopeLabel}"
175-
return
176-
}
177-
178-
foreach ($candidate in $candidates) {
179-
$subName = [string]$candidate.name
180-
$uri = "https://management.azure.com/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroup/providers/Microsoft.ApiManagement/service/$ServiceName/subscriptions/$subName?api-version=2025-09-01-preview"
181-
$null = Invoke-MaskedAzCommand -Replacements @{
182-
$SubscriptionId = Protect-SubscriptionId -Value $SubscriptionId
183-
$ResourceGroup = Protect-ResourceGroupName -Value $ResourceGroup
184-
$ServiceName = Protect-ApimName -Value $ServiceName
185-
} -Arguments @('rest', '--method', 'delete', '--url', $uri)
186-
187-
if ($LASTEXITCODE -eq 0) {
188-
Write-Host " Deleted subscription: $subName"
189-
} else {
190-
Write-Host " ⚠️ Failed to delete subscription: $subName"
191-
}
192-
}
193-
}
194-
195138
function Invoke-Teardown {
196139
if ($SkipTeardown) {
197140
Write-Host "⏭️ Teardown skipped (-SkipTeardown)"
@@ -544,8 +487,6 @@ try {
544487
Write-Host " Source: $(Protect-ApimName -Value $sourceName) (sub: $(Protect-SubscriptionId -Value $sourceSubId), rg: $(Protect-ResourceGroupName -Value $sourceRg))"
545488
Write-Host " Output: $ExtractOutputDir"
546489

547-
Remove-KnownAutoSubscriptions -SubscriptionId $sourceSubId -ResourceGroup $sourceRg -ServiceName $sourceName -ScopeLabel 'source'
548-
549490
$apiopsLogLevel = Get-ApiopsLogLevel -ScriptLogLevel $LogLevel
550491

551492
# For SKUs that support workspaces (Premium / PremiumV2), pass a filter file
@@ -689,8 +630,6 @@ loggers:
689630
Write-Host " Target: $(Protect-ApimName -Value $targetName) (sub: $(Protect-SubscriptionId -Value $targetSubId), rg: $(Protect-ResourceGroupName -Value $targetRg))"
690631
Write-Host " Input: $ExtractOutputDir"
691632

692-
Remove-KnownAutoSubscriptions -SubscriptionId $targetSubId -ResourceGroup $targetRg -ServiceName $targetName -ScopeLabel 'target'
693-
694633
$publishExitCode = Invoke-MaskedApiopsCommand -Replacements @{
695634
$targetSubId = Protect-SubscriptionId -Value $targetSubId
696635
$targetRg = Protect-ResourceGroupName -Value $targetRg

0 commit comments

Comments
 (0)