Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update workflow files to remove environment #7922

Merged
Merged
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
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
Loading