Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fair-bars-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@gradientedge/cdk-utils-azure': patch
---

Create deployment slots before dependent Web App deployment commands.
2 changes: 1 addition & 1 deletion packages/azure/src/construct/site-with-webapp/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export class SiteWithWebApp extends CommonAzureConstruct {
this.createCodePackage()
this.createWebAppSiteConfig()
this.createWebApp()
this.createWebAppSlot()
this.createDiagnosticLog()
}

Expand Down Expand Up @@ -177,6 +176,7 @@ export class SiteWithWebApp extends CommonAzureConstruct {
},
{ ...resourceOptions }
)
this.createWebAppSlot()
}

/** @summary Create the optional Azure Web App deployment slot */
Expand Down
8 changes: 6 additions & 2 deletions packages/azure/src/services/app-service/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class AzureAppServiceManager {
`${id}-was`,
{
...props,
name: scope.resourceNameFormatter.format(props.name?.toString(), scope.props.resourceNameOptions?.linuxWebApp),
name: props.name,
resourceGroupName,
location: props.location ?? scope.props.location,
httpsOnly: props.httpsOnly ?? true,
Expand All @@ -179,7 +179,11 @@ export class AzureAppServiceManager {
...props.tags,
},
},
{ parent: scope, ...resourceOptions }
{
parent: scope,
...resourceOptions,
ignoreChanges: [...new Set([...(resourceOptions?.ignoreChanges ?? []), 'siteConfig.autoSwapSlotName'])],
}
)
}
}
9 changes: 7 additions & 2 deletions packages/azure/test/constructs/site-with-webapp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,14 @@ describe('TestSiteWithWebAppConstruct', () => {

test('provisions web app slot with auto-swap configuration', () => {
pulumi
.all([stack.construct.site.webAppSlot?.id, stack.construct.site.webAppSlot?.siteConfig])
.apply(([id, siteConfig]) => {
.all([
stack.construct.site.webAppSlot?.id,
stack.construct.site.webAppSlot?.name,
stack.construct.site.webAppSlot?.siteConfig,
])
.apply(([id, name, siteConfig]) => {
expect(id).toEqual('test-common-stack-web-app-slot-was-id')
expect(name).toEqual('test-site-web-app-dev')
expect(siteConfig?.autoSwapSlotName).toEqual('production')
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/azure/test/services/app-service-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ describe('TestAzureWebAppSlotConstruct', () => {
expect(urn).toEqual(
'urn:pulumi:stack::project::construct:test-common-stack$azure-native:web:WebAppSlot::test-web-app-slot-dev-was'
)
expect(name).toEqual('test-linux-web-app-dev')
expect(name).toEqual('test-linux-web-app')
expect(location).toEqual('eastus')
expect(httpsOnly).toEqual(true)
expect(tags?.environment).toEqual('dev')
Expand Down