Search code examples
azure-devopsazure-functionskudu

Azure Devops / Kudusync deploys wrong package to Azure Function


We have two Azure functions, let's call them A and B, that we deploy using Azure Devops. Looking at the deployment logs, first the right package is deployed followed by a deploy where the contents of Function App A are deployed to Function app B. How this happens is a mystery.

The strange things is, looking at the logs and what is inside Kudu, they don't match up. For example, the latest deploy logs will say this:

[
  {
    "log_time": "2021-09-17T10:57:17.3180234Z",
    "id": "",
    "message": "Command: \"D:\\home\\site\\deployments\\tools\\deploy.cmd\"",
    "type": 0,
    "details_url": null
  },
  {
    "log_time": "2021-09-17T10:57:18.5999063Z",
    "id": "",
    "message": "Handling Basic Web Site deployment.",
    "type": 0,
    "details_url": null
  },
  {
    "log_time": "2021-09-17T10:57:24.8723981Z",
    "id": "",
    "message": "Creating app_offline.htm",
    "type": 0,
    "details_url": null
  },
  {
    "log_time": "2021-09-17T10:57:24.9036384Z",
    "id": "",
    "message": "KuduSync.NET from: 'D:\\local\\Temp\\zipdeploy\\extracted' to: 'D:\\home\\site\\wwwroot'",
    "type": 0,
    "details_url": null
  },
  {
    "log_time": "2021-09-17T10:57:25.0941627Z",
    "id": "",
    "message": "Deleting file: 'OurCompany.Api.B.dll'",
    "type": 0,
    "details_url": null
  },
    "log_time": "2021-09-17T10:57:25.1557977Z",
    "id": "",
    "message": "Copying file: 'extensions.json'",
    "type": 0,
    "details_url": null
  },
  {
    "log_time": "2021-09-17T10:57:25.1718472Z",
    "id": "",
    "message": "Copying file: 'OurCompany.Api.A.dll'",
    "type": 0,
    "details_url": null
  },
  {
    "log_time": "2021-09-17T10:57:27.4441118Z",
    "id": "",
    "message": "Deleting app_offline.htm",
    "type": 0,
    "details_url": null
  },
  {
    "log_time": "2021-09-17T10:57:27.5223301Z",
    "id": "",
    "message": "Finished successfully.",
    "type": 0,
    "details_url": null
  }
]

But when I go to Kudu on the server of the OurCompany.Api.B function app and I look at the actual contents in D:\\local\\Temp\\zipdeploy\\extracted I see no OurCompany.Api.A.dll - only OurCompany.Api.B.dll. Note that the timestamp of the files in the extracted folder predate the second deployment, so they are from the first and CORRECT deploy.

If I look at the contents inside D:\\home\\site\\wwwroot I DO see the incorrect OurCompany.Api.A.dll but where this is coming from I have no idea.

So... how can the deploy logs mention the copying of incorrect dll files while they are not in the folder on the server, and never were there because the timestamps don't add up? We've been working on this issue for days now without succes.


Solution

  • Apparantly this is happening because both Functions are hosted on the same App Service plan and thus using the same Azure File Share. See this thread https://github.com/projectkudu/kudu/issues/3333.