[英]Deploy code from Azure repo to Function app slot
I have setup Azure DevOps repo and pipeline to deploy my code to Azure Functio App slot.我已经设置了 Azure DevOps 存储库和管道,以将我的代码部署到 Azure Functio App 插槽。 I was able to deploy app to my slot but after making some code changes I tried to re deploy my app/code but now pipeline failed.我能够将应用程序部署到我的插槽,但在进行一些代码更改后,我尝试重新部署我的应用程序/代码,但现在管道失败了。 Probably because my pipeline is somehow wrong configured (so it can only deploy if slot is empty but can not update or redeploy on top of existing code).可能是因为我的管道配置错误(因此它只能在插槽为空时部署但不能在现有代码之上更新或重新部署)。
This is my pipeline这是我的管道
- master
variables:
# Azure Resource Manager connection created during pipeline creation
azureSubscription: 'My Service Connector'
# Function app name
functionAppName: 'My Fuction app name'
# Agent VM image name
vmImageName: 'vs2017-win2016'
# Working Directory
workingDirectory: '$(System.DefaultWorkingDirectory)/'
stages:
- stage: Build
displayName: Build stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- powershell: |
if (Test-Path "extensions.csproj") {
dotnet build extensions.csproj --output ./$(workingDirectory)/bin
}
displayName: 'Build extensions'
- task: ArchiveFiles@2
displayName: 'Archive files'
inputs:
rootFolderOrFile: $(workingDirectory)
includeRootFolder: false
archiveType: zip
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
replaceExistingArchive: true
- publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
artifact: drop
- stage: Deploy
displayName: Deploy stage
dependsOn: Build
condition: succeeded()
jobs:
- deployment: Deploy
displayName: Deploy
environment: $(functionAppName)
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: AzureFunctionApp@1
inputs:
azureSubscription: '$(azureSubscription)'
appType: functionApp
appName: $(functionAppName)
package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
deployToSlotOrASE: true
resourceGroupName: 'my app resource group'
slotName: testing
Error from pipeline:管道错误:
FYi, I'm not developer nor that familiar with tools like git, repos, pipelines etc. Any tips what could I do different so that I could update my app code from Azure Repos + pipelines?仅供参考,我不是开发人员,也不熟悉 git、repos、管道等工具。有什么提示我可以做些什么不同的,以便我可以从 Azure Repos + 管道更新我的应用程序代码?
Try to set up a new ARM connection ( Azure Resource Manager service connection ) for use in the pipeline to see if it can work.尝试建立一个新的 ARM 连接( Azure Resource Manager service connection )在管道中使用,看看它是否可以工作。
If the issue still exists, you can enable debugging via setting the pipeline variable System.Debug
to true
.如果问题仍然存在,您可以通过将管道变量System.Debug
设置为true
来启用调试。 The queue a new run.排队新的运行。 From the debug logs, you may get more helpful information about the issue.从调试日志中,您可能会获得有关该问题的更多有用信息。
Had to change vmImageName: 'vs2017-win2016' to vmImageName: 'windows-lastest' to get this working.必须将 vmImageName: 'vs2017-win2016' 更改为 vmImageName: 'windows-latest' 才能正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.