Skip to content

[Java] Move GCP-related secret classes and tests from sdks/java/core to google-cloud-platform-core - #40019

Open
shunping wants to merge 12 commits into
apache:masterfrom
shunping:secret-manager-5
Open

[Java] Move GCP-related secret classes and tests from sdks/java/core to google-cloud-platform-core#40019
shunping wants to merge 12 commits into
apache:masterfrom
shunping:secret-manager-5

Conversation

@shunping

@shunping shunping commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Moves Google Cloud Platform (GCP) secret manager implementations (GcpSecret, GcpHsmGeneratedSecret) and their SecretRegistrars (GcpSecretRegistrar, GcpHsmGeneratedSecretRegistrar) out of sdks/java/core into sdks/java/extensions/google-cloud-platform-core.
This decouples beam-sdks-java-core from GCP Secret Manager, Cloud KMS, and Tink dependencies, keeping core lightweight while still supporting dynamic secret registration when google-cloud-platform-core is on the classpath via ServiceLoader.

Notice that there is no functional change in this PR.

Follow-up to #39940 (comment)

Changes

  • Moved Source Classes:
    • Moved GcpSecret, GcpHsmGeneratedSecret, GcpSecretRegistrar, and GcpHsmGeneratedSecretRegistrar from org.apache.beam.sdk.util (sdks/java/core) to org.apache.beam.sdk.extensions.gcp.util (sdks/java/extensions/google-cloud-platform-core).
  • Migrated Tests:
    • Extracted GCP secret unit tests from SecretTest into GcpSecretTest in google-cloud-platform-core.
    • Moved GcpSecretRegistrarTest to google-cloud-platform-core.
    • Extracted GCP KMS and Secret Manager tests for GroupByKey and GroupByEncryptedKey from GroupByKeyTest and GroupByEncryptedKeyTest into GcpGroupByEncryptedKeyTest.
    • Renamed and moved GroupByKeyIT from sdks/java/core to GcpGroupByKeyIT in google-cloud-platform-core.

@shunping
shunping marked this pull request as ready for review September 4, 2026 17:18
@shunping

shunping commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator Author

r: @damccorm

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@damccorm damccorm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please take a look at the precommit failure which looks related to the change:

1: Task failed with an exception.
  
  Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
  -----------
  * What went wrong:
  Execution failed for task ':sdks:java:core:analyzeClassesDependencies'.
  > Dependency analysis found issues.
    unusedDeclaredArtifacts
     - com.google.protobuf:protobuf-java:4.33.6@jar
  
  
  * Try:
  > Run with --stacktrace option to get the stack trace.
  > Run with --info or --debug option to get more log output.
  > Get more help at https://help.gradle.org./
  ==============================================================================
  
  2: Task failed with an exception.
  -----------
  * What went wrong:
  Execution failed for task ':sdks:java:extensions:google-cloud-platform-core:analyzeClassesDependencies'.
  > Dependency analysis found issues.
    usedUndeclaredArtifacts
     - com.google.protobuf:protobuf-java:4.33.6@jar
     - 
     - ```

@damccorm

damccorm commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Otherwise, this LGTM, thanks

…XlangTest

- Add TestSecretRegistrar in sdks/java/core/src/test for testing secret options
- Update GroupByKeyWithGbekTest in ValidateRunnerXlangTest to use type:testsecret
  so cross-language tests run unconditionally without GCP Secret Manager
@shunping

shunping commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator Author

Note that I also replace the use of GCP secret manager in XVR gbek test with a test secret manager so we won't have gcp deps in java/core. We already have integration tests for GBEK in GcpGroupByKeyIT.java.

@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.23%. Comparing base (51ea3f0) to head (1224ebf).

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #40019      +/-   ##
============================================
- Coverage     58.40%   57.23%   -1.18%     
+ Complexity    13570     3658    -9912     
============================================
  Files          2576     1195    -1381     
  Lines        268929   193636   -75293     
  Branches      11056     3835    -7221     
============================================
- Hits         157077   110832   -46245     
+ Misses       105899    79230   -26669     
+ Partials       5953     3574    -2379     
Flag Coverage Δ
java 72.24% <ø> (+7.64%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants