From 88cdca1057ed234bbf0baeaf626fd1642ecbec08 Mon Sep 17 00:00:00 2001 From: Stephanie Pellegrino <35281019+spellegrino021@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:01:53 -0800 Subject: [PATCH] fix (#7918) --- .../workflows/2022-10-01/WorkflowService.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/server/src/workflows/2022-10-01/WorkflowService.ts b/server/src/workflows/2022-10-01/WorkflowService.ts index 6dde875c45..2072babcf1 100644 --- a/server/src/workflows/2022-10-01/WorkflowService.ts +++ b/server/src/workflows/2022-10-01/WorkflowService.ts @@ -35,19 +35,9 @@ export class WorkflowService20221001 { const permssions = `permissions: id-token: write #This is required for requesting the JWT contents: read #This is required for actions/checkout\n`; - const environment = `environment: - name: '__slotname__' - url: \${{ steps.deploy-to-webapp.outputs.webapp-url }}`; - workflowFile = workflowFile.replace(new RegExp(publishProfilePlaceholder, 'gi'), ''); workflowFile = workflowFile.replace(new RegExp(loginToAzureStepPlaceholder, 'gi'), loginToAzureStep); workflowFile = workflowFile.replace(new RegExp(permissionsPlaceholder, 'gi'), permssions); - - if (variables?.isRemoveEnvEnabled) { - workflowFile = workflowFile.replace(new RegExp(environmentPlaceholder, 'gi'), ''); - } else { - workflowFile = workflowFile.replace(new RegExp(environmentPlaceholder, 'gi'), environment); - } } else { if (variables?.isFlexConsumption) { const flexConsumptionPublishProfile = `publish-profile: \${{ secrets.__publishingprofilesecretname__ }} @@ -64,6 +54,15 @@ export class WorkflowService20221001 { workflowFile = workflowFile.replace(new RegExp(permissionsPlaceholder, 'gi'), ''); } + const environment = `environment: + name: '__slotname__' + url: \${{ steps.deploy-to-webapp.outputs.webapp-url }}`; + if (variables?.isRemoveEnvEnabled) { + workflowFile = workflowFile.replace(new RegExp(environmentPlaceholder, 'gi'), ''); + } else { + workflowFile = workflowFile.replace(new RegExp(environmentPlaceholder, 'gi'), environment); + } + Object.keys(variables).forEach(variableKey => { const replaceKey = `__${variableKey}__`; workflowFile = workflowFile.replace(new RegExp(replaceKey, 'gi'), variables[variableKey]);