I have a devops pipeline the builds a C# azure function then deploys to an existing Windows S1 app service plan.
The relevant pipeline tasks are shown below:
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: build
projects: ${{parameters.projectsToBuild}}
arguments: ' --configuration ${{parameters.buildConfiguration}} -p:Version="$(build.buildnumber)" -p:SourceRevisionId="$(sourceVersionShort)"'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
projects: ${{parameters.projectsToTest}}
arguments: --configuration ${{parameters.buildConfiguration}} --collect "Code coverage"
- task: DotNetCoreCLI@2
displayName: Publish
condition: ${{parameters.publishArtifacts}}
inputs:
command: publish
projects: |
${{parameters.projectsToBuild}}
!${{parameters.projectsToTest}}
arguments: '--configuration ${{parameters.buildConfiguration}} --output $(build.artifactstagingdirectory) --no-build'
publishWebProjects: false
zipAfterPublish: true
- task: PublishBuildArtifacts@1
displayName: Publish to DevOps
condition: ${{parameters.publishArtifacts}}
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: "${{parameters.artifactName}}"
publishLocation: Container
After the zip has been published as a pipeline artifact, it is deployed with the following task:
- task: AzureFunctionApp@1
displayName: Deploy Az Func
inputs:
azureSubscription: sub-name-here
resourceGroupName: rg-name-here
appName: app-name-here
appType: functionApp
package: ${{variables.packagePath}}
deploymentMethod: runFromPackage
After the pipeline has completed, the functions have not deployed into the function app. On looking into the function app logs via kudu, I see the following:
<Event>
<System>
<Provider Name="ZipFS"/>
<EventID>0</EventID>
<Level>1</Level>
<Task>0</Task>
<Keywords>Keywords</Keywords>
<TimeCreated SystemTime="2023-04-26T14:00:04Z"/>
<EventRecordID>1163925125</EventRecordID>
<Channel>Application</Channel>
<Computer>compnamehere</Computer>
<Security/>
</System>
<EventData>
<Data>ZIP_SUPPORT::OpenZipFile(905): Failed to read central dir file header due to signature mismatch (Path:"\\?\d:\local\SitePackages\1163635875.zip" Err:0x8007026a)</Data>
</EventData>
</Event>
The relevant app settings values of the function app are:
{
"name": "AzureWebJobsStorage",
"value": "constring is here",
"slotSetting": false
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~4",
"slotSetting": false
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet-isolated",
"slotSetting": false
},
{
"name": "WEBSITE_ENABLE_SYNC_UPDATE_SITE",
"value": "true",
"slotSetting": false
},
{
"name": "WEBSITE_RUN_FROM_PACKAGE",
"value": "1",
"slotSetting": false
}
I have manually downloaded the zip file from the devops artifacts. I was able to unzip no problem, and it contains the .net files I'd expect.
Any ideas what's causing the Failed to read central dir file header due to signature mismatch error?
Will probably never know why I get the zip signature error when usng the AzureFunctionApp@1 task. However, using the tip from @SiddheshDesai, I have a work-around using the AzureCLI@2 task:
- task: AzureCLI@2
displayName: 'Deploy Az Func using Azure CLI'
inputs:
azureSubscription: 'devops-intg-nurseryfees-nonprod-dev-001'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
echo "Pipeline.Workspace: $(Pipeline.Workspace)"
ls -R $(Pipeline.Workspace)
az functionapp deployment source config-zip \
--resource-group rg-intg-nurseryfees-dev-001 \
--name func-intg-nurseryfees-dev-001 \
--src $(Pipeline.Workspace)/dotnet/AzFunc.zip