-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Polaris Apprunner Gradle and Maven Plugins #785
base: main
Are you sure you want to change the base?
Conversation
Well, it actually works from an included-build :) The below patch, running diff --git a/quarkus/server/build.gradle.kts b/quarkus/server/build.gradle.kts
index 83e94435d..94f39b026 100644
--- a/quarkus/server/build.gradle.kts
+++ b/quarkus/server/build.gradle.kts
@@ -17,14 +17,22 @@
* under the License.
*/
+import io.quarkus.gradle.tasks.QuarkusBuild
+
plugins {
alias(libs.plugins.quarkus)
alias(libs.plugins.openapi.generator)
id("polaris-server")
id("polaris-license-report")
id("distribution")
+ id("org.apache.polaris.apprunner")
}
+val quarkusRunner by
+ configurations.creating {
+ description = "Used to reference the generated runner-jar (either fast-jar or uber-jar)"
+ }
+
dependencies {
implementation(project(":polaris-core"))
implementation(project(":polaris-api-management-service"))
@@ -38,6 +46,8 @@ dependencies {
// override dnsjava version in dependencies due to https://github.com/dnsjava/dnsjava/issues/329
implementation(platform(libs.dnsjava))
+
+ polarisQuarkusServer(project(":polaris-quarkus-server", "quarkusRunner"))
}
quarkus {
@@ -71,3 +81,44 @@ distributions {
}
}
}
+
+testing {
+ suites {
+ val demoTest by registering(JvmTestSuite::class)
+ }
+}
+
+val quarkusFatJar = project.hasProperty("uber-jar")
+val quarkusBuild = tasks.named<QuarkusBuild>("quarkusBuild")
+
+// Expose runnable jar via quarkusRunner configuration for integration-tests that require the
+// server.
+artifacts {
+ add(
+ quarkusRunner.name,
+ provider {
+ if (quarkusFatJar) quarkusBuild.get().runnerJar
+ else quarkusBuild.get().fastJar.resolve("quarkus-run.jar")
+ },
+ ) {
+ builtBy(quarkusBuild)
+ }
+}
+
+// Add the uber-jar, if built, to the Maven publication
+if (quarkusFatJar) {
+ afterEvaluate {
+ publishing {
+ publications {
+ named<MavenPublication>("maven") {
+ artifact(quarkusBuild.get().runnerJar) {
+ classifier = "runner"
+ builtBy(quarkusBuild)
+ }
+ }
+ }
+ }
+ }
+}
+
+polarisQuarkusApp { includeTask(tasks.named("demoTest")) }
diff --git a/quarkus/server/src/demoTest/java/foo/DemoTest.java b/quarkus/server/src/demoTest/java/foo/DemoTest.java
new file mode 100644
index 000000000..e2e2dd81a
--- /dev/null
+++ b/quarkus/server/src/demoTest/java/foo/DemoTest.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package foo;
+
+import org.junit.jupiter.api.Test;
+
+public class DemoTest {
+ @Test
+ public void test() {}
+} |
The publishing-helper in Polaris derives the name and description used in the parent POM from ASF's published project information. If an Apache projects wants to publish the parent pom for a _related_ project, the name and description in the pom (may) need to be different (as for apache#785). This change allows this.
When adding an included build to the Polaris main repo, the (Maven) group ID _must_ be different. This change allows sharing (symling) the `gradle.properties` file with an included build (apache#785 in this case).
8eb98f5
to
1c3fba8
Compare
b2f65fd
to
018fa4f
Compare
When adding an included build to the Polaris main repo, the (Maven) group ID _must_ be different. This change allows sharing (symling) the `gradle.properties` file with an included build (#785 in this case).
When this PR is ready for review, can you update the description or add an issue explaining why this build change is necessary? This seems like it radically complicates the build to something that is much harder to understand and I think it would be good to clarify why that complexity is needed over the blackbox test setup that @dimas-b added previously. |
I've added a README to the PR hopefully explaining lots of it. |
The publishing-helper in Polaris derives the name and description used in the parent POM from ASF's published project information. If an Apache projects wants to publish the parent pom for a _related_ project, the name and description in the pom (may) need to be different (as for #785). This change allows this.
5003c21
to
cd9a3e7
Compare
Updated the "actual" change w/ changes for ./gradlew :apprunner-demo:demoTest --info --rerun and shows something like this illustrating that the actual HTTP ports are available in the test to be run. Noteworthy: the server is only started, when the Gradle test task needs to run. (line wraps by me)
|
Depending on whether an uber-jar (#797) or a distribution tarball/zip would be released to Maven Central additional changes might be necessary to let the apprunner deal with released distributables. The latter would also depend on how the contents of an (extracted) distributable tarball/zip looks like. |
36aa13f
to
c0a2c0f
Compare
06b9274
to
73e0d36
Compare
This can be helpful for the test framework of catalog migrator. Are we planning to merge this soon? |
Extracted the 2nd commit as #1082 |
This change introduces Gradle and Maven plugins to run Polaris Quarkus server for integration tests. This work is based on [projectnessie's apprunner](https://github.com/projectnessie/nessie-apprunner). The Gradle plugin can be used in other project and in the Polaris "main" code base. Integration tests of the plugin still use Nessie artifacts to satisfy the need for integration tests of the plugins against binary released available on Maven Central. The actual application, whether it's Polaris or Nessie or any other Quarkus (web) application, not really matter - all work, as long as the syntax of the log message emitted by Quarkus is the same. Noting that this is intentionally implemented as a "Gradle included build", so that the Polaris "main" build can actually use the Plugin and that it could be released independently, if needed. Hopefully extensive documentation is included in the `README.md` in `tools/apprunner`.
Adds the tar+zip distribution archives as publishable artifacts to Maven publication. Also updates polaris-quarkus-admin to build as a "fast-jar" instead of an "uber-jar".
ab7806a
to
ce418f6
Compare
This change introduces Gradle and Maven plugins to run Polaris Quarkus server for integration tests. This work is based on projectnessie's apprunner.
The Gradle plugin can be used in other project and in the Polaris "main" code base.
Integration tests of the plugin still use Nessie artifacts to satisfy the need for integration tests of the plugins against binary released available on Maven Central. The actual application, whether it's Polaris or Nessie or any other Quarkus (web) application, not really matter - all work, as long as the syntax of the log message emitted by Quarkus is the same.
Noting that this is intentionally implemented as a "Gradle included build", so that the Polaris "main" build can actually use the Plugin and that it could be released independently, if needed.
Hopefully extensive documentation is included in the
README.md
intools/apprunner
.