From c46348cd9670c90bbbc814bd2f4f59a09611f0b3 Mon Sep 17 00:00:00 2001 From: Manisha148 <70441355+Manisha148@users.noreply.github.com> Date: Fri, 20 Jan 2023 10:21:38 +0530 Subject: [PATCH 1/2] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 87 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..365c411 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,87 @@ +# Python to Linux Web App on Azure +# Build your Python project and deploy it to Azure as a Linux Web App. +# Change python version to one thats appropriate for your application. +# https://docs.microsoft.com/azure/devops/pipelines/languages/python + +trigger: +- main + +variables: + # Azure Resource Manager connection created during pipeline creation + azureServiceConnectionId: 'dfe73bcf-449c-4f34-849e-7bc73ed99f4f' + + # Web app name + webAppName: '' + + # Agent VM image name + vmImageName: 'ubuntu-latest' + + # Environment name + environmentName: '' + + # Project root folder. Point to the folder containing manage.py file. + projectRoot: $(System.DefaultWorkingDirectory) + + # Python version: 3.7 + pythonVersion: '3.7' + +stages: +- stage: Build + displayName: Build stage + jobs: + - job: BuildJob + pool: + vmImage: $(vmImageName) + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '$(pythonVersion)' + displayName: 'Use Python $(pythonVersion)' + + - script: | + python -m venv antenv + source antenv/bin/activate + python -m pip install --upgrade pip + pip install setup + pip install -r requirements.txt + workingDirectory: $(projectRoot) + displayName: "Install requirements" + + - task: ArchiveFiles@2 + displayName: 'Archive files' + inputs: + rootFolderOrFile: '$(projectRoot)' + includeRootFolder: false + archiveType: zip + archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip + replaceExistingArchive: true + + - upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip + displayName: 'Upload package' + artifact: drop + +- stage: Deploy + displayName: 'Deploy Web App' + dependsOn: Build + condition: succeeded() + jobs: + - deployment: DeploymentJob + pool: + vmImage: $(vmImageName) + environment: $(environmentName) + strategy: + runOnce: + deploy: + steps: + + - task: UsePythonVersion@0 + inputs: + versionSpec: '$(pythonVersion)' + displayName: 'Use Python version' + + - task: AzureWebApp@1 + displayName: 'Deploy Azure Web App : ' + inputs: + azureSubscription: $(azureServiceConnectionId) + appName: $(webAppName) + package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip \ No newline at end of file From 32d8523204dc3e07059154b48282682f307e242b Mon Sep 17 00:00:00 2001 From: Manisha148 <70441355+Manisha148@users.noreply.github.com> Date: Fri, 20 Jan 2023 10:24:42 +0530 Subject: [PATCH 2/2] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 46 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 365c411..5c2c0d3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -60,28 +60,28 @@ stages: displayName: 'Upload package' artifact: drop -- stage: Deploy - displayName: 'Deploy Web App' - dependsOn: Build - condition: succeeded() - jobs: - - deployment: DeploymentJob - pool: - vmImage: $(vmImageName) - environment: $(environmentName) - strategy: - runOnce: - deploy: - steps: +# - stage: Deploy +# displayName: 'Deploy Web App' +# dependsOn: Build +# condition: succeeded() +# jobs: +# - deployment: DeploymentJob +# pool: +# vmImage: $(vmImageName) +# environment: $(environmentName) +# strategy: +# runOnce: +# deploy: +# steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(pythonVersion)' - displayName: 'Use Python version' +# - task: UsePythonVersion@0 +# inputs: +# versionSpec: '$(pythonVersion)' +# displayName: 'Use Python version' - - task: AzureWebApp@1 - displayName: 'Deploy Azure Web App : ' - inputs: - azureSubscription: $(azureServiceConnectionId) - appName: $(webAppName) - package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip \ No newline at end of file +# - task: AzureWebApp@1 +# displayName: 'Deploy Azure Web App : ' +# inputs: +# azureSubscription: $(azureServiceConnectionId) +# appName: $(webAppName) +# package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip \ No newline at end of file