Clone this repository to start building Azure Functions in Java.
You can deploy the bundle directly by creating the credentials needed to pass to the bundle and then installing the bundle.
- To view the bundle's parameter and credential requirements, you can type
porter explain --tag squillace/functions-java-hello:v0.5.5
- To generate your local copy of credentials needed to install the bundle, type
porter creds generate functions --tag squillace/functions-java-hello:v0.5.5
- To install the bundle, type
porter install -c functions --tag squillace/functions-java-hello:v0.5.5 --param resource_group=java-functions --param function_name=mytestfunction
To see the output of the install
action, type porter show azure-functions-java-hello
; the function's URL will be displayed along with the deployment log.
This bundle has a custom CNAB action called functions.java.hello.test
. To use the custom action, type porter invoke azure-functions-java-hello --action functions.java.hello.test --param test_url=$(porter show azure-functions-java-hello -o json | jq -r '.outputs.HOSTNAME') -c functions
. (This assumes that you have jq
installed; you might need to install it, or use another mechanism to capture and reuse the function's URL.)
You can begin using this bundle without cloning it locally by using the VS Online button, which will launch a VS Code online workspace and load up all the extensions and requirements to build and run the application and then build the CNAB bundle using Porter.
Alternatively, you can do this all yourself by cloning it to your organization, and then cloning locally and installing dependencies.
The following steps are necessary to use the repository with a local development environment:
Prerequisites:
java -version
should be OpenJDK version 11.0.6 or greater (to build the application)maven
installation (to build the application)porter
(from https://porter.sh) to build the bundle- a code editor of some form.
- git
Cloning, building, and pushing the application requires the following steps:
- clone the template repo by clicking on the
- add docker secrets to it
- git clone locally
- modify the invocationImage and tag registry names to yours
- build the app: mvn package
- test the app: F5 which launches java and function runtime (requires some extensions that are checked in)
- build the bundle: porter build (requires porter locally)
- install, test, and uninstall the local bundle
- git add porter.yaml changes, and any app changes
- git push origin master
- Navigate to the Actions tab for your repository to watch the build function.