Skip to content

Commit

Permalink
node oryx workflow (#7878)
Browse files Browse the repository at this point in the history
  • Loading branch information
spellegrino021 authored Oct 23, 2024
1 parent 03d82c6 commit 1cbc5c4
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,15 @@ const DeploymentCenterCodeForm: React.FC<DeploymentCenterCodeFormProps> = props
variables['isFlexConsumption'] = true;
}

if (
values.runtimeStack === RuntimeStackOptions.Node &&
siteStateContext.isLinuxApp &&
deploymentCenterContext.applicationSettings?.properties &&
deploymentCenterContext.applicationSettings.properties[DeploymentCenterConstants.appSettings_SCM_DO_BUILD_DURING_DEPLOYMENT]
) {
variables['nodeOryxWorkflow'] = true;
}

return variables;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import DeploymentCenterCodeBuildConfiguredView from './DeploymentCenterCodeBuild
import DeploymentCenterCodeBuildRuntimeAndVersion from './DeploymentCenterCodeBuildRuntimeAndVersion';
import DeploymentCenterCodeSourceAndBuild from './DeploymentCenterCodeSourceAndBuild';
import DeploymentCenterCodeSourceKuduConfiguredView from './DeploymentCenterCodeSourceKuduConfiguredView';
import { DeploymentCenterConstants } from '../DeploymentCenterConstants';

const DeploymentCenterCodeSettings: React.FC<DeploymentCenterFieldProps<DeploymentCenterCodeFormData>> = props => {
const { formProps, isDataRefreshing } = props;
Expand Down Expand Up @@ -176,6 +177,15 @@ const DeploymentCenterCodeSettings: React.FC<DeploymentCenterFieldProps<Deployme
variables['isFlexConsumption'] = true;
}

if (
formProps.values.runtimeStack === RuntimeStackOptions.Node &&
siteStateContext.isLinuxApp &&
deploymentCenterContext.applicationSettings?.properties &&
deploymentCenterContext.applicationSettings?.properties[DeploymentCenterConstants.appSettings_SCM_DO_BUILD_DURING_DEPLOYMENT]
) {
variables['nodeOryxWorkflow'] = true;
}

return variables;
};

Expand Down
10 changes: 9 additions & 1 deletion server/src/workflows/2022-10-01/WorkflowService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ export class WorkflowService20221001 {
throw new HttpException(`The java container must be specified`, 404);
}
case RuntimeStacks.Node:
return this.readWorkflowFile('web-app-configs/node-linux.config.yml');
if (this.nodeOryxWorkflowCheck(variables)) {
return this.readWorkflowFile('web-app-configs/node-linux-oryx.config.yml');
} else {
return this.readWorkflowFile('web-app-configs/node-linux.config.yml');
}
case RuntimeStacks.Python:
return this.readWorkflowFile('web-app-configs/python-linux.config.yml');
case RuntimeStacks.Php:
Expand Down Expand Up @@ -194,6 +198,10 @@ export class WorkflowService20221001 {
return !!variables && !!variables['javaContainer'] && variables['javaContainer'].toLocaleLowerCase() === JavaContainers.JavaSE;
}

nodeOryxWorkflowCheck(variables: { [key: string]: string }) {
return !!variables && !!variables['nodeOryxWorkflow'];
}

getContainerWorkflowFile(appType: string, os: string) {
if (appType.toLocaleLowerCase() === AppType.WebApp && os.toLocaleLowerCase() === Os.Linux) {
return this.readWorkflowFile('container-configs/container-webapp-linux.config.yml');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy Node.js app to Azure Web App - __sitename__

on:
push:
branches:
- __branch__
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '__runtimeversion__'

- name: Zip artifact for deployment
run: zip release.zip ./* -r

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: node-app
path: release.zip

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: '__slotname__'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
__permissions__
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: node-app

- name: Unzip artifact for deployment
run: unzip release.zip
__login-to-azure-step__
- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: '__sitename__'
slot-name: '__slotname__'
package: .
__publishing-profile__

0 comments on commit 1cbc5c4

Please sign in to comment.