I'm trying to do a deployment job using Kudu's zipdeploy API to my Azure Function App.
My Function App runtime is ~beta, it contains several Java functions
The API I'm suing is :
https://function-extension-demo.scm.azurewebsites.net/api/zipdeploy?isAsync=true
By calling the pollable URL, I got the following result:
{
"id": "4bb6062fb70d4ea898b422747eb58256",
"status": 3,
"status_text": "",
"author_email": "N/A",
"author": "N/A",
"deployer": "Zip-Push",
"message": "Created via zip push deployment",
"progress": "",
"received_time": "2017-12-13T07:06:36.310784Z",
"start_time": "2017-12-13T07:06:37.1857772Z",
"end_time": "2017-12-13T07:06:40.7130135Z",
"last_success_end_time": null,
"complete": true,
"active": false,
"is_temp": false,
"is_readonly": true,
"url": "https://function-extension-demo.scm.azurewebsites.net/api/deployments/latest",
"log_url": "https://function-extension-demo.scm.azurewebsites.net/api/deployments/latest/log",
"site_name": "function-extension-demo"
}
But when I check my function app, it is not updated. Just like the deployment never occurred.
My deployment ZIP file:
javafunctions.zip
Another thing is that, this issue does not happen every time. I cannot find some condition when it will happen. But when it happens, the only thing I can do is to remove all the functions in the function app from protal, and then, deploy will be successful.
/cc @nickwalkmsft
What does the deployment log look like in the case where it doesn't update your files? And do you get the same behavior of you use the Kudu drag and drop UI under Tools / Zip Push Deploy?
Hi @davidebbo , thank you for your reply.
If I access https://function-extension-demo.scm.azurewebsites.net/api/deployments/latest/log, I will get:
{"Message":"An error has occurred.","ExceptionMessage":"No log found for 'latest'.","ExceptionType":"System.IO.FileNotFoundException","StackTrace":" at Kudu.Core.Deployment.DeploymentManager.GetLogEntries(String id)\r\n at Kudu.Services.Deployment.DeploymentController.GetLogEntry(String id)"}
But just at the moment, I tried again, and the issue cannot be reproed. As I said before, this issue does not always happening. So far I cannot find under what kind of condition it will happen.
I can try to using drag and drop next time I meet it and update here it when I have some new findings.
For now, any suggestions about what I can do to diagnostic it on my own side?
Hi @davidebbo
I can repro it now, and tried to use the Kudu drag and drop UI under Tools / Zip Push Deploy
here is the output:
Deployment Id : bfad17fd9306422aa3bd308271f47ba1
2017-12-15T03:07:33.1049771Z : Created via zip push deployment
2017-12-15T03:07:33.5112401Z : Updating submodules.
2017-12-15T03:07:33.8393848Z : Preparing deployment for commit id 'bfad17fd93'.
2017-12-15T03:07:34.6987633Z : Generating deployment script.
2017-12-15T03:07:35.1519074Z : Running deployment command...
And nothing happened after that.
Update:
screenshot:

The zip file I used to deploy:
gbasvxav.zip
Did you look at the log if you open the 'running deployment command' step? Just click on the + sign. Though it should say "Deployment successful" as the last step, so I'm thinking it is being interrupted somehow.
@davidebbo
Ah, I opened it and find the root cause:
Deployment Id : 7f35f95981e74294a1c35ed978f5ffef
2017-12-15T03:11:06.5450975Z : Created via zip push deployment
2017-12-15T03:11:06.9670078Z : Updating submodules.
2017-12-15T03:11:07.4982523Z : Preparing deployment for commit id '7f35f95981'.
2017-12-15T03:11:08.8811357Z : Generating deployment script.
2017-12-15T03:11:09.1155971Z : Using cached version of deployment script (command: 'azure -y --no-dot-deployment -r "D:\local\Temp\zipdeploy\extracted" -o "D:\home\site\deployments\tools" --basic --sitePath "D:\local\Temp\zipdeploy\extracted"').
2017-12-15T03:11:10.1502277Z : Running deployment command...
2017-12-15T03:11:10.1658463Z : Command: "D:\home\site\deployments\tools\deploy.cmd"
2017-12-15T03:11:10.90354Z : Handling Basic Web Site deployment.
2017-12-15T03:11:11.9471357Z : KuduSync.NET from: 'D:\local\Temp\zipdeploy\extracted' to: 'D:\home\site\wwwroot'
2017-12-15T03:11:11.994079Z : Error: Failed to change file that is currently being used "D:\home\site\wwwroot\function2-1.0-SNAPSHOT.jar"
2017-12-15T03:11:12.0408905Z : Deleting file: 'function2-1.0-SNAPSHOT.jar'
2017-12-15T03:11:12.0721382Z : Failed exitCode=1, command="kudusync" -v 50 -f "D:\local\Temp\zipdeploy\extracted" -t "D:\home\site\wwwroot" -n "D:\home\site\deployments\7f35f95981e74294a1c35ed978f5ffef\manifest" -p "D:\home\site\deployments\a71f284e29f14a1aabca4eeb1a3bf231\manifest" -i ".git;.hg;.deployment;deploy.cmd"
2017-12-15T03:11:12.1070521Z : An error has occurred during web site deployment.
2017-12-15T03:11:12.228394Z : Error: Failed to change file that is currently being used "D:\home\site\wwwroot\function2-1.0-SNAPSHOT.jar"\r\nD:\Program Files (x86)\SiteExtensions\Kudu\69.61204.3166\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
It is because the .jar file is being used.
I see. It's by design that it is failing, but clearly error handling could be improved to make it more obvious.
Just interested because it looks like js function do not need to stop the function app first before deployment. is that caused by the different design on the function server side?
That's probably because the Java runtime locks the war file, while Node never locks .js files. Closing here since everything is by design from Kudu standpoint. If a file is locked by the runtime and can't be copied, there is nothing Kudu itself can do.
Most helpful comment
Hi @davidebbo , thank you for your reply.
If I access https://function-extension-demo.scm.azurewebsites.net/api/deployments/latest/log, I will get:
But just at the moment, I tried again, and the issue cannot be reproed. As I said before, this issue does not always happening. So far I cannot find under what kind of condition it will happen.
I can try to using drag and drop next time I meet it and update here it when I have some new findings.
For now, any suggestions about what I can do to diagnostic it on my own side?