简体   繁体   中英

Get latest deployed git commit version in Azure App Service with GitHub deployment

I have an Azure App Service website built in ASP.NET Core which is being automatically deployed via GitHub integration. Every time I commit to a particular branch in GitHub, the app automagically deploys to my chosen App Service slot.

I would like the app to display the latest deployed git commit version and (optionally) the git commit comment. Is there some way I can get my app to retrieve this information about itself? I can't seem to find any useful information in the Environment Variables as it's running in Azure App Service (aside from " APPSETTING_ScmType ", which is set to " GitHub "). I suspect this information can be found (as it is displayed in the Azure Portal), I just don't know how to get at it.

If it helps, I'm running this on a Standard Plan, and testing this feature in a App Service Slot.

You can read the commit id from the file %home%\\site\\deployments\\active . See https://github.com/projectkudu/kudu/issues/1336 for more discussion on this topic.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM