5

I am using Azure Cli in Jenkins build to deploy my nodejs azure functions to azure. I need Kudu to build the npm packages to reduce the deployment time on Jenkins side.

I have SCM_DO_BUILD_DURING_DEPLOYMENT = true in Azure Functions configurations but Azure Cli explicitly set it to false while deploying the artifacts! So the application will be left out without node_modules folder.

I am using command similar to the following:

az functionapp deployment source config-zip --src artifacts.zip --resource-group MyGroup --subscription MySubscription --name MyFunction --slot pre

Any idea how to fix it?

Mori
  • 2,484
  • 5
  • 28
  • 45

4 Answers4

0

It seems that there was a similar issue with a version regression in the past. Check out the issue around this: https://github.com/Azure/azure-cli/issues/11246

You can install Azure CLI 2.0.77 or 2.0.75 using pip and see if this issue is vanished:

pip install azure-cli==2.0.75

May be, this is an issue with a latest update.

Harshita Singh
  • 4,590
  • 1
  • 10
  • 13
  • I am using the latest Azure Cli docker container (v 2.13.0). Is not supposed to be fixed there? – Mori Oct 14 '20 at 16:20
  • Can you try rolling back to these versions once? So that it can be confirmed if it's an update or something else. – Harshita Singh Oct 14 '20 at 19:16
  • Pipe caused some errors but I used `mcr.microsoft.com/azure-cli:2.0.77` and result was the same. There are 2 warning messages `Setting ENABLE_ORYX_BUILD to false` and `Setting SCM_DO_BUILD_DURING_DEPLOYMENT to false`. – Mori Oct 15 '20 at 09:24
0

Adding $env:SCM_DO_BUILD_DURING_DEPLOYMENT=true in my script solved this problem

Khyar Ali
  • 327
  • 2
  • 8
  • could you please explain the syntax you have used above? I am trying to understand how and where you set the value SCM_DO_BUILD_DURING_DEPLOYMENT=true – Nilushan Costa Nov 16 '21 at 17:00
  • 1
    Those are PowerShell script used to set environment variable, I think he sets the env var before running Azure CLI – Fahmi Noor Fiqri Jan 25 '22 at 07:48
0

I also faced this issue when using the az functionapp deployment source config-zip command. When this command is executed, the value of SCM_DO_BUILD_DURING_DEPLOYMENT set to true in the function app's application settings will be overridden and changed to false.

To prevent that, set the --build-remote flag to true.
E.g. az functionapp deployment source config-zip --src artifacts.zip --resource-group MyGroup --subscription MySubscription --name MyFunction --slot pre --build-remote true

https://learn.microsoft.com/en-us/cli/azure/functionapp/deployment/source?view=azure-cli-latest#az_functionapp_deployment_source_config_zip

Nilushan Costa
  • 286
  • 2
  • 6
  • 24
0

There is apparently also the option to include a .deployment file with the config in it.

See: https://learn.microsoft.com/en-us/azure/azure-functions/deployment-zip-push#deployment-customization

and: https://github.com/projectkudu/kudu/wiki/Customizing-deployments