0
votes

I've created my pipeline in Azure DevOps for my Azure Functions project. The first interesting problem is the release is not starting when there is a new build ready. I can't understand why.

Artifact

I can fire the release manually using the build I have just created.

enter image description here

How you can see, the release has success. The pipeline is like that:

steps:
- task: AzureFunctionApp@1
  displayName: 'Deploy Azure Function App'
  inputs:
    azureSubscription: '$(Parameters.AzureSubscription)'
    appType: '$(Parameters.AppType)'
    appName: '$(Parameters.AppName)'

Pipeline

With Kudu I can inspect the wwwroot folder on the server and I find, as I expected, all binary files for this function. The problem is, there is no functions available in the portal and I can call them.

Kudu

How you can see in the Azure Portal there is not functions available.

Azure Portal

Update

I have just noticed there is not the right structure on the file system from the release. I think I did something wrong in the configuration of the pipeline: I select :

  • Path to project(s): **/*.csproj
  • Arguments: -o publish_output (to create the build in the publish_output folder)

dotnet build

Then I create the zip to deploy in the release with this parameters:

  • Root folder or file to archive: $(System.DefaultWorkingDirectory)/publish_output

archive

PS: what is the difference between System.ArtifactsDirectory and Build.ArtifactStagingDirectory?

2
Hi Glad to hear you fixed it. And thanks for sharing your solution. You can accept your answer.Levi Lu-MSFT

2 Answers

0
votes

the release is not starting when there is a new build ready.

You probably didnot enable the Continuous deployment trigger. See below screen to enable CD trigger for your release pipeline.

enter image description here

in the Azure Portal there is not functions available

Azure functions require a specific folder structure to allow the functions to show in Azure portal. You can check if the folder structure in the /wwwroot folder looks like below. See document here for more information.

| - bin
 | - MyFirstFunction
 | | - function.json
 | - MySecondFunction
 | | - function.json
 | - host.json
0
votes

I fixed it. In the Archive step, I must uncheck Prepend root folder name to archive paths (I didn't read this option because it was as default and I didn't pay attention).

  • Root folder or file to archive: $(System.DefaultWorkingDirectory)/publish_output
  • Uncheck Prepend root folder name to archive paths
  • Archive file to create: $(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip
steps:
- task: ArchiveFiles@2
  displayName: 'Archive (zip)'
  inputs:
    rootFolderOrFile: '$(System.DefaultWorkingDirectory)/publish_output'
    includeRootFolder: false
    archiveFile: '$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip'

In the step Publish Artifact: drop check:

  • Path to publish: $(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip
steps:
- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: drop'
  inputs:
    PathtoPublish: '$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip'

Archive zip