Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Functions maven plugin quarkized #31780

Merged
merged 1 commit into from
May 31, 2023

Conversation

patriot1burke
Copy link
Contributor

@patriot1burke patriot1burke commented Mar 11, 2023

Quarkus implementation for the azure-functions-maven-plugin

Added quarkus:run capabilities.
Added quarkus:deploy capabilities to make it more generic. Kept backward compatible with kubernetes deploy. Kubernetes needs to be refactored to use new generic deploy mechanism IMO.

@quarkus-bot quarkus-bot bot added area/core area/dependencies Pull requests that update a dependency file area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/maven area/testing labels Mar 11, 2023
@quarkus-bot

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

@quarkus-bot quarkus-bot bot added the area/gradle Gradle label Mar 21, 2023
@quarkus-bot

This comment has been minimized.

import io.quarkus.deployment.run.RunCommandLaunchResultBuildItem;

@Mojo(name = "run")
public class RunMojo extends QuarkusBootstrapMojo {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mvn quarkus:run fails with:Error: Unable to access jarfile /Users/manderse/temp/myj/target/quarkus-app/quarkus-run.jar

can we make it require project build first or at least tell the user to have it built?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this require changes to pom.xml

}

@Override
protected void doExecute() throws MojoExecutionException, MojoFailureException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the execution have what looks like a copy of all system properties on it. is that intended?

-Djava.specification.version=17 -Dsun.jnu.encoding=UTF-8 -Djava.class.path=/Users/manderse/temp/myj/.mvn/wrapper/maven-wrapper.jar -Djava.vm.vendor=GraalVM Community -Dsun.arch.data.model=64 -Djava.vendor.url=https://www.graalvm.org/ -Duser.timezone=Europe/Copenhagen -Dmaven.conf=/Users/manderse/.m2/wrapper/dists/apache-maven-3.8.7-bin/678cc9d4/apache-maven-3.8.7/conf -Djava.vm.specification.version=17 -Dos.name=Mac OS X -Dsun.java.launcher=SUN_STANDARD -Duser.country=DK -Dsun.boot.library.path=/Users/manderse/.sdkman/candidates/java/22.3.r17-grl/lib -Dsun.java.command=org.apache.maven.wrapper.MavenWrapperMain -f /Users/manderse/temp/myj/pom.xml verify -DskipTests quarkus:run -Dhttp.nonProxyHosts=local|*.local|169.254/16|*.169.254/16 -Djdk.debug=release -Dmaven.home=/Users/manderse/.m2/wrapper/dists/apache-maven-3.8.7-bin/678cc9d4/apache-maven-3.8.7 -Dsun.cpu.endian=little -Duser.home=/Users/manderse -Duser.language=en -Dsun.stderr.encoding=UTF-8 -Djava.specification.vendor=Oracle Corporation -Djava.version.date=2022-10-18 -Djava.home=/Users/manderse/.sdkman/candidates/java/22.3.r17-grl -Dfile.separator=/ -Djava.vm.compressedOopsMode=Zero based -Djdk.internal.vm.ci.enabled=true -Dline.separator= -Dsun.stdout.encoding=UTF-8 -Djava.vm.specification.vendor=Oracle Corporation -Djava.specification.name=Java Platform API Specification -Dapple.awt.application.name=MavenWrapperMain -Dsun.management.compiler=HotSpot 64-Bit Tiered Compilers -Dftp.nonProxyHosts=local|*.local|169.254/16|*.169.254/16 -Djava.runtime.version=17.0.5+8-jvmci-22.3-b08 -Duser.name=manderse -Dpath.separator=: -Dos.version=13.2.1 -Djava.runtime.name=OpenJDK Runtime Environment -Dfile.encoding=UTF-8 -Dguice.disable.misplaced.annotation.check=true -Djava.vm.name=OpenJDK 64-Bit Server VM -DskipTests=true -Djava.vendor.version=GraalVM CE 22.3.0 -Djava.vendor.url.bug=https://github.com/oracle/graal/issues -Djava.io.tmpdir=/var/folders/mm/z7zzmyl15bd8byr8vsdxf1740000gn/T/ -Djava.version=17.0.5 -Duser.dir=/Users/manderse/temp/myj -Dos.arch=aarch64 -Dmaven.multiModuleProjectDirectory=/Users/manderse/temp/myj -Djava.vm.specification.name=Java Virtual Machine Specification -Dnative.encoding=UTF-8 -Djava.library.path=/Users/manderse/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. -Djava.vm.info=mixed mode, sharing -Djava.vendor=GraalVM Community -Dvertx.disableTCCL=true -Djava.vm.version=17.0.5+8-jvmci-22.3-b08 -Dclassworlds.conf=/Users/manderse/.m2/wrapper/dists/apache-maven-3.8.7-bin/678cc9d4/apache-maven-3.8.7/bin/m2.conf -Dsun.io.unicode.encoding=UnicodeBig -DsocksNonProxyHosts=local|*.local|169.254/16|*.169.254/16 -Djava.class.version=61.0 -jar /Users/manderse/temp/myj/target/quarkus-app/quarkus-run.jar

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think its a good idea to have a separate switch for passing sys props to spawned process?

@quarkus-bot quarkus-bot bot added the area/cli Related to quarkus cli (not maven/gradle/etc.) label Apr 4, 2023
@quarkus-bot

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

@quarkus-bot quarkus-bot bot added area/codestarts area/platform Issues related to definition and interaction with Quarkus Platform labels May 17, 2023
@patriot1burke patriot1burke changed the title WIP: Azure Functions maven plugin quarkized Azure Functions maven plugin quarkized May 18, 2023
@quarkus-bot

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented May 18, 2023

🙈 The PR is closed and the preview is expired.

@quarkus-bot

This comment has been minimized.

@patriot1burke patriot1burke force-pushed the azf-testing branch 2 times, most recently from 14b08f0 to 1705f9d Compare May 22, 2023 14:18
@patriot1burke patriot1burke requested a review from iocanel May 22, 2023 14:18
@patriot1burke
Copy link
Contributor Author

@maxandersen @iocanel Finally finished everything would love to get a review.

  • "Deploy" should be backward compatible. A separate PR should be done to get the Kubernetes extensions deploy to work similarly to Azure Functions.
  • This is all looking very nice, ordered, and simple. Azure functions requires no special build plugins now. :) Will be nice to get Lambda working in the same way.

@quarkus-bot

This comment has been minimized.

@patriot1burke patriot1burke force-pushed the azf-testing branch 2 times, most recently from b8601ae to c688a06 Compare May 22, 2023 22:50
@quarkus-bot

This comment has been minimized.

@iocanel
Copy link
Contributor

iocanel commented May 23, 2023

I went through the code changes and I really like where its going. Especially the part with the deployment command declaration.
I want to checkout the PR and try it locally before I finalize my review.
Hopefully, later today or tommorow.

"Too many installed extensions support quarkus:deploy. You must choose one by setting quarkus.deploy.target.");
getLog().error("Extensions: " + targets.stream().collect(Collectors.joining(" ")));
} else if (target != null && !targets.contains(target)) {
getLog().error(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, we would like a matching extension (if found) to be added as a forcedDependency.

For example in any quarkus project the following should always work:

mvn quarkus:deploy -Dquarkus.deploy.target=knative
mvn quarkus:deploy -Dquarkus.deploy.target=openshift

Besides the hard coding approach which is what was originally used, I can think of two approaches that could possibly work:

  1. Express deployment capabilites in the extension metadata and perform a registry lookup.
  2. Use a convention like adding quarkus-${quarkus.deploy.target| to forced dependencies.

Option 1: has the downsides that its slow.
Option 2: is not the most reliable (e.g. in the existing codebase knative would still not work as there is no quarkus-knative extension).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forcing dependencies, IMO, is a mediocre solution, at best, when using CLI, but I don't like it at all from the mvn/gradle command line. Forcing dependencies doesn't even work with Gradle, correct? For Lambda and Azure Functions there are packaging requirements for quarkus:run and quarkus:deploy to work, so, forcing dependencies makes no sense for those plugins.

Any specific hardcoding should be removed from the maven/gradle code base, and only CLI should be able to force dependencies, IMO. I would even go as far to say that forced dependencies should be removed as a solution as it doesn't work for Gradle at all. I don't think its a burden to force users to pull in the dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the kube extensions were not meant to use the quarkus.deploy.target until they are refactored to use the new deployment mechanism.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forcing dependencies doesn't even work with Gradle, correct?

Forcing dependecnies from within a gradle task doesn't work. However, when using the CLI we can force dependencies for gradle project by generating a gralde init script. This is something that we already do and it works fine.

Any specific hardcoding should be removed from the maven/gradle code base,

I agree that we can remove hardcoding from maven/gralde and what you've put there is a great step towards this goal.

I don't think its a burden to force users to pull in the dependency.

No, it is not. But then again, the kubernetes bits do not affect runtime, so there is not reason for them to be added to the project. And given that different people within a team may be using different tools (especially for the container image bits and local kube development like quarkus-minikube and quarkus-kind) it can cause uneeded noise git.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to refactor the Kube extensions within this PR please. Can we just get this approved and merged? Is it not backward compatible as-is right now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not asking you to refactor the kube extensions. I am just trying to understand what you have in mind.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patriot1burke, @maxandersen : How would you like us to proceed? Given that the code doesn't break compatibility I am ok with this PR.

We can deal with quarkus.deploy.target=xxxx vs quarkus.xxxx.deploy=true in a follow up as long as we agree that we will somehow retain a way of forcing dependencies. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will try again tomorrow after my talk.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to you on work. I can make the change to quarkus.xxx.deploy -> quarkus.deploy.target if you want. Forced dependencies should be done before lookup of deploy options too. (if it isn't already)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I don't think that we can completely remove quarkus.xxx.deploy at this point. At best we could deprecate it.

Copy link
Contributor

@iocanel iocanel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request looks good to me.
Furhter aligning and improvement can be done in a follow up PR.

integration testing

finish quarkus:run and integration tests

quarkus:run gradle

cli run command

implement deploy

afk rebase'

azf deploy

azf deploy working

azf more fixes

azf service-principal

azf fix codestarts and path config

azf fix codestarts and path config

azf gradle and codestart

azf new docs

fix pom

azf docs and imports

fix gradle

quarkusRun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Related to quarkus cli (not maven/gradle/etc.) area/codestarts area/core area/dependencies Pull requests that update a dependency file area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/documentation area/gradle Gradle area/maven area/platform Issues related to definition and interaction with Quarkus Platform area/testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants