[英]How to add --no-bundler command in azure build pipeline
我在 python 中運行我的 function 應用程序時遇到了一些問題。 當我直接通過func azure functionapp publish air-temperature-v2 --no-bundler
推送 function 時。 這會將 function 直接發布到門戶網站。azure 和 function 按預期工作。 但是,如果我嘗試提交並推送到 Azure 存儲庫並生成其構建,一切都會成功,但是當我嘗試運行 function 時,它給出了一個模塊名稱“pandas”未找到錯誤。 它在本地和在線都可以正常工作(不使用捆綁器命令)。 我的問題是,如何在 azure python 管道中添加 no bundler 命令? 我的 yaml 如下:
# Python package
# Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python36:
python.version: '3.6'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- script: |
python -m pip install --upgrade pip
pip install -r requirements.txt
displayName: 'Install dependencies'
- script: python HttpExample/__init__.py
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/Application$(Build.BuildId).zip'
replaceExistingArchive: true
verbose: # (no value); this input is optional
- task: PublishBuildArtifacts@1
#- script: |
# pip install pytest pytest-azurepipelines
# pytest
# displayName: 'pytest'
# ignore
- task: AzureFunctionApp@1
inputs:
azureSubscription: 'zohair-rg'
appType: 'functionAppLinux'
appName: 'air-temperature-v2'
package: '$(Build.ArtifactStagingDirectory)/Application$(Build.BuildId).zip'
startUpCommand: 'func azure functionapp publish air-temperature-v2 --no-bundler'
我什至嘗試將 no bundler 命令添加為啟動命令,但它仍然不起作用。
這可能與 azure-function-core-tools 版本問題有關,請嘗試以下部署:
請將您的 azure-function-core-tool 版本更新到最新版本
請嘗試使用以下命令部署您的構建:
func azure functionapp publish <app_name> --build remote
曾經有過類似的問題,不記得了,但這個修復有效。
Alternatively, have you considere Azure CLI task to deploy azure function, here is a detailed article explaining the Azure CI CD using azure CLi for python.
https://clemenssiebler.com/deploy-azure-functions-python-azure-devops/
希望能幫助到你。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.