Skip to content

Commit

Permalink
Update workflow files to remove environment (#7922)
Browse files Browse the repository at this point in the history
* fix

* indent
  • Loading branch information
spellegrino021 authored Nov 26, 2024
1 parent 3afab71 commit 5e1e558
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions server/src/workflows/2022-10-01/WorkflowService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,9 @@ export class WorkflowService20221001 {
subscription-id: \${{ secrets.__subscriptionidsecretname__ }}\n`;
const permssions = `permissions:
id-token: write #This is required for requesting the JWT\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__ }}
Expand All @@ -63,6 +53,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]);
Expand Down

0 comments on commit 5e1e558

Please sign in to comment.