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

feat: Universe Domain Environment Variable Support #2485

Merged
merged 18 commits into from
Mar 4, 2024

Conversation

lqiu96
Copy link
Contributor

@lqiu96 lqiu96 commented Feb 14, 2024

Support for reading the GOOGLE_CLOUD_UNIVERSE_DOMAIN env var.

Since we are still on JUnit 4 and there is no dedicated support for testing Env Vars, we created a new step in the CI to test this Env Var test:
image

@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Feb 14, 2024
@product-auto-label product-auto-label bot added size: l Pull request size is large. size: s Pull request size is small. and removed size: s Pull request size is small. size: l Pull request size is large. labels Feb 28, 2024
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Feb 29, 2024
@lqiu96 lqiu96 added the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 29, 2024
@lqiu96 lqiu96 marked this pull request as ready for review February 29, 2024 15:48
@lqiu96 lqiu96 requested a review from a team as a code owner February 29, 2024 15:48
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 29, 2024
@lqiu96 lqiu96 requested a review from blakeli0 February 29, 2024 15:49
@lqiu96
Copy link
Contributor Author

lqiu96 commented Feb 29, 2024

On a second look, I think this might cause issues when running this locally. This test will fail if the local environment does not have the GOOGLE_CLOUD_UNIVERSE_DOMAIN env var set. I think I'll change this to a maven profile that needs to be activated (and is disabled by default).

@@ -283,6 +285,11 @@ String mtlsEndpointResolver(
}

public EndpointContext build() throws IOException {
// If the universe domain wasn't configured explicitly in the settings, check the
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we move the logic to determineUniverseDomain()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, moved it to determineUniverseDomain()

// For this test running locally or in CI, check that the Env Var is set properly.
// This test should only run when the maven profile `EnvVarTest` is enabled.
@Test
public void endpointContextBuild_universeDomainEnvVarSet() throws IOException {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please add one more test case that if universe domain is set on both ClientSettings and Env Var, then ClientSettings should take precedence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, added a test case that will be run with -PenvVarTest

@lqiu96 lqiu96 added the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 29, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 29, 2024
@lqiu96 lqiu96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 29, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 29, 2024
Copy link

sonarcloud bot commented Mar 4, 2024

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Mar 4, 2024

Quality Gate Failed Quality Gate failed for 'java_showcase_integration_tests'

Failed conditions
62.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@lqiu96 lqiu96 merged commit 1463d64 into main Mar 4, 2024
39 of 41 checks passed
@lqiu96 lqiu96 deleted the universe-domain_env-var branch March 4, 2024 17:04
diegomarquezp pushed a commit that referenced this pull request Mar 15, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>2.38.0</summary>

##
[2.38.0](v2.37.0...v2.38.0)
(2024-03-15)


### Features

* [common-protos] add `api_version` extension to `ServiceOptions`, for
collaborative versioning
([d343be9](d343be9))
* [common-protos] add `api_version` extension to `ServiceOptions`, for
collaborative versioning
([#2551](#2551))
([d343be9](d343be9))
* add `ErrorReason.LOCATION_POLICY_VIOLATED` enum value
([d343be9](d343be9))
* add `ErrorReason.LOCATION_POLICY_VIOLATED` enum value
([d343be9](d343be9))
* add `Publishing.rest_reference_documentation_uri` to aid client
library publication
([d343be9](d343be9))
* add `Publishing.rest_reference_documentation_uri` to aid client
library publication
([d343be9](d343be9))
* Add shopping and chat common protos.
([#2553](#2553))
([5f2d4e7](5f2d4e7)),
closes
[#2018](#2018)
* get PR description from googleapis commits
([#2531](#2531))
([c2ea697](c2ea697))
* Introduce OpenTelemetry Metrics Recording
([#2500](#2500))
([b936580](b936580))
* skip build only commit
([#2555](#2555))
([180c8a9](180c8a9))
* Universe Domain Environment Variable Support
([#2485](#2485))
([1463d64](1463d64))


### Dependencies

* normalize dependencies
([#2574](#2574))
([6622238](6622238))
* update arrow.version to v15.0.1
([#2565](#2565))
([b2c3f6a](b2c3f6a))
* update dependency com.fasterxml.jackson:jackson-bom to v2.17.0
([#2564](#2564))
([40ae7f9](40ae7f9))
* update dependency com.google.api-client:google-api-client-bom to
v2.4.0
([#2570](#2570))
([f60441f](f60441f))
* update dependency com.google.errorprone:error_prone_annotations to
v2.26.1
([#2530](#2530))
([7c1aaab](7c1aaab))
* update dependency com.google.errorprone:error_prone_annotations to
v2.26.1
([#2532](#2532))
([447b4e1](447b4e1))
* update dependency io.netty:netty-tcnative-boringssl-static to
v2.0.65.final
([#2547](#2547))
([46e0e0f](46e0e0f))
* update dependency net.bytebuddy:byte-buddy to v1.14.12
([#2522](#2522))
([edfec32](edfec32))
* update google api dependencies
([#2484](#2484))
([92e91bc](92e91bc))
* update google api dependencies
([#2538](#2538))
([d9355cf](d9355cf))
* update googleapis/java-cloud-bom digest to 3f93d58
([#2499](#2499))
([5fd4d5e](5fd4d5e))
* update googleapis/java-cloud-bom digest to 659764f
([#2545](#2545))
([d6c8be6](d6c8be6))
* update netty dependencies
([#2480](#2480))
([40753c3](40753c3))
* update opentelemetry-java monorepo to v1.35.0
([#2477](#2477))
([3ecefff](3ecefff))
* update opentelemetry-java monorepo to v1.36.0
([#2550](#2550))
([9669c21](9669c21))
* update opentelemetry-java monorepo to v1.36.0
([#2573](#2573))
([f5f201e](f5f201e))
* update slf4j monorepo to v2.0.12
([#2481](#2481))
([363a354](363a354))


### Documentation

* minor tweaks to various comments
([d343be9](d343be9))
* minor tweaks to various comments
([d343be9](d343be9))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants