SCM_DO_BUILD_DURING_DEPLOYMENT is set to false explicitly by Azure Cli
Asked Answered
H

4

7

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?

Happ answered 14/10, 2020 at 12:26 Comment(0)
C
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.

Cribble answered 14/10, 2020 at 15:28 Comment(3)
I am using the latest Azure Cli docker container (v 2.13.0). Is not supposed to be fixed there?Happ
Can you try rolling back to these versions once? So that it can be confirmed if it's an update or something else.Cribble
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.Happ
S
0

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

Sharyl answered 5/5, 2021 at 6:23 Comment(2)
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=trueRochelle
Those are PowerShell script used to set environment variable, I think he sets the env var before running Azure CLIEarthstar
R
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

Rochelle answered 17/11, 2021 at 4:45 Comment(0)
U
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

Unless answered 18/3, 2022 at 18:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.