如何在Azure构建管道中添加--no-bundler命令

时间:2019-11-12 08:40:54

标签: python azure azure-functions azure-pipelines

在python中运行我的函数应用时遇到了一些麻烦。当我直接通过func azure functionapp publish air-temperature-v2 --no-bundler推送功能时。这会将函数直接发布到portal.azure,并且函数按预期工作。但是,如果我尝试提交并推送到Azure存储库并生成其生成,则一切都成功了,但是当我尝试运行该函数时,它给出了一个模块名“ pandas”,未找到错误。它可以在本地和在线正常运行(不使用bundler命令)。我的问题是,如何在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命令添加为启动命令,但是它仍然不起作用。

1 个答案:

答案 0 :(得分:1)

这可能与azure-function-core-tools版本问题有关,请尝试以下并进行部署:

  • 请将您的azure-function-core-tool版本更新为最新版本

  • 请尝试使用以下命令部署您的构建:

func azure functionapp publish <app_name> --build remote

有时也有类似的问题出现,无法回忆,但此修复程序有效。

或者,您是否考虑过要部署Azure功能的Azure CLI任务,这是一篇详细的文章,说明了使用Azure Azure Cli for python的Azure CI CD。

https://clemenssiebler.com/deploy-azure-functions-python-azure-devops/

希望有帮助。

相关问题