Closed aaronhoffman closed 8 years ago
I think too many things are getting raised in this one issue. Can we simplify and start with just: how to successfully run a Post Deployment action, leaving the details of what you do in that action off the table?
Yes, that would be fine.
What is the preferred method of running custom scripts as a post deployment action? If it is by placing the scripts in the /site/deployments/tools/PostDeploymentActions
directory, what is the best way to debug an issue if those do not appear to be running?
Start simple. e.g.
site\deployments\tools\PostDeploymentActions
, create a simple foo.cmd
containing just echo hello
In the deployment details, you should see something like this:
And if you click View Logs, you'll see the output of the batch file.
Does that work for you?
Are scripts within the site\deployments\tools\PostDeploymentActions
directory only activated on a git deployment? If so, that could be the issue, we are using webdeploy.
Are any Post Deployment Action hooks available for webdeploy?
Yes, this only happen during Kudu based deployments. msdeploy works quite differently. Unfortunately, at this time there is no great equivalent for msdeploy.
Hi,
I am facing same issue as stated above. I am using TFS source control and visual studio online 2015 for continuous integration(build definition). In build definition deploying package on app service using : Azure Deployment task.
I have a post-build event action set up in Visual Studio for my web project that takes the current git hash for HEAD and stores it in a local file called version.txt at the root of the web project.
On a successful deployment to Azure, I would like the contents of the version.txt file (the git hash) to become an environment variable with key
CURRENT_VERSION
.I have tried two methods and they both do not appear to be working, but I am also having difficulty debugging them.
/site/deployments/tools/PostDeploymentActions
directory as this wiki states https://github.com/projectkudu/kudu/wiki/Post-Deployment-Action-Hooks. I had to create thePostDeploymentActions
folder myself as it did not already exist, and those scripts do not appear to be being run (I am not aware of where the deployment logs are stored that that wiki page references to verify). I assume they are not running because one of the scripts I tried, namedaaron.cmd
, contained one lineSET CURRENT_VERSION=HELLO
and I am attempting to verify that envar was set by using the debug console https://myapp.scm.azurewebsites.net/DebugConsole. If I executeecho %WEBJOBS_STOPPED%
I get a value (that is being set via the portal app settings page), but if I executeecho %CURRENT_VERSION%
, I get nothing.I verified that the aaron.cmd file was being deployed to the app service. I even manually executed the aaron.cmd file via the DebugConsole to ensure that it could run without error and it did (and afterward performing an
echo %CURRENT_VERSION%
returnedHELLO
)I have not tried the method described here: https://azure.microsoft.com/en-us/blog/new-azure-web-sites-feature-configurable-environment-variables-2/ but I wasn't sure I could use an XDT transform to read the contents of a file...
What would be the recommended way to get the contents of the version.txt file to be set as an environment variable using a post deployment hook? (thinking about just dropping something in the
startup
of the web project, but I'd prefer not to have to do that)