microsoft / azure-gradle-plugins

Azure Plugins for Gradle
MIT License
45 stars 28 forks source link

Why local.settings.json is needed for task azureFunctionsPackageZip? #76

Open Tynamix opened 3 years ago

Tynamix commented 3 years ago

If i get this correct, the zipped function package must not include the local.settings.json file to work.

If i try to run the task azureFunctionsPackageZip without having a local.settings.json file, i get this error:

Execution failed for task ':azureFunctionsPackage'.
> Cannot package functions due to error: Cannot find file: C:\Users\[...]\local.settings.json, please check the document at https://aka.ms/functions-local-settings

Our buildserver which will create the packaged zip as artifact must have a dummy local.settings.json file which will not included at the end if i understand this line of code correctly:

https://github.com/microsoft/azure-gradle-plugins/blob/ecb2238882e76eb18b3e416e7ec5f5df58c82555/azure-functions-gradle-plugin/src/main/java/com/microsoft/azure/plugin/functions/gradle/task/PackageZipTask.java#L52

Why is this file mandatory than?

Background: The local.settings.json file is added to .gitignore but because of this gradle task it must generate a dummy local.settings.json, just to make the build work

andxu commented 3 years ago

local.settings.json is required for local run, but the zip file uploaded to azure will not be allowed to contain this file(the name indicates that), the package goal is for goal: deploy and local run, so it requires that file. if you don't want to local run your functions, you can create an empty json for local.settings.json()

javafrog commented 3 years ago

I think it's understandable that it is required for execution of a function:

However, if I just want to compile an artifact (for later deployment to the cloud), there should not be the need for an (empty) configuration file.

andxu commented 3 years ago

Will remove the limit to have localsettings.json in new releases