I've been successfully using Git deploy (via Kudu) to a couple of Azure websites (e.g., beta/prod) for several months, and it's worked quite well. Starting today, I noticed that when I push to the appropriate respective git branch to my beta website - but not to my production website - the deploy fails, with an "Unknown Error" in the console, and no errors of any sort in the deployment logs. Again, exactly the same deployment works to my production server, and I haven't changed anything on my beta server in-between when the deploys stopped working.
So far as I can tell from the logs, it's failing at this point in my deploy.cmd:
:: 1. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\Payboard.Web\Payboard.Web.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
) ELSE (
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\Payboard.Web\Payboard.Web.csproj" /nologo /verbosity:m /t:Build /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
)
IF !ERRORLEVEL! NEQ 0 goto error
This is the sort of thing that I'd normally contact Azure support for, but my subscription doesn't include tech support :-(. The Azure site recommends asking here on SO, and hence my post.
I've stopped and restarted the website, and poked around with the truly handy KuduConsole, but other than that, I'm kind of out of ideas.
Any suggestions for further troubleshooting this?
Related
I am trying to set ci/cd from github to azure functions
I created an Azure function project in git "https://github.com/AmitayStrijevski/AppFunctionTest".
I published it once through the visual studio and it worked perfect.
Then i connected it to the github ci/cd described here
"https://learn.microsoft.com/en-us/azure/azure-functions/functions-continuous-deployment#continuous-deployment-requirements".
When pushing to git i can see it takes my code and "deploy" it but when i look at the the functions my new code is not there and the logs show the following message
"Found solution 'D:\home\site\repository\HeyArnold\HeyArnold.sln' with no deployable projects. Deploying files instead."
I spent more than a day on this and i will really appreciate help in this issue
I was able to use the github deployment when using an empty web site and setting the same folder structure generated by the azure portal
This is still not solve my problem because i want to use Azure function project but i thought worth mentioning
Check out <functionappname>.scm.azurewebsites.net/dev to see what files are actually deployed to the wwwroot folder.
I took a look at your github project and I noticed a few things: if you're using .cs files, you should be creating a precompiled function, which you can deploy directly from VS.
However, if you're instead using .csx files and want to be able to edit code from the functions portal, the structure you have is correct - just remove the solution and csproj files, as I believe they are confusing the deployment infrastructure
After consulting with Microsoft support i recevied two files that needed to be put in the .sln folder and then git deployment will work
Be aware changing lines
:: 1. Restore nuget packages
:: 2. Build and publish
With your solution and project actual name
.deployment
[config]
command = deploy.cmd
deployment.cmd
#if "%SCM_TRACE_LEVEL%" NEQ "4" #echo off
:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.15
:: ----------------------
:: Prerequisites
:: -------------
:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
goto error
)
:: Setup
:: -----
setlocal enabledelayedexpansion
SET ARTIFACTS=%~dp0%..\artifacts
IF NOT DEFINED DEPLOYMENT_SOURCE (
SET DEPLOYMENT_SOURCE=%~dp0%.
)
IF NOT DEFINED DEPLOYMENT_TARGET (
SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)
IF NOT DEFINED NEXT_MANIFEST_PATH (
SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest
IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
)
)
IF NOT DEFINED KUDU_SYNC_CMD (
:: Install kudu sync
echo Installing Kudu Sync
call npm install kudusync -g --silent
IF !ERRORLEVEL! NEQ 0 goto error
:: Locally just running "kuduSync" would also work
SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------
echo Handling function App deployment with Custom script.
:: 1. Restore nuget packages
call :ExecuteCmd nuget.exe restore "%DEPLOYMENT_SOURCE%\FunctionAppVS2017_3Preview.sln" -MSBuildPath "D:\Program Files (x86)\MSBuild-15.3-preview\MSBuild\15.0\Bin"
IF !ERRORLEVEL! NEQ 0 goto error
:: 2. Build and publish
call :ExecuteCmd "D:\Program Files (x86)\MSBuild-15.3-preview\MSBuild\15.0\Bin\MSBuild.exe" "%DEPLOYMENT_SOURCE%FunctionApp1\FunctionApp1.csproj" /p:DeployOnBuild=true /p:configuration=Release /p:publishurl="%DEPLOYMENT_TEMP%" %SCM_BUILD_ARGS%
IF !ERRORLEVEL! NEQ 0 goto error
:: 3. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_TEMP%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
IF !ERRORLEVEL! NEQ 0 goto error
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
goto end
:: Execute command routine that will echo out when error
:ExecuteCmd
setlocal
set CMD=%*
call %CMD%
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%CMD%
exit /b %ERRORLEVEL%
:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul
:exitSetErrorLevel
exit /b 1
:exitFromFunction
()
:end
endlocal
echo Finished successfully.
I'm using VSTS rather than GitHub but you might still find this link here of use.
Using the tooling extension for Azure Functions in VS2017 Preview, along with the build steps described in this issue I've been able to get this CI pipeline going with an Azure functions project. Josh Carlisle has detailed the steps to get this up and running on his blog.
You can add a .deployment-file to the root of your repository and point Azure, and Kudu, to the correct project-path:
[config]
project = src/PathToYourProject
Or you can add a Application settings in the Azure Portal with the key PROJECT and the value pointing to the correct project-path.
When I deploy my repository from bitbucket, I get the following error,
Handling .NET Web Application deployment.
The system cannot find the file specified.
Failed exitCode=1, command=nuget restore "D:\home\site\repository\MySolution.sln"
An error has occurred during web site deployment.
I have a .deployment file on the root of the repo with the following contents
[config]
command = deploy.cmd
I also have a deploy.cmd file on the root and will fail at the following line for some reason
echo Handling .NET Web Application deployment.
:: 1. Restore NuGet packages
IF /I "MySolution.sln" NEQ "" (
call :ExecuteCmd nuget restore "%DEPLOYMENT_SOURCE%\MySolution.sln"
IF !ERRORLEVEL! NEQ 0 goto error
)
Why can Azure not find my solution file? Even using FTP I can see the solution file at the root of the repository...
Turns out it was because I was using encrypted password in my NuGet.config for my private nuget server, I switched to Plaintext and it worked!
I've been trying out the new Remote Debugging feature for Azure Websites, but I think I may have come across an issue: I can only get it to work properly if I use Web Publish. If I deploy a site with local git deploy, the debugger attaches but the debug symbols aren't loaded (breakpoints show the warning).
I tried both setting the Release configuration to include PDB files (since Azure's git deploy uses the Release configuration by default) and by using a custom deploy script generated by the azure site deploymentscript command detailed here and setting the build command to use the Debug configuration. In both cases, I still get the same issue that the symbols aren't loaded.
I feel like the problem is probably one of the following:
Azure runs some sort of custom action after a Web Publish that must be run in order to allow remote debugging
The build options used by the git deployment scripts are missing some sort of flag that's causing PDB output to not be present for the web application (I don't think this one is likely)
Azure is not honoring the Configuration I use in the deployment script when the site is actually running and compiled on-demand
Ultimately I'm hoping to write some automated deployment scripts and I'd much rather use git deployment than Web Publish to accomplish this. What really baffles me is that this fails even with the Release configuration set to include the PDB files. It really makes me think there must be something extra being done on Azure for Web Publish that's not done for git deployment. Does anyone have any ideas of what may be causing the difference here?
Custom Git Deployment Script
I'm including the custom deployment script generated by azure site deploymentscript for reference and to show the build flags it uses. The relevant parts are after the :: Deployment section.
#if "%SCM_TRACE_LEVEL%" NEQ "4" #echo off
:: ----------------------
:: KUDU Deployment Script
:: Version: 0.1.5
:: ----------------------
:: Prerequisites
:: -------------
:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
goto error
)
:: Setup
:: -----
setlocal enabledelayedexpansion
SET ARTIFACTS=%~dp0%..\artifacts
IF NOT DEFINED DEPLOYMENT_SOURCE (
SET DEPLOYMENT_SOURCE=%~dp0%.
)
IF NOT DEFINED DEPLOYMENT_TARGET (
SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)
IF NOT DEFINED NEXT_MANIFEST_PATH (
SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest
IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
)
)
IF NOT DEFINED KUDU_SYNC_CMD (
:: Install kudu sync
echo Installing Kudu Sync
call npm install kudusync -g --silent
IF !ERRORLEVEL! NEQ 0 goto error
:: Locally just running "kuduSync" would also work
SET KUDU_SYNC_CMD=node "%appdata%\npm\node_modules\kuduSync\bin\kuduSync"
)
IF NOT DEFINED DEPLOYMENT_TEMP (
SET DEPLOYMENT_TEMP=%temp%\___deployTemp%random%
SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
)
IF DEFINED CLEAN_LOCAL_DEPLOYMENT_TEMP (
IF EXIST "%DEPLOYMENT_TEMP%" rd /s /q "%DEPLOYMENT_TEMP%"
mkdir "%DEPLOYMENT_TEMP%"
)
IF NOT DEFINED MSBUILD_PATH (
SET MSBUILD_PATH=%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------
echo Handling .NET Web Application deployment.
:: 1. Restore NuGet packages
IF /I "azure-test.sln" NEQ "" (
call "%NUGET_EXE%" restore "%DEPLOYMENT_SOURCE%\azure-test.sln"
IF !ERRORLEVEL! NEQ 0 goto error
)
:: 2. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\azure-test\azure-test.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Debug /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
) ELSE (
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\azure-test\azure-test.csproj" /nologo /verbosity:m /t:Build /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=Debug /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
)
IF !ERRORLEVEL! NEQ 0 goto error
:: 3. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
call %KUDU_SYNC_CMD% -v 50 -f "%DEPLOYMENT_TEMP%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
IF !ERRORLEVEL! NEQ 0 goto error
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Post deployment stub
call %POST_DEPLOYMENT_ACTION%
IF !ERRORLEVEL! NEQ 0 goto error
goto end
:error
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul
:exitSetErrorLevel
exit /b 1
:exitFromFunction
()
:end
echo Finished successfully.
Update 2/8/2014
Some fixes were made in WAWS, and it is now possible to make debugging work when using git, by having VS correctly load the server-side PDBs. For it to work, you need to do one of two things (i.e. you don't need to do both). It can work in both VS 2012 and 2013.
Turn off Just My Code debugging: just turn off that setting in the VS debugger settings and try debugging your Azure Web Site.
Build in Debug mode: to do that on the server build, you can go to the Azure Portal and add an ApSetting called SCM_BUILD_ARGS, with value -p:Configuration=Debug (more details here). Then go to the Deployments page and hit the Redeploy button (for the current deployment). Then attach from VS and it should all work!
Original answer
Indeed, this doesn't work today, and we're trying to see how we could make it work. At the root, the problem appears to be the Visual Studio debugger expects to find the PDBs on the client, while in the git case they only exist on the server.
This article discusses changes to how the debugger works between 2010 and the newer versions, and that probably affects things.
More investigation needed, but this is the state of things right now.
I was having this problem with a .Net Core Azure Function project, using the Cloud Explorer right-click functionality to attach. The following github issue speaks to it, but solution didn't solve my problem:
https://github.com/Azure/Azure-Functions/issues/872
I finally stumbled across the answer here:
http://dontcodetired.com/blog/post/Remote-Debugging-Azure-Functions-V2-The-breakpoint-will-not-currently-be-hit-No-symbols-have-been-loaded-for-this-document
It boils down to manually attaching to the process in Azure, rather than relying on the Cloud Explorer right-click functionality.
Description
We are in a current project based on MVC4/Umbraco using Azure Websites to host it.
We are using SCM_BUILD_ARGS to change between different build setups depending on which site in Azure we deploy to (Test and Prod).
This is done by defining an app setting in the UI:
SCM_BUILD_ARGS = /p:Environment=Test
Earlier we used Bitbucket Integration to deploy and here this setting worked like a champ.
We have now switched to using Git Deployment, pushing the changes from our build server when tests have passed.
But when we do this, we get a lovely error.
"MSB1008: Only one project can be specified."
Trying to redeploy the same failed deployment from the UI on Azure works though.
After some trial and error I ended going into the deploy.cmd and outputting the %SCM_BUILD_ARGS% value in the script.
It looks like the / gets dropped from SCM_BUILD_ARGS but only when using Git deploy, not Bitbucket Integration or redeploy from UI.
Workaround
As workaround I have for now added a / to the deploy.cmd script in front of the %SCM_BUILD_ARGS%, but this of course breaks redeploy, since we then have //p:Environment=Test in the MSBuild command when the value of %SCM_BUILD_ARGS% has been inserted.
:: 2. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
:: Added / to SCM_BUILD_ARGS
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\www\www.csproj" [....] /%SCM_BUILD_ARGS%
) ELSE (
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\www\www.csproj" [....] /%SCM_BUILD_ARGS%
)
Question
Anyone know of a better solution for this problem or is it possibly a bug in Kudu?
We would love to have both deploy from Git and Redeploy working.
Could you try changing from "/" to "-"? For instance, AppSettings from /p:Environment=Test to -p:Environment=Test, see if it helps.
-p:Environment=Test did not work for me, the setting which worked for me at the time of this writing (September 2015) was
-p:Configuration=Test
There is clearly a Kudu bug in there, and you should open an issue on https://github.com/projectkudu/kudu. But for now, I can give you a workaround.
Instead of using an App Setting, include a .deployment file at the root of your repo, containing:
[config]
SCM_BUILD_ARGS = /p:Environment=Test
I think this will work in all cases. I suspect the bug has to do with bash messing up the environment in post receive hook scenarios, which only apply to direct git push but not to Bitbucket and Redeploy scenarios.
UPDATE: In fact, it's easy to see such weird bash behavior. Try this:
Open cmd.exe
Run: set foo=/abc to set a variable
Run bash
From bash, run cmd to launch a new cmd on top of bash (so cmd -> bash -> cmd)
Run set foo to get the value of foo
Result:
FOO=C:/Program Files (x86)/git/abc
So the value gets completely messed up. The key also gets upper cases, though that's mostly harmless. Strange stuff...
We've been having some issues with CCnet 1.5.7256.1 recently where some builds are running and failing but being reported as Successful builds. The build logs show the exception/failure status but the dashboard is still displaying green ticks and Success.
Obviously this is a concern as failed builds are going unnoticed.
Has anyone else had this problem?
I've posted on the ccnet-user google group here - http://groups.google.com.ag/group/ccnet-user/browse_thread/thread/4190a19b0fee57b3
give the errorlevel command to your builds.
if its a batch file give a command of finding errorlevel after every build command. This will return the cruise control failed status which will make the CC build status failed.
Command is:
If %Errorlevel% is neq 0 than exit /b errorlevel