Azure-functions-core-tools: Clarify 'func pack'

Created on 21 Mar 2019  路  7Comments  路  Source: Azure/azure-functions-core-tools

Running func pack seems to be the only way to replicate what func azure functionapp publish does to get a .zip file ready to deploy (for example in Azure DevOps pipelines).

However, func pack is not documented anywhere as far as I can see, mostly mentioned in random GitHub issues or ending up looking at azure-functions-pack (aka funcpack) which seems to be a deprecated webpack recipe, eg. not relevant.

My question is if func pack is the recommended way to pack (Python) Function Apps and if so, is it documented anywhere? For example, I would like to choose the name for the .zip myself.

If func pack is not the recommended way to produce a deployable .zip, what is the recommended way?

Python

Most helpful comment

we should add it to the docs. The only reason I didn't was because I wasn't sure about the name pack due to the possible confusion with that other tool you linked to above.

All 7 comments

@asavaritayal to comment

@matiaslahticgi can you elaborate on the requirement for your scenario?

So far, func pack has only been an internal facing utility. It would be helpful to understand if there are any cases where the user directly needs to interact with the command. For devops, we generally recommend using the pipeline here - https://github.com/Azure/azure-functions-devops-build/blob/master/sample_yaml_builds/linux/consumption/python-consumption.yml

Well, I would like to have a single, self-updating and correct way of building the package rather than copypasting a template to the pipeline that then needs to be kept up to date (eg. will definitely go out of date at some point, causing builds to fail etc)..

Does func pack, then, essentially just do what the build template does, eg:

dotnet restore # COMMENT OUT IF NOT USING FUNCTION EXTENSIONS
dotnet build --runtime ubuntu.16.04-x64 --output './bin/' # COMMENT OUT IF NOT USING FUNCTION EXTENSIONS
python3.6 -m venv worker_venv
source worker_venv/bin/activate
pip3.6 install setuptools
pip3.6 install -r requirements.txt

And what is the difference to this when running func pack --build-native-deps (we're using this currently to push in binary wheels)?

All in all I find the build process rather opaque which is a bit problematic when the use case is something more complex than what the starter tutorials involve, especially when it relates to handling Python modules and interfacing with other, non-Python libraries. Documenting it would be an awesome start, as currently all my knowledge of it comes from inspecting scripts, inspecting temporary files etc.

we should add it to the docs. The only reason I didn't was because I wasn't sure about the name pack due to the possible confusion with that other tool you linked to above.

Any updates here?

We'd like to use func pack as the packaging piece of the lifecycle for the Azure Functions plugin to the Serverless Framework.

This, in conjunction with https://github.com/Azure/azure-functions-core-tools/issues/1589 would be of great value to our team

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nzthiago picture nzthiago  路  3Comments

Mikey032 picture Mikey032  路  3Comments

buragc picture buragc  路  6Comments

jerimiahwelch picture jerimiahwelch  路  4Comments

SteveALee picture SteveALee  路  4Comments