我已经在VSCode中创建了一个Azure Function(.csx文件),我希望能够将其推送到Azure Devops Repo上的一个分支,然后它会自动生成并部署到Azure Portal Web Function。
我已经使用了Azure Function VSCode扩展,但这没有达到我的要求。我希望能够将其推送到存储库,并使其进行管道构建。
我已经使用“ Azure App Service Deploy”任务创建了一个管道。根据任务的要求,它链接到服务主体,并已使用Azure资源管理器。它具有一个Azure订阅,服务名称和资源组。
我已经完成了“保存并排队”,希望一切都正确完成,并且我会看到分支上的函数转到任务中指定的Azure函数,但是却出现构建错误提示
“未找到具有指定模式/home/vsts/work/1/s/**/*.zip的软件包”。
我没有这个文件,我假设它会尝试获取.csx文件。
任何人都可以将我引向正确的方向,我迷失于失败的地方,我的Azure Function是VSCode错误,是我推挤台阶的方式还是管道错误?
答案 0 :(得分:0)
这是我如何进行azure函数构建的示例:
steps:
- task: DotNetCoreCLI@2
displayName: 'restore'
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: 'select'
versioningScheme: 'off'
- task: DotNetCoreCLI@2
displayName: 'build'
inputs:
command: 'build'
projects: '**/*.csproj'
feedsToUse: 'select'
versioningScheme: 'off'
- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: publish
publishWebProjects: false
projects: '**/*.csproj'
arguments: '--configuration $(buildConfiguration) --output $(build.artifactstagingdirectory)'
zipAfterPublish: true
- task: PublishBuildArtifacts@1
displayName: 'artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'QueueFunction'
publishLocation: 'Container'
,然后发布的版本为:
- task: AzureFunctionApp@1
displayName: 'Azure Function App Deploy'
inputs:
azureSubscription: '$(subscriptionId)'
appType: functionApp
appName: 'xxxxx'
因此,通常,您需要构建应用程序,然后将其打包并将其推送到提要。然后您可以将其放入发行版中。