Meine Pipeline ist:
Code: Select all
trigger:
- main
variables:
azureServiceConnectionId: service_connectionID
webAppName: appname
vmImageName: 'image'
environmentName: 'env'
projectRoot: $(System.DefaultWorkingDirectory)
pythonVersion: '3.11'
stages:
- stage: Build
displayName: Build stage
jobs:
- job: BuildJob
pool:
vmImage: $(vmImageName)
steps:
# Set up Python environment
- task: UsePythonVersion@0
inputs:
versionSpec: '$(pythonVersion)'
displayName: 'Use Python $(pythonVersion)'
# Install dependencies
- script: |
python -m venv antenv
source antenv/bin/activate
python -m pip install --upgrade pip
pip install setuptools wheel
pip install -r requirements.txt
workingDirectory: $(projectRoot)
displayName: 'Install requirements'
# Create deployment package
- task: ArchiveFiles@2
displayName: 'Archive files'
inputs:
rootFolderOrFile: '$(projectRoot)'
includeRootFolder: false
archiveType: zip
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
replaceExistingArchive: true
# Publish build artifacts
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
- stage: Deploy
displayName: 'Deploy Web App'
dependsOn: Build
condition: succeeded()
jobs:
- deployment: DeploymentJob
environment: $(environmentName)
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
# Deploy the web app
- task: AzureWebApp@1
displayName: 'Deploy Azure Web App'
inputs:
azureSubscription: $(azureServiceConnectionId)
appType: 'webAppLinux'
appName: $(webAppName)
package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
runtimeStack: 'PYTHON|3.11'
startUpCommand: 'startup.txt'
deploymentMethod: 'auto'
Code: Select all
gunicorn -w 4 -k uvicorn.workers.UvicornWorker --timeout 600 -b 0.0.0.0:8000 app:app
##[Fehler]Fehler beim Bereitstellen des Webpakets für App Service.
##[warning]Loc-String für Schlüssel: KuduStackTraceURL kann nicht gefunden werden
##[error]KuduStackTraceURL https://:@ai-commission-dsbfcbduhcb6gtf ... kudu/trace
##[error]Fehler: Fehler : Webpaket konnte nicht für App Service bereitgestellt werden. Konflikt (CODE: 409)
##[Warnung]Fehler: Aktualisierung des Bereitstellungsverlaufs fehlgeschlagen. Fehler: Ungültige Anfrage (CODE: 400)