简体   繁体   English

将代码从 Azure repo 部署到 Function app slot

[英]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.

相关问题 部署到唯一 Azure Function 应用程序部署槽并返回 URL 和 Github 操作 - Deploy to Unique Azure Function App Deployment Slot and Return URL with Github Actions 部署Azure function到微软Azure中的应用服务 - Deploy Azure function to app service in Microsoft Azure 使用私有 DockerHub 存储库中的 Terraform 在 Azure 上部署容器 - Deploy container on Azure with Terraform from private DockerHub repo 如何从 VS Code 发布到 Azure 中的开发槽 - How to publish to a development slot in Azure from VS Code 如何将python app部署到Azure Function - How to deploy python app to Azure Function 将 Azure function 部署到 Azure 时,它怎么知道应该从 App 设置而不是从 local.setting.json 读取 AzureFunctionSettings - When deploy Azure function to Azure how did it know that it should read the AzureFunctionSettings from App settings instead of from local.setting.json Zip 从存储帐户部署 azure function - Zip deploy azure function from storage account 如何从github部署到Azure应用服务 - How to Deploy from github to Azure App Service Azure Function 插槽交换前的健康检查? - Azure Function healthcheck before slot swap? 从 Azure Function 应用程序迁移到 Azure 容器应用程序 - Migrate from Azure Function app to Azure Container app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM