2

We have a durable function that executes multiple processing steps in a specific order, using the Function Chaining pattern.

Since the Function App has 2 clients, 2 orchestrators and multiple activities, the folder structure of our solution is as shown in the screenshot below

Folder Structure in Solution

Since all of our code is in a Git Repo in Azure DevOps, we use a CI/CD process with Azure Pipelines, to build the solution for every new PR created, and after a new version of the development branch is created, we have a release pipeline that should continuously deploy the new version to our staging environment in Azure.

The build pipeline looks like this:

variables:
- name: BuildConfiguration
  value: Release

trigger:
  branches:
    include:
    - main
    - develop

pool:
  vmImage: windows-latest

jobs:
- job: 'CI_Job'
  displayName: 'Build and Publish Function App'
  continueOnError: false

  steps:
  - checkout: self
    clean: true
    
  - task: UseDotNet@2
    displayName: 'Install .NET SDK'
    inputs:
      packageType: 'sdk'
      version: '6.x'

  - task: DotNetCoreCLI@2
    displayName: 'Restore NuGet Packages'
    inputs:
      command: 'restore'
      projects: '**/*.csproj'

  - task: DotNetCoreCLI@2
    displayName: "Build Solution"
    inputs:
      command: 'build'
      projects: '**/*.csproj'
      arguments: '--configuration $(BuildConfiguration) --no-restore'


  - task: DotNetCoreCLI@2
    displayName: "Run Unit Tests"
    inputs:
      command: 'test'
      projects: 'test/**/*Tests.csproj'
      arguments: '--no-restore'
      testRunTitle: 'Test Functions'

  - task: DotNetCoreCLI@2
    displayName: "Publish Solution"
    inputs:
      command: 'publish'
      projects: '**/*.csproj'
      publishWebProjects: false
      modifyOutputPath: false
      zipAfterPublish: true
      arguments: --configuration $(BuildConfiguration) --no-restore --no-build --output $(Build.ArtifactStagingDirectory)

  - task: PublishBuildArtifacts@1
    displayName: "Publish Build Artifacts"
    inputs:
      PathtoPublish: '$(Build.ArtifactStagingDirectory)'
      ArtifactName: '$(Build.Repository.Name)'
      publishLocation: 'Container'

The release pipeline looks like this:

CD Pipeline

The problem is, the deployment seems to run successfully (the logs dont show any erros and even in the Deployment Center in Azure everthings looks good), but there are no functions listed in the Function App in Azure after the deployment is done.

Functions in Azure Portal

What we have tried so far:

The release pipeline automatically sets the value WEBSITE_RUN_FROM_PACKAGE=1, we also checked that in the Azure portal to verify the value for this setting is as expected.

We also tried to execute a remote build by setting the value SCM_DO_BUILD_DURING_DEPLOYMENT=true in our appsettings in Azure.

When we deploy the Function App with a ZIP deployment from Visual Studio, everything works as expected.

We have another Function App that gets deployed to a deployment slot where the release pipeline does basically the same (except that it does deploy to a slot, not the Function App itself) where everything works fine. But we can't find the issue here.

So my question is what are we doing wrong or what are we not aware of?

Any advice would be highly appreciated!

5
  • 1
    This usually means that deployment package is either empty or corrupted. Could you check the contents of the artifact published by your build pipeline and see what's there? Commented Feb 9, 2023 at 15:18
  • 1
    Adding build pipeline would also help there. Commented Feb 9, 2023 at 15:19
  • @kamil-mrzyglod I downloaded the artifact created by the build pipeline, it containts all DLLs from the solution and the package dependencies, so it looks like it has everything thats needed. I'll add the build pipeline in the question. Commented Feb 9, 2023 at 15:23
  • @kamil-mrzyglod looking deeper into the artifact of the build pipeline, I found another ZIP file inside the ZIP file containing all the DLLs that contains the bin folder as well as the folders containing the function.json files. I guess that might be the problem. Commented Feb 9, 2023 at 15:37
  • @kamil-mrzyglod I could resolve the Issue by adjusting the dotnet publish task in the build pipeline to only publish the content inside the src folder. Thanks for your help, I might have taken a deeper look inside the artifact instead of only checking it briefly. Commented Feb 9, 2023 at 16:00

1 Answer 1

1

After taking a deeper look into the artifact created by the build pipeline I could resolve the issue.

Since the production code is in the src folder and the dotnet publish task was not restricted to only publish content inside that folder, I ended up getting a ZIP folder containing all the DLLs of the solution, and inside that another ZIP folder containing the function.json files as well as the bin folder.

After adjusting the dotnet publish task as follows

  - task: DotNetCoreCLI@2
    displayName: "Publish Solution"
    inputs:
      command: 'publish'
      projects: 'src/**/*.csproj'
      publishWebProjects: false
      modifyOutputPath: false
      zipAfterPublish: true
      arguments: --configuration $(BuildConfiguration) --no-restore --no-build --output $(Build.ArtifactStagingDirectory)

I had a much smaller artifact, containing only the function.json files for my functions (inside their corresponding folders) as well as the bin folder containing the other DLLs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.