首页 > 解决方案 > Azure Pipeline (YAML) 将一个空解决方案部署到我的 FunctionApp

问题描述

我正在使用 YAML 构建一个 CI-CD azure 管道来部署一个 azure 函数应用程序。一切正常,我什至可以为函数应用设置一些属性,但我的函数应用仍然是空的。

我下载了 zip 工件,看起来还不错。

trigger:
- master
variables:
  variables:
  buildConfiguration: 'Release'
  Parameters.RestoreBuildProjects: '**/TestFunction.csproj'
stages:
- stage: Build
  jobs:
  - job:
    pool:
      vmImage: 'vs2017-win2016'
      continueOnError: false
    steps:    
    - task: DotNetCoreCLI@2
      displayName: 'Restore'
      inputs:
        command: 'restore'
        projects: '$(Parameters.RestoreBuildProjects)'
        feedsToUse: 'select'
        vstsFeed: '/0856b234-f3a6-4052-b5a6-ed9f6ec9c635'
    - task: DotNetCoreCLI@2
      displayName: Build
      inputs:
        projects: '$(Parameters.RestoreBuildProjects)'
        arguments: '--configuration $(BuildConfiguration)'
    - task: DotNetCoreCLI@2
      displayName: 'Publish Build'
      inputs:
        command: publish
        arguments: '--configuration $(BuildConfiguration)'
        projects: '$(Parameters.RestoreBuildProjects)'
        publishWebProjects: false
        modifyOutputPath: true
        zipAfterPublish: false
    - task: ArchiveFiles@2
      displayName: "Archive Files"
      inputs:
        rootFolderOrFile: "$(System.DefaultWorkingDirectory)"
        includeRootFolder: false
        archiveFile: "$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip"
    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: '$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip'
        ArtifactName: 'drop'    
- stage: Deploy
  jobs:
    # track deployments on the environment
  - deployment:
    pool:
      vmImage: 'vs2017-win2016'
    # creates an environment if it doesn’t exist
    environment: 'dev'
    strategy:
      # default deployment strategy
      runOnce:
        deploy:
          steps:
          - task: DownloadBuildArtifacts@0
            displayName: 'Download Artifacts'
            inputs:
              buildType: 'current'
              downloadType: 'specific'
              downloadPath: '$(System.ArtifactsDirectory)'        
          - task: AzureFunctionApp@1
            displayName: 'Azure Function App Deploy: ngproductionfetcherfuncref'
            inputs:
              azureSubscription: 'Agder Energi Sandbox (1aa9cf92-9d42-49a6-8d31-876ac2dff562)'
              appType: functionApp
              appName: myFunctionApp
              package: '$(System.ArtifactsDirectory)/**/*.zip'
              appSettings: '-name0 value0 -name1 value1'

管道全是绿色的:

获取 Azure 应用服务的服务连接详细信息:'myFunctionApp' 正在更新应用服务应用程序设置。数据:{"WEBSITE_RUN_FROM_PACKAGE":"1"} {"WEBSITE_RUN_FROM_ZIP":{"value":""}} 更新了 App Service 应用程序设置和 Kudu 应用程序设置。使用 ZIP Deploy 启动包部署。已成功将 Web 包部署到应用服务。更新应用服务应用程序设置。数据:{"name0":"value0","name1":"value1"} undefined 更新了 App Service 应用程序设置和 Kudu 应用程序设置。

标签: azureazure-functionsazure-pipelinesazure-pipelines-release-pipeline

解决方案


推荐阅读