From ad4fb695e8ea3e72194305549f6ba3424ff5dc72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=C3=A1vai=20Tam=C3=A1s?= Date: Mon, 27 Oct 2025 10:20:10 +0100 Subject: [PATCH 1/9] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 88 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..b303b3e1c --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,88 @@ +# 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: '6b85745e-9646-4256-be04-c8caa085ba68' + + # Web app name + webAppName: 'dm050demo' + + # Agent VM image name + vmImageName: 'ubuntu-latest' + + # Environment name + environmentName: 'dm050demo' + + # Project root folder. Point to the folder containing manage.py file. + projectRoot: $(System.DefaultWorkingDirectory) + + pythonVersion: '3.10' + +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 : dm050demo' + inputs: + appType: webAppLinux + azureSubscription: $(azureServiceConnectionId) + appName: $(webAppName) + package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip + startUpCommand: 'gunicorn -w 2 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 main:app' From bc360d2ba7b66b8c07660825f7f72327ac41cd39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=C3=A1vai=20Tam=C3=A1s?= Date: Mon, 27 Oct 2025 10:49:55 +0100 Subject: [PATCH 2/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b303b3e1c..f1f42f14c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -23,6 +23,7 @@ variables: projectRoot: $(System.DefaultWorkingDirectory) pythonVersion: '3.10' + resourceGroup: 'dm050' stages: - stage: Build @@ -59,6 +60,25 @@ stages: displayName: 'Upload package' artifact: drop +- stage: ConfigureAppSettings + displayName: 'Configure application' + jobs: + - job: SetAppSettings + pool: + vmImage: $(vmImageName) + steps: + - task: AzureCLI@2 + displayName: 'Set App Service app settings' + inputs: + azureSubscription: $(azureServiceConnectionId) + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + az webapp config apsettings set \ + --name "$(webAppName)" \ + --resource-group "$(resourceGroup)" \ + --settings "SCM_DO_BUILD_DURING_DEPLOYMENT=true" + - stage: Deploy displayName: 'Deploy Web App' dependsOn: Build From 685ae6f3d2393f377c921d1c662b8a89ced384bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=C3=A1vai=20Tam=C3=A1s?= Date: Mon, 27 Oct 2025 10:53:07 +0100 Subject: [PATCH 3/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f1f42f14c..b8eabc11b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -74,7 +74,7 @@ stages: scriptType: bash scriptLocation: inlineScript inlineScript: | - az webapp config apsettings set \ + az webapp config appsettings set \ --name "$(webAppName)" \ --resource-group "$(resourceGroup)" \ --settings "SCM_DO_BUILD_DURING_DEPLOYMENT=true" From ea334f227beb290a6ccf1c92269e01b7cdb2da1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=C3=A1vai=20Tam=C3=A1s?= Date: Mon, 27 Oct 2025 11:10:17 +0100 Subject: [PATCH 4/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b8eabc11b..7e6defa11 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,6 +25,8 @@ variables: pythonVersion: '3.10' resourceGroup: 'dm050' + system.debug: true + stages: - stage: Build displayName: Build stage From a61725c9071e0b504c4bc887f603a7fee704627d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=C3=A1vai=20Tam=C3=A1s?= Date: Mon, 27 Oct 2025 11:15:11 +0100 Subject: [PATCH 5/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7e6defa11..4f4ba439e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -62,13 +62,6 @@ stages: displayName: 'Upload package' artifact: drop -- stage: ConfigureAppSettings - displayName: 'Configure application' - jobs: - - job: SetAppSettings - pool: - vmImage: $(vmImageName) - steps: - task: AzureCLI@2 displayName: 'Set App Service app settings' inputs: From de692eafb24faccd94b52f8cd6df954357c79cc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=C3=A1vai=20Tam=C3=A1s?= Date: Mon, 27 Oct 2025 11:23:40 +0100 Subject: [PATCH 6/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4f4ba439e..c73e93d9c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -58,7 +58,7 @@ stages: archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip replaceExistingArchive: true - - upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip + - publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip displayName: 'Upload package' artifact: drop @@ -101,3 +101,4 @@ stages: appName: $(webAppName) package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip startUpCommand: 'gunicorn -w 2 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 main:app' + From f42d029a145c04751cf17db09268b30b1f101f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=C3=A1vai=20Tam=C3=A1s?= Date: Mon, 27 Oct 2025 11:56:30 +0100 Subject: [PATCH 7/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c73e93d9c..87b55893d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -44,7 +44,6 @@ stages: 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" From caa3fcceef605e647a086cd57a539d9e42e1aa43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=C3=A1vai=20Tam=C3=A1s?= Date: Mon, 27 Oct 2025 12:00:28 +0100 Subject: [PATCH 8/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 87b55893d..3662c32f5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -43,7 +43,7 @@ stages: - script: | python -m venv antenv source antenv/bin/activate - python -m pip install --upgrade pip + cat requirements.txt pip install -r requirements.txt workingDirectory: $(projectRoot) displayName: "Install requirements" From 361de28967ee82b9678320f99d85e1abb31a6e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=C3=A1vai=20Tam=C3=A1s?= Date: Mon, 27 Oct 2025 12:10:14 +0100 Subject: [PATCH 9/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3662c32f5..cb845b2e2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -43,11 +43,15 @@ stages: - script: | python -m venv antenv source antenv/bin/activate - cat requirements.txt - pip install -r requirements.txt workingDirectory: $(projectRoot) displayName: "Install requirements" + - script: | + pip install -r requirements.txt + workingDirectory: $(projectRoot) + displayName: "Install requirements 2" + + - task: ArchiveFiles@2 displayName: 'Archive files' inputs: