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

open-api: Build runtime jar for test fixture #11279

Merged
merged 1 commit into from
Nov 6, 2024
Merged

Conversation

ajantha-bhat
Copy link
Member

Since the REST catalog TCK is merged (#10908),
we can have a runtime jar from the test fixture which can be used for building the docker image of rest catalog adapter.

PR for docker image will be raised in the follow up (already working on it)

}
}

jar {
Copy link
Member Author

Choose a reason for hiding this comment

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

It was an empty jar since no source code. Hence, disabled it.

build.gradle Outdated
shadowJar {
archiveBaseName.set("iceberg-open-api-test-fixtures-runtime")
archiveClassifier.set(null)
configurations = [project.configurations.testFixturesShadowImplementation]
Copy link
Member Author

Choose a reason for hiding this comment

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

can't directly depend on testFixturesImplementation as it is not resolved. Hence using via custom testFixturesShadowImplementation

}

shadowJar {
archiveBaseName.set("iceberg-open-api-test-fixtures-runtime")
Copy link
Member Author

Choose a reason for hiding this comment

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

Double check the naming. LGTM.

Copy link
Contributor

@kevinjqliu kevinjqliu left a comment

Choose a reason for hiding this comment

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

This is a great idea!

Should we also publish this jar to maven?

iceberg/deploy.gradle

Lines 75 to 77 in 208ab20

} else if (isOpenApi) {
artifact testJar
artifact testFixturesJar

@ajantha-bhat
Copy link
Member Author

@kevinjqliu: I wasn't sure because of #9871.

I can add it. If we agree that it is useful.

@kevinjqliu
Copy link
Contributor

I initially thought this was creating the jar for the TCK, but it looks like its for the RESTCatalogServer class instead. I wonder if it would be easier to work with if the class is moved out of the iceberg-open-api project

@github-actions github-actions bot added the INFRA label Oct 8, 2024
@ajantha-bhat
Copy link
Member Author

I initially thought this was creating the jar for the TCK, but it looks like its for the RESTCatalogServer class instead. I wonder if it would be easier to work with if the class is moved out of the iceberg-open-api project

I think the current design of keeping them as test fixture make sense to me. As it is not a production code.


// include the LICENSE and NOTICE files for the runtime Jar
from(projectDir) {
include 'LICENSE'
Copy link
Contributor

Choose a reason for hiding this comment

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

We're actually packaging up more in this runtime than what's identified in the top-level LICENSE/NOTICE files, so we need to make sure that everything is captured.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we have to do this manually or we use the standard tool for this?

I don't think we have a standard guidelines for this in "CONTRIBUTING.md". Can we add this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Used https://github.com/jk1/Gradle-License-Report to generate License and manually updated the notice for them.

Please check again.

Copy link
Member Author

Choose a reason for hiding this comment

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

cc: @jbonofre

Copy link
Contributor

@danielcweeks danielcweeks Oct 17, 2024

Choose a reason for hiding this comment

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

Just spot checking the NOTICE, but it doesn't include the Kite notice from the Iceberg NOTICE file. @bryanck had some way of generating the license/notice files that included transitive dependencies (which is required by ASF).

Copy link
Member Author

Choose a reason for hiding this comment

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

@bryanck: Could you please help me here? I tried the same plugin that you mentioned in your PR here. I used the configuration as testFixturesRuntimeClasspath, because it is a shadow jar for test fixture source sets.

Also, We need to add the standard way in "contributing.md" for new users to follow it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I used the same plugin, but for both the notices and licenses. Also, I appended to the root license and notice files, the root notice has the Kite notice.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ajantha-bhat I can generate them if you want, I created a custom renderer for the plugin. I'm hoping to contribute that at some point so this is automated.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can also try manually appending the root files contents.

It only generates licenses, how did you generate the notice from that plugin?

Copy link
Contributor

Choose a reason for hiding this comment

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

It can generate both, but I added some logic to my custom renderer to dedupe the notices.

@ajantha-bhat
Copy link
Member Author

Retriggering build because of connection error

Downloading https://services.gradle.org/distributions/gradle-8.10.2-bin.zip

Error: Exception in thread "main" java.io.IOException: Server returned HTTP response code: 500 for URL: https://github.com/gradle/gradle-distributions/releases/download/v8.10.2/gradle-8.10.2-bin.zip
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:2011)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1602)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:223)
at org.gradle.wrapper.Install.forceFetch(SourceFile:2)
at org.gradle.wrapper.Install$1.call(SourceFile:8)
at org.gradle.wrapper.GradleWrapperMain.main(SourceFile:67)
Error: Process completed with exit code 1.

@ajantha-bhat
Copy link
Member Author

Any more suggestions for this? PR looks to be ready.

@Fokko
Copy link
Contributor

Fokko commented Oct 28, 2024

@ajantha-bhat First of all, thanks for working on this, and sorry for the late reply as I was on parental leave. Unfortunately, there are issues with this. I just ran the following to check what's being shipped:

./gradlew build -x test -x integrationTest

And noticed that we ship quite a bit in the fat jar:

ls -lah open-api/build/libs/iceberg-open-api-*
-rw-r--r--  1 fokko.driesprong  staff   6.0K Oct 28 21:12 open-api/build/libs/iceberg-open-api-1.7.0-SNAPSHOT-javadoc.jar
-rw-r--r--  1 fokko.driesprong  staff   6.0K Oct 28 21:12 open-api/build/libs/iceberg-open-api-1.7.0-SNAPSHOT-sources.jar
-rw-r--r--  1 fokko.driesprong  staff   9.5K Aug 27 20:18 open-api/build/libs/iceberg-open-api-1.7.0-SNAPSHOT-test-fixtures.jar
-rw-r--r--  1 fokko.driesprong  staff    10K Oct 28 21:12 open-api/build/libs/iceberg-open-api-1.7.0-SNAPSHOT-tests.jar
-rw-r--r--  1 fokko.driesprong  staff   109M Oct 28 21:12 open-api/build/libs/iceberg-open-api-test-fixtures-runtime-1.7.0-SNAPSHOT.jar

When looking into the runtime:

mkdir /tmp/vo
mv open-api/build/libs/iceberg-open-api-test-fixtures-runtime-1.7.0-SNAPSHOT.jar /tmp/vo/iceberg-open-api-test-fixtures-runtime-1.7.0-SNAPSHOT.jar
cd /tmp/vo
unzip iceberg-open-api-test-fixtures-runtime-1.7.0-SNAPSHOT.jar

And looking at the content, it looks like we ship a LOT, much more than mentioned in the LICENSE. Including at least one licenses that we cannot ship as it is part of the category X:

ls -lah | grep -i lgpl
-rw-r--r--   1 fokko.driesprong  wheel   7.5K Feb  1  1980 LGPL-3.0.txt

Also for the release we probably want to track down where this comes from.

@ajantha-bhat
Copy link
Member Author

ajantha-bhat commented Oct 29, 2024

@bryanck,

  • I have cleaned up the dependencies
  • Used license-report plugin to generate the report (plugin included in this PR)
    ./gradlew :iceberg-open-api:generateLicenseReport and report in build/reports/dependency-license/index.html
  • Used root notice and license.

Now I need your render tool to format and append the notice and license to existing file.

@Fokko
Copy link
Contributor

Fokko commented Oct 30, 2024

Thanks for fixing that issue @ajantha-bhat, this looks much better:

ls -lah open-api/build/libs/iceberg-open-api-*   
-rw-r--r--  1 fokko.driesprong  staff   6.0K Oct 30 12:54 open-api/build/libs/iceberg-open-api-1.7.0-SNAPSHOT-javadoc.jar
-rw-r--r--  1 fokko.driesprong  staff   6.0K Oct 30 12:54 open-api/build/libs/iceberg-open-api-1.7.0-SNAPSHOT-sources.jar
-rw-r--r--  1 fokko.driesprong  staff    10K Oct 30 12:54 open-api/build/libs/iceberg-open-api-1.7.0-SNAPSHOT-tests.jar
-rw-r--r--  1 fokko.driesprong  staff    49M Oct 30 13:26 open-api/build/libs/iceberg-open-api-test-fixtures-runtime-1.7.0-SNAPSHOT.jar

I did some digging around and didn't find any red flags. I did notice that we ship parts of Hadoop that we probably need (Filesystem, Configuration, etc), and the 3.3.6 has a known vulnerability, so good to bump that: #11428

Copy link
Member

@jbonofre jbonofre left a comment

Choose a reason for hiding this comment

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

The fix looks good. I've just asked about cloudera mention in the NOTICE.

open-api/NOTICE Show resolved Hide resolved
@Fokko
Copy link
Contributor

Fokko commented Oct 30, 2024

This looks good, let's move this forward, and wrap up anything pending in #11283

@ajantha-bhat
Copy link
Member Author

@Fokko: Thanks for the review. We can merge this and I can rebase the docker PR.

@ajantha-bhat ajantha-bhat marked this pull request as draft October 31, 2024 12:47
@@ -967,11 +970,9 @@ project(':iceberg-open-api') {
testFixturesImplementation project(':iceberg-gcp')
testFixturesImplementation project(':iceberg-azure')
testFixturesImplementation(libs.hadoop3.common) {
exclude group: 'log4j'
Copy link
Member Author

Choose a reason for hiding this comment

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

Added because of the warning while brining up the runtime jar.

exclude group: 'org.slf4j'
exclude group: 'ch.qos.reload4j'
exclude group: 'org.apache.avro', module: 'avro'
exclude group: 'com.fasterxml.woodstox'
Copy link
Member Author

Choose a reason for hiding this comment

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

Added these because of the error while brining up the runtime jar that class not found.

@ajantha-bhat ajantha-bhat marked this pull request as ready for review November 5, 2024 15:46
@ajantha-bhat
Copy link
Member Author

@danielcweeks, @Fokko, @bryanck: Please take a look at the PR again. Thanks.

@Fokko
Copy link
Contributor

Fokko commented Nov 6, 2024

Thanks @ajantha-bhat This looks good, if there are dangling issues, we can wrap them up in #11283

Let's move this forward, thanks @kevinjqliu, @jbonofre, @bryanck and @danielcweeks for the review 🙌

@Fokko Fokko merged commit 2ffd3b0 into apache:main Nov 6, 2024
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants