projectkudu / kudu

Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Azure App Service on Linux, Kudu build fails after automatic PLATFORM_VERSION change, PATH variables missing

Joe-JJ opened this issue · comments

The Issue

I have been deploying a Node JS Angular App to App Services using Local Git from PowerShell and it has been working fine until last weekend. I have tried a handful of things to rectify the git push and Kudu build process but the failure continues. For some reason I had saved the Application Settings from the week before. When I compared that settings with the current, I can see that the PLATFORM_VERSION have changed and also the PATH variables are missing donet related directory paths. These changes where not made by me.

Project structures.

Local Node Js version v16.1.0 and npm 7.19.0.
Local Git run from PowerShell
Azure App Service, Linux Plan, Node Js version 14-lts.

Application Settings and PATH from the week before:

PLATFORM_VERSION = 94.0.7.109
PATH = /home/site/deployments/tools:/opt/Kudu/Scripts:/usr/bin:/usr/bin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/opt/dotnet/2.2:/usr/local/.rbenv/bin:/usr/local:/opt/oryx:/opt/nodejs/lts/bin:/opt/dotnet/lts:/opt/python/latest/bin:/opt/php/lts/bin:/opt/php-composer:/opt/yarn/stable/bin:/opt/hugo/lts:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.dotnet/tools:/opt/nodejs/9/bin

Application Settings current:

PLATFORM_VERSION = 95.0.7.554 
PATH = /home/site/deployments/tools:/opt/Kudu/Scripts:/usr/bin:/usr/bin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/.rbenv/bin:/usr/local:/opt/oryx:/opt/nodejs/lts/bin:/opt/dotnet/lts:/opt/python/latest/bin:/opt/php/lts/bin:/opt/php-composer:/opt/yarn/stable/bin:/opt/hugo/lts:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/nodejs/9/bin

We can see that the recent platform version is missing both /opt/dotnet/2.2 and /root/.dotnet/tools in its PATH
Now taking into account that the git push and Kudu build failure below indicates a missing command or file, I suspect that the PLATFORM_VERSION version change is the culprit.

The log/error given by the failure:

PS > git push
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 212 bytes | 212.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Could not execute because the specified command or file was not found.
remote: Possible reasons for this include:
remote:   * You misspelled a built-in dotnet command.
remote:   * You intended to execute a .NET Core program, but dotnet-/opt/Kudu/KuduConsole/kudu does not exist.
remote:   * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
To https://xxxxx.scm.azurewebsites.net/xxxxx.git

##What I have tried:
I have tried to modify the Environment PATH variables by adding PATH=$PATH:/opt/dotnet/2.2:/root/.dotnet/tools; export PATH , first to ~/.bash_profile, it did not help, then to ~/.bashrc, it did not make any difference either. I have to mention that these Application Settings are also set: SCM_DO_BUILD_DURING_DEPLOYMENT = false and DISABLE_HUGO_BUILD = true. It seems the files bash_profile and bashrc are never read when I restart the the App Service or Stop and restart the App Service, which I have done a couple of times. This is a shared platform so I cannot reboot, so the bash_profile can be read. I have also changed the PLATFORM_VERSION back to 94.0.7.109, it did not help, the PATH variables remain unchanged.

Anyone here who can give me a hint on how to resolve this issue? I still strongly suspect the missing PATH variable /root/.dotnet/tools which Kudu is asking for to be the missing puzzle, but I don't know how to force it into the build environment.

Observations

The details described in the issue submission about change in platform, remains the cause of the problem, as far as I have observed.
It seems that the change in platform version created a mismatch between the files already deployed and the new pushed files. And it is most likely that Kudu-git stores some meta-data of the platform in its manifest, hence the failure to build a new push. I might be wrong here, in that case I stand corrected or you guys need to look into that.

Solution for others

To resolve the conflict, create a newui in your Kudu deploy URL, e.g. https://xxxx.scm.azurewebsites.net/newui.
From this page, open bash terminal and remove everything inside your home directory with rm or open the file-manager and delete all files/folders inside home.
Do a new git commit and push, your App will deploy correctly. It seems this clears all your previous deployments. Works well for a deployment Repo, it will be a disaster if it were a source code Repo.

Hi

If the problem persists and is related to running it on Azure App Service, please open a support incident in Azure:
https://learn.microsoft.com/en-us/azure/azure-portal/supportability/how-to-create-azure-support-request

This way we can better track and assist you on this case

Thanks,

Joaquin Vano
Azure App Service