I have Azure Function project in JAVA. Unfortunately, java is not supported very well )-: So, everything is a "little" bit different. So, could you point me to reference example or documentation how to deploy a function project written in java to azure? Since all what I want shows just part of the problem - and the parts does not fit together )-:
- java uses azure-function-maven-plugin (which is wrapper to func core tools)
- this plugin prepares stagging folder which is compressed to ZIP and deployed as "package"
- unfortunately, this stagging folder is named based of function name. So, ZIP package IS DEPENDENT on target azure RESOURCE name.
It is impossible to build independent package (ZIP) and deploy it to several different environment (stages/dev/test/prod). Or is it?
It is especially wierd when you use CI/CD pipeline. It is not possible to have one BUILD pipeline and than several DEPLOY pipeline. Because the build HAVE TO be named (internal directories) based on target deployment name - so not independent. Which goes against the basic principle to have one build and several configuration for each environment.
Any idea how to solve it without building several builds? Thank you.
EDIT: maven "mvn package (+azure-function:package)" prepare build with directories
${projectRoot}/target/azure-functions/${functionResourceName}/...
where
/...
is compressed to final azure package named: ${functionResourceName}.zip
So, the "functionResourceName" is just in the name of ZIP file (+ containing jar with the same name). But ...
... if you try deploy this ZIP to azure function resource with another name - it fails.
Yes. I indeed manually prepare the package(using Publish Build Artifacts Task.)
I would like to share my steps to deploy the Java Function Package to Azure Function.
Here are my steps:
In Build Pipeline:
In Release Pipeline:
I use the Azure App Service Deploy Task. (For clear, I converted it to yaml format)
Result:
The azure function name and the package name is different. But it could be deployed to Azure Function successfully.