1- # yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json
2-
3- # This is an example starter azure.yaml file containing several example services in comments below.
4- # Make changes as needed to describe your application setup.
5- # To learn more about the azure.yaml file, visit https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/azd-schema
6-
7- # Name of the application.
8- name : msdocs-python-flask-webapp-quickstart
9- metadata :
10- template : msdocs-python-flask-webapp-quickstart@0.0.1-beta
11- services :
12- web :
13- project : .
14- language : python
15- host : appservice
1+ # Azure DevOps pipeline for deploying a Python app to Azure App Service (Linux)
2+ # Save as azure-pipelines.yml in your repo root
3+
4+ trigger :
5+ branches :
6+ include :
7+ - main # Change to your main branch
8+
9+ variables :
10+ # Set these variables or override in Pipeline UI
11+ azureSubscription : ' ShikhaAzureConnection'
12+ appName : ' pythonappsample'
13+ resourceGroupName : ' shikhajhatestingrg'
14+ pythonVersion : ' 3.13' # Change as needed
15+
16+ pool :
17+ vmImage : ' ubuntu-latest'
18+
19+ steps :
20+
21+ - task : UsePythonVersion@0
22+ inputs :
23+ versionSpec : ' $(pythonVersion)'
24+ addToPath : true
25+
26+ - script : |
27+ python -m pip install --upgrade pip
28+ pip install -r requirements.txt
29+ displayName : ' Install dependencies'
30+
31+ - script : |
32+ python -m pytest
33+ displayName : ' Run tests'
34+ # Remove if not using pytest
35+
36+ - task : ArchiveFiles@2
37+ inputs :
38+ rootFolderOrFile : ' $(System.DefaultWorkingDirectory)'
39+ includeRootFolder : false
40+ archiveType : ' zip'
41+ archiveFile : ' $(Build.ArtifactStagingDirectory)/app.zip'
42+ replaceExistingArchive : true
43+
44+ - publish : ' $(Build.ArtifactStagingDirectory)/app.zip'
45+ artifact : drop
46+
47+ - task : AzureWebApp@1
48+ displayName : ' Deploy to Azure Web App'
49+ inputs :
50+ azureSubscription : ' $(azureSubscription)'
51+ appType : ' webAppLinux'
52+ appName : ' $(appName)'
53+ package : ' $(Build.ArtifactStagingDirectory)/app.zip'
54+
0 commit comments