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

fix: Adding documentation for experimental native image support #2357

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

zhumin8
Copy link
Contributor

@zhumin8 zhumin8 commented Nov 16, 2023

This pr:

  • Adds a section about native image support on documentation. Another option is to add in documentation to each relevant modules existing documentation page. But adding a centralized page is more convenient for adding general guides regarding native builds, and is less prone to error when it come to adding/removing experimental items in the future.
  • Adds to Firestore and Datastore sample to demonstrate runtime hints needs to be added for data domains if not managed with repositories (Native build). These are also linked from native.adoc.

Related:
spanner related content to be added in separate pr.

@zhumin8
Copy link
Contributor Author

zhumin8 commented Nov 16, 2023

@burkedavison @mpeddada1 Here is an initial draft on native documentation. PTAL!

@@ -0,0 +1,107 @@
== Native Image Support (Experimental)

https://www.graalvm.org/docs/[GraalVM Native Image] allows you to ahead-of-time compile Java code to a standalone executable.
Copy link
Member

Choose a reason for hiding this comment

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

We might want to call out https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html as the link, since it's more likely to provide the information a Spring user is looking for.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similar link is provided in the Usage section. But I like the idea of calling out here at the top too.
fixed in 348f6bf

docs/src/main/asciidoc/native.adoc Outdated Show resolved Hide resolved
docs/src/main/asciidoc/native.adoc Outdated Show resolved Hide resolved
docs/src/main/asciidoc/native.adoc Outdated Show resolved Hide resolved
docs/src/main/asciidoc/native.adoc Outdated Show resolved Hide resolved
docs/src/main/asciidoc/native.adoc Outdated Show resolved Hide resolved
docs/src/main/asciidoc/native.adoc Outdated Show resolved Hide resolved

3. Call `mvn -Pnative spring-boot:build-image`

==== Native Build Plugins
Copy link
Member

Choose a reason for hiding this comment

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

This section mixes explanations of the different pieces with steps needing to be taken by the developer -- and so it ends up being a bit confusing as to what the instructions actually are.

Can this be reworked to either defer to the official Spring Boot docs, or make the setup+invoke instructions distinct from the explanation of the different parts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Let me rethink about this section.


==== Datastore

To use `DatastoreTemplate` methods on Domain types not managed by `DatastoreRepository`, you need to register runtime hints for these domain POJOs in your application. For more details, refer to example
Copy link
Member

Choose a reason for hiding this comment

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

I thought these were @Entity classes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Trying to align with our documentation wording here. Regarding object mapping, we state in documentation: "Spring Data Cloud Datastore allows you to map domain POJOs to Cloud Datastore kinds and entities via annotations:" (code)


==== Firestore

To use `FirestoreTemplate` methods on Domain types not managed by `FirestoreReactiveRepository`, you need to register runtime hints for these domain POJOs in your application. For more details, refer to example https://github.com/GoogleCloudPlatform/spring-cloud-gcp/tree/main/spring-cloud-gcp-samples/spring-cloud-gcp-data-firestore-sample/src/main/java/com/example/DomainTypeRuntimeHints.java[`DomainTypeRuntimeHints`] in Reactive Firestore Repository sample application.
Copy link
Member

Choose a reason for hiding this comment

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

Similarly, I thought these were @Document classes? Is "Domain types" clear enough for customers to understand the set of classes that will need hints?

zhumin8 added a commit that referenced this pull request Nov 30, 2023
…to native ci (#2384)

Changes in this PR:
Add runtime hints for `GcpCloudSqlProperties.class` in sql autoconfigure.

Other changes:
- Adds `sql-mysql-sample` , `sql-postgres-sample` and `sql-postgres-r2dbc-sample` to native ci.
- Setups to pass DB password to native test. (In integration ci, db password is stored as env and passed as option [here](https://github.com/GoogleCloudPlatform/spring-cloud-gcp/blob/5c922f260c1ca9c69e942bc351fbe83a4eb5ee60/.github/workflows/integrationTests.yaml#L165-L170). pass same env var through `maven-surefire-plugin` in `nativeTest` profile.)
- Changes in instance name setup for tests, now it tests run under `spring-cloud-gcp-ci` project and native tests run in `spring-cloud-gcp-ci-native` project.

Todos:
- Update sample tests to be parallel safe. Currently, if test unexpected failed, db won't be cleaned up for next run.
- Documentation: will add to #2357
@zhumin8 zhumin8 changed the title [Draft] Adding documentation for experimental native image support fix: Adding documentation for experimental native image support Dec 12, 2023
Copy link

sonarcloud bot commented Dec 12, 2023

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@zhumin8 zhumin8 marked this pull request as ready for review December 15, 2023 19:32
@zhumin8 zhumin8 requested a review from a team as a code owner December 15, 2023 19:32
zhumin8 added a commit that referenced this pull request Dec 18, 2023
This pr adds bigquery module integration tests (core and integration) to native ci. To achieve this, changes includes:
- Add runtime hints for resources used in test (data.csv, data.json).
- Fore integration test configuration class, remove `@EnableIntegration` and add `@SpringBootConfiguration`, configure a `ThreadPoolTaskScheduler` bean as it's not provided by `@EnableIntegration` now.

- For documentation, since #2357 is not merged, will add to it separately.
Copy link

sonarcloud bot commented May 15, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants