From edf7d753f4b6f87beedf02ce762461ecb96b867b Mon Sep 17 00:00:00 2001 From: ldself Date: Wed, 5 Feb 2025 22:10:50 -0600 Subject: [PATCH 1/3] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 86 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..e3c1bcae4 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,86 @@ +# 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: '5409f913-e87a-4e84-8ec8-6a7b08ebac0c' + + # Web app name + webAppName: 'msdocs-python-webapp-quickstart-lds' + + # Agent VM image name + vmImageName: 'ubuntu-latest' + + # Environment name + environmentName: 'msdocs-python-webapp-quickstart-lds' + + # Project root folder. Point to the folder containing manage.py file. + projectRoot: $(System.DefaultWorkingDirectory) + + pythonVersion: '3.11' + +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 : msdocs-python-webapp-quickstart-lds' + inputs: + azureSubscription: $(azureServiceConnectionId) + appName: $(webAppName) + package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip \ No newline at end of file From 3687809eba527f49ec018d0689226ba2a44632b3 Mon Sep 17 00:00:00 2001 From: ldself Date: Wed, 5 Feb 2025 23:04:20 -0600 Subject: [PATCH 2/3] Update azure-pipelines.yml to use myAgentPool --- azure-pipelines.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e3c1bcae4..561b56964 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,6 +6,8 @@ trigger: - main +pool: myAgentPool + variables: # Azure Resource Manager connection created during pipeline creation azureServiceConnectionId: '5409f913-e87a-4e84-8ec8-6a7b08ebac0c' @@ -83,4 +85,4 @@ stages: inputs: azureSubscription: $(azureServiceConnectionId) appName: $(webAppName) - package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip \ No newline at end of file + package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip From 44d8cfe044f53b7e318e1b3516e5ec941bc2d7b5 Mon Sep 17 00:00:00 2001 From: ldself Date: Thu, 6 Feb 2025 10:29:44 -0600 Subject: [PATCH 3/3] Update azure-pipelines.yml added an s --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 561b56964..5aab6b83a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,6 +1,6 @@ # 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. +# Change python version to one thats appropriate for your applications. # https://docs.microsoft.com/azure/devops/pipelines/languages/python trigger: