Azure FunctionApp在通过Azure DevOps成功进行CI/CD后没有功能

w41d8nur  于 2023-02-19  发布在  其他
关注(0)|答案(1)|浏览(179)

我创建了一个Azure Function应用(Linux),运行在应用服务计划Y1上,并在Azure DevOps Git中拥有我的源代码。函数是在DOTNET 6上用C#编写的。
下面你可以看到我对CI的YAML定义和一个单独的CD管道。当我执行管道时,一切都运行良好(两者都是绿色)。然而,部署后,这是我的Azure门户在Functions刀片中的外观:

使用VS代码Azure扩展并查看函数应用程序的文件,我得到:

当我查看CI管道的工件时,一切看起来都很好(下载zip的资源管理器视图):

bin-文件夹将填充到此处。
一些要点:

  • 我在函数应用程序中没有插槽。
  • 部署在关联的App Insights中可见。
  • 我的参考点是Microsoft Learn

那么,在VS代码中搜索时得到404是正常的吗?有人经历过类似的事情吗?甚至知道解决方案吗?
旁注:
我曾经使用VS代码部署我的函数,并安装扩展。今天我在部署后收到一个奇怪的错误消息:

CI YAML

pool:
    vmImage: 'ubuntu-latest'

trigger: none

variables:
    - name: 'Solution'
      value: '**/MyProject.sln'
    - name: 'ProjectFilter'
      value: '**/*.csproj'    
    - name: 'BuildConfiguration'
      value: 'Release'

steps:   
    - task: UseDotNet@2
      displayName: Use DotNet 6
      inputs:
          version: '6.0.x'
    - task: DotNetCoreCLI@2
      displayName: Restore
      inputs:
          command: restore
          projects: '$(ProjectFilter)'
    - task: DotNetCoreCLI@2
      displayName: Build
      inputs:
          projects: '$(ProjectFilter)'
          arguments: '--no-restore --configuration $(BuildConfiguration)'    
    - task: DotNetCoreCLI@2
      displayName: Publish Image Converter
      inputs:
          command: publish
          projects: src/Functions/**/MyProject.csproj
          publishWebProjects: false
          arguments: '--no-restore --no-build --configuration $(BuildConfiguration) --output $(Build.DefaultWorkingDirectory)/function_publish_output'
          zipAfterPublish: false
    - task: ArchiveFiles@2
      displayName: Archive Image Converter
      inputs:
          rootFolderOrFile: '$(Build.DefaultWorkingDirectory)/function_publish_output'
          includeRootFolder: false
          archiveFile: '$(Build.ArtifactStagingDirectory)/MyProject.zip'
    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifact'
      inputs:
          PathtoPublish: '$(Build.ArtifactStagingDirectory)'
      condition: succeededOrFailed()

CD YAML

variables:
  - name: 'vmImageName'
    value: 'ubuntu-latest'
  - name: 'serviceConnectionName'
    value: 'MYCONN'
  - name: 'project'
    value: 'MYPROJECT'

resources:
  pipelines:
    - pipeline: ci
      source: 'NAMEOFCI'
      trigger: true

pool:
  vmImage: $(vmImageName)

trigger: none

stages:
  - stage: Production
    displayName: Production
    jobs:
      - deployment: Deploy
        displayName: 'Deploy'
        environment: 'Production'
        pool:
          vmImage: $(vmImageName)
        strategy:
          runOnce:
            deploy:
              steps:
                - download: ci
                  displayName: 'Download Artifact'
                  artifact: drop
                - task: AzureFunctionApp@1
                  displayName: 'Deploy Image Converter Function'
                  inputs:
                    azureSubscription: '$(serviceConnectionName)'
                    appType: functionAppLinux
                    appName: 'fapp-**********-prod'
                    package: '$(Pipeline.Workspace)/ci/drop/MyProject.zip'
                    runtimeStack: 'DOTNET|6.0'
pkmbmrz7

pkmbmrz71#

您可以检查您在文件系统上看到的具体内容吗?您可以使用控制台或高级工具:

相关问题