From 8c8db2ae7cf5e28a165259bf4fbfa6261452cc2f Mon Sep 17 00:00:00 2001 From: Caroline Jean Townend <110103578+restelica1981@users.noreply.github.com> Date: Fri, 21 Oct 2022 08:49:23 +0100 Subject: [PATCH 1/3] FlatrisCJT CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..a7f2a02 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,21 @@ +# Node.js with React +# Build a Node.js project that uses React. +# Add steps that analyze code, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript + +trigger: +- master + +pool: + vmImage: ubuntu-latest + +steps: +- task: NodeTool@0 + inputs: + versionSpec: '10.x' + displayName: 'Install Node.js' + +- script: | + npm install + npm run build + displayName: 'npm install and build' From 9beb81567855b9d61b1bbff146907ad052ab3dae Mon Sep 17 00:00:00 2001 From: Caroline Jean Townend <110103578+restelica1981@users.noreply.github.com> Date: Fri, 21 Oct 2022 11:09:52 +0100 Subject: [PATCH 2/3] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines-1.yml | 80 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 azure-pipelines-1.yml diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml new file mode 100644 index 0000000..91ea13d --- /dev/null +++ b/azure-pipelines-1.yml @@ -0,0 +1,80 @@ +# Node.js Express Web App to Linux on Azure +# Build a Node.js Express app and deploy it to Azure as a Linux web app. +# Add steps that analyze code, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript + +trigger: +- master + +variables: + + # Azure Resource Manager connection created during pipeline creation + azureSubscription: 'FlatrisCJT' + + # Web app name + webAppName: 'FlatrisCJT' + + # Resource group + resourceGroupName: 'CJT_RG' + + # Environment name + environmentName: 'FlatrisCJT' + + # Agent VM image name + vmImageName: 'ubuntu-latest' + +stages: +- stage: Archive + displayName: Archive stage + jobs: + - job: Archive + displayName: Archive + pool: + vmImage: $(vmImageName) + steps: + - task: AzureAppServiceSettings@1 + inputs: + azureSubscription: $(azureSubscription) + appName: $(webAppName) + resourceGroupName: $(resourceGroupName) + appSettings: | + [ + { + "name": "SCM_DO_BUILD_DURING_DEPLOYMENT", + "value": "true" + } + ] + - task: ArchiveFiles@2 + displayName: 'Archive files' + inputs: + rootFolderOrFile: '$(System.DefaultWorkingDirectory)' + includeRootFolder: false + archiveType: zip + archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip + replaceExistingArchive: true + + - upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip + artifact: drop + +- stage: Deploy + displayName: Deploy stage + dependsOn: Archive + condition: succeeded() + jobs: + - deployment: Deploy + displayName: Deploy + environment: $(environmentName) + pool: + vmImage: $(vmImageName) + strategy: + runOnce: + deploy: + steps: + - task: AzureWebApp@1 + displayName: 'Azure Web App Deploy: Matt-Test-NodeJS-Deploy' + inputs: + azureSubscription: $(azureSubscription) + appType: webAppLinux + appName: $(webAppName) + runtimeStack: 'NODE|10.14' + package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip From 36f0349d18af8d1d71e30c1ae6395adad8dd11ca Mon Sep 17 00:00:00 2001 From: Caroline Jean Townend <110103578+restelica1981@users.noreply.github.com> Date: Fri, 21 Oct 2022 14:15:37 +0100 Subject: [PATCH 3/3] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 94 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 77 insertions(+), 17 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a7f2a02..38cff4c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,21 +1,81 @@ -# Node.js with React -# Build a Node.js project that uses React. +# Node.js Express Web App to Linux on Azure +# Build a Node.js Express app and deploy it to Azure as a Linux web app. # Add steps that analyze code, save build artifacts, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/javascript - + trigger: - master - -pool: - vmImage: ubuntu-latest - -steps: -- task: NodeTool@0 - inputs: - versionSpec: '10.x' - displayName: 'Install Node.js' - -- script: | - npm install - npm run build - displayName: 'npm install and build' + +variables: + + # Azure Resource Manager connection created during pipeline creation + azureSubscription: 'Flatris' + + # Web app name + webAppName: 'Flatriss' + + # Resource group + resourceGroupName: 'Flatris' + + # Environment name + environmentName: 'Flatriss' + + # Agent VM image name + vmImageName: 'ubuntu-latest' + +stages: +- stage: Archive + displayName: Archive stage + jobs: + - job: Archive + displayName: Archive + pool: + vmImage: $(vmImageName) + steps: + - task: AzureAppServiceSettings@1 + inputs: + azureSubscription: $(azureSubscription) + appName: $(webAppName) + resourceGroupName: $(resourceGroupName) + appSettings: | + [ + { + "name": "SCM_DO_BUILD_DURING_DEPLOYMENT", + "value": "true" + } + ] + - task: ArchiveFiles@2 + displayName: 'Archive files' + inputs: + rootFolderOrFile: '$(System.DefaultWorkingDirectory)' + includeRootFolder: false + archiveType: zip + archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip + replaceExistingArchive: true + + - upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip + artifact: drop + +- stage: Deploy + displayName: Deploy stage + dependsOn: Archive + condition: succeeded() + jobs: + - deployment: Deploy + displayName: Deploy + environment: $(environmentName) + pool: + vmImage: $(vmImageName) + strategy: + runOnce: + deploy: + steps: + - task: AzureWebApp@1 + displayName: 'Azure Web App Deploy: Matt-Test-NodeJS-Deploy' + inputs: + azureSubscription: $(azureSubscription) + appType: webAppLinux + appName: $(webAppName) + runtimeStack: 'NODE|10.14' + package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip +