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: #355 Explicitly passing --project argument when starting emulator #923

Merged
merged 4 commits into from
Dec 1, 2022

Conversation

jainsahab
Copy link
Contributor

@jainsahab jainsahab commented Nov 21, 2022

fix #355

Context:
LocalDatastoreHelper starts a subprocess gcloud beta emulators datastore start to start the emulator, It is always starting the subprocess under the assumption that user have already set the project id property using gcloud config set project some-project-id. If the project-id property is set, it'll result in successful execution of sub-process. Otherwise it'll throw the following error.

➜  java-datastore git:(main) gcloud beta emulators datastore start
WARNING: Reusing existing data in [/Users/jainsahab/.config/gcloud/emulators/datastore].
Executing: /Users/jainsahab/Work/bin/google-cloud-sdk/platform/cloud-datastore-emulator/cloud_datastore_emulator start --host=::1 --port=8045 --store_on_disk=True --allow_remote_shutdown --consistency=0.9 /Users/jainsahab/.config/gcloud/emulators/datastore
ERROR: (gcloud.beta.emulators.datastore.start) The required property [project] is not currently set.
It can be set on a per-command basis by re-running your command with the [--project] flag.

You may set it for your current workspace by running:

  $ gcloud config set project VALUE

or it can be set temporarily by the environment variable [CLOUDSDK_CORE_PROJECT]

Note: To unset the project-id property, run gcloud config unset project

BlockingProcessStreamReader.java file from google-cloud-core library which is a java Thread ignores this helpful text and the subprocess's exit code to silently completes its own execution. Hence, no error was given to the user.

Solution:
As part of this PR, google-cloud-core library (covered in this PR) is out of scope, but we are explicitly passing --project argument now while starting the emulator so that it no longer expect the project-id property to set.
In addition to that, we are also giving the user the capability to set a custom project Id.

@jainsahab jainsahab requested review from a team as code owners November 21, 2022 13:28
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: datastore Issues related to the googleapis/java-datastore API. labels Nov 21, 2022
@jainsahab
Copy link
Contributor Author

PR for the issue in google-cloud-core library is up for review too @ googleapis/java-core#1039.

@jainsahab jainsahab changed the title fix: #355 Explicitly passing --process argument when starting emulator fix: #355 Explicitly passing --project argument when starting emulator Nov 23, 2022
… on the fact that project id not nullable now
@jainsahab jainsahab added the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 1, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 1, 2022
@jainsahab jainsahab merged commit ef4065d into googleapis:main Dec 1, 2022
gcf-merge-on-green bot pushed a commit that referenced this pull request Dec 6, 2022
🤖 I have created a release *beep* *boop*
---


## [2.13.0](https://togithub.com/googleapis/java-datastore/compare/v2.12.5...v2.13.0) (2022-12-06)


### Features

* Next release from main branch is 2.13.0 ([#917](https://togithub.com/googleapis/java-datastore/issues/917)) ([1f12435](https://togithub.com/googleapis/java-datastore/commit/1f1243577cbdc206b6a0bfcde818411eb1b806ad))


### Bug Fixes

* [#355](https://togithub.com/googleapis/java-datastore/issues/355) Explicitly passing --project argument when starting emulator ([#923](https://togithub.com/googleapis/java-datastore/issues/923)) ([ef4065d](https://togithub.com/googleapis/java-datastore/commit/ef4065d233b968f58a34673aa53d39f60a013e2d))


### Dependencies

* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.0 ([#932](https://togithub.com/googleapis/java-datastore/issues/932)) ([1dbcea7](https://togithub.com/googleapis/java-datastore/commit/1dbcea73827961148800c1ec8e87065dbceb6c88))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.18 ([#924](https://togithub.com/googleapis/java-datastore/issues/924)) ([625e896](https://togithub.com/googleapis/java-datastore/commit/625e89685172ae546a813f5f7184223d01fbb0ac))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.19 ([#930](https://togithub.com/googleapis/java-datastore/issues/930)) ([77285be](https://togithub.com/googleapis/java-datastore/commit/77285be97fbd6bca1ada35202842238e306dd8dc))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.18 ([#925](https://togithub.com/googleapis/java-datastore/issues/925)) ([0c7539d](https://togithub.com/googleapis/java-datastore/commit/0c7539d736ec993d7bb0531d7cd4dab1b08487a0))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.19 ([#931](https://togithub.com/googleapis/java-datastore/issues/931)) ([40b4011](https://togithub.com/googleapis/java-datastore/commit/40b4011e3a826a91e33541efdecb05f0e129f87c))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
triplequark pushed a commit that referenced this pull request Dec 19, 2022
* chore: upgrade native image checks to graalvm-22.3.0  (#1718) (#926)

chore: upgrade native image checks to graalvm-22.3.0
Source-Link: googleapis/synthtool@5e52896
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:27b1b1884dce60460d7521b23c2a73376cba90c0ef3d9f0d32e4bdb786959cfd

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

* chore: add new branch to sync-repo-settings (#927)

* fix: #355 Explicitly passing --project argument when starting emulator (#923)

* Running gcloud datastore emulator with --project argument

* Allow user to pass a custom project id when creating a new LocalDatastoreHelper instance

* Creating a local variable to increase the readability and emphasizing on the fact that project id not nullable now

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

* build(deps): update dependency com.google.cloud:google-cloud-shared-config to v1.5.5 (#929)

* deps: update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.19 (#931)

* deps: update dependency org.graalvm.buildtools:junit-platform-native to v0.9.19 (#930)

* deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.0 (#932)

* chore(main): release 2.13.0 (#921)

:robot: I have created a release *beep* *boop*
---


## [2.13.0](https://togithub.com/googleapis/java-datastore/compare/v2.12.5...v2.13.0) (2022-12-06)


### Features

* Next release from main branch is 2.13.0 ([#917](https://togithub.com/googleapis/java-datastore/issues/917)) ([1f12435](https://togithub.com/googleapis/java-datastore/commit/1f1243577cbdc206b6a0bfcde818411eb1b806ad))


### Bug Fixes

* [#355](https://togithub.com/googleapis/java-datastore/issues/355) Explicitly passing --project argument when starting emulator ([#923](https://togithub.com/googleapis/java-datastore/issues/923)) ([ef4065d](https://togithub.com/googleapis/java-datastore/commit/ef4065d233b968f58a34673aa53d39f60a013e2d))


### Dependencies

* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.0 ([#932](https://togithub.com/googleapis/java-datastore/issues/932)) ([1dbcea7](https://togithub.com/googleapis/java-datastore/commit/1dbcea73827961148800c1ec8e87065dbceb6c88))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.18 ([#924](https://togithub.com/googleapis/java-datastore/issues/924)) ([625e896](https://togithub.com/googleapis/java-datastore/commit/625e89685172ae546a813f5f7184223d01fbb0ac))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.19 ([#930](https://togithub.com/googleapis/java-datastore/issues/930)) ([77285be](https://togithub.com/googleapis/java-datastore/commit/77285be97fbd6bca1ada35202842238e306dd8dc))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.18 ([#925](https://togithub.com/googleapis/java-datastore/issues/925)) ([0c7539d](https://togithub.com/googleapis/java-datastore/commit/0c7539d736ec993d7bb0531d7cd4dab1b08487a0))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.19 ([#931](https://togithub.com/googleapis/java-datastore/issues/931)) ([40b4011](https://togithub.com/googleapis/java-datastore/commit/40b4011e3a826a91e33541efdecb05f0e129f87c))

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

* chore(deps): update dependency com.google.cloud:google-cloud-datastore to v2.13.0 (#935)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-datastore](https://togithub.com/googleapis/java-datastore) | `2.12.5` -> `2.13.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastore/2.13.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastore/2.13.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastore/2.13.0/compatibility-slim/2.12.5)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastore/2.13.0/confidence-slim/2.12.5)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/java-datastore</summary>

### [`v2.13.0`](https://togithub.com/googleapis/java-datastore/blob/HEAD/CHANGELOG.md#&#8203;2130-httpsgithubcomgoogleapisjava-datastorecomparev2125v2130-2022-12-06)

[Compare Source](https://togithub.com/googleapis/java-datastore/compare/v2.12.5...v2.13.0)

##### Features

-   Next release from main branch is 2.13.0 ([#&#8203;917](https://togithub.com/googleapis/java-datastore/issues/917)) ([1f12435](https://togithub.com/googleapis/java-datastore/commit/1f1243577cbdc206b6a0bfcde818411eb1b806ad))

##### Bug Fixes

-   [#&#8203;355](https://togithub.com/googleapis/java-datastore/issues/355) Explicitly passing --project argument when starting emulator ([#&#8203;923](https://togithub.com/googleapis/java-datastore/issues/923)) ([ef4065d](https://togithub.com/googleapis/java-datastore/commit/ef4065d233b968f58a34673aa53d39f60a013e2d))

##### Dependencies

-   Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.0 ([#&#8203;932](https://togithub.com/googleapis/java-datastore/issues/932)) ([1dbcea7](https://togithub.com/googleapis/java-datastore/commit/1dbcea73827961148800c1ec8e87065dbceb6c88))
-   Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.18 ([#&#8203;924](https://togithub.com/googleapis/java-datastore/issues/924)) ([625e896](https://togithub.com/googleapis/java-datastore/commit/625e89685172ae546a813f5f7184223d01fbb0ac))
-   Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.19 ([#&#8203;930](https://togithub.com/googleapis/java-datastore/issues/930)) ([77285be](https://togithub.com/googleapis/java-datastore/commit/77285be97fbd6bca1ada35202842238e306dd8dc))
-   Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.18 ([#&#8203;925](https://togithub.com/googleapis/java-datastore/issues/925)) ([0c7539d](https://togithub.com/googleapis/java-datastore/commit/0c7539d736ec993d7bb0531d7cd4dab1b08487a0))
-   Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.19 ([#&#8203;931](https://togithub.com/googleapis/java-datastore/issues/931)) ([40b4011](https://togithub.com/googleapis/java-datastore/commit/40b4011e3a826a91e33541efdecb05f0e129f87c))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-datastore).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->

* chore(main): release 2.13.1-SNAPSHOT (#934)

:robot: I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

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

* chore: Enable requesting numeric enums in "transport=rest" responses for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport (#933)

* chore: Enable requesting numeric enums in "transport=rest" responses for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport

chore: disallow "transport=rest" for services where numeric enums are not confirmed to be supported (except in PHP and Java)
PiperOrigin-RevId: 493113566

Source-Link: googleapis/googleapis@758f0d1

Source-Link: googleapis/googleapis-gen@78bd8f0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzhiZDhmMDVlMTI3NjM2M2ViMTRlYWU3MGU5MWZlNGJjMjA3MDNhYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

* build(deps): bump certifi from 2022.9.24 to 2022.12.7 in /synthtool/gcp/templates/java_library/.kokoro (#1732) (#937)

build(deps): bump certifi

Bumps [certifi](https://togithub.com/certifi/python-certifi) from 2022.9.24 to 2022.12.7.
- [Release notes](https://togithub.com/certifi/python-certifi/releases)
- [Commits](https://togithub.com/certifi/python-certifi/compare/2022.09.24...2022.12.07)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jeff Ching <chingor@google.com>
Source-Link: https://togithub.com/googleapis/synthtool/commit/ae0d43e5f17972981fe501ecf5a5d20055128bea
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:9de537d592b60e5eac73b374a28263969bae91ecdb29b445e894576fbf54851c

* chore(deps): update dependency com.google.cloud:libraries-bom to v26.2.0 (#938)

* chore(deps): update dependency com.google.cloud:libraries-bom to v26.2.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: gcf-owl-bot[bot] <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Prateek <jainsahab@google.com>
Co-authored-by: Mend Renovate <bot@renovateapp.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jeff Ching <chingor@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the googleapis/java-datastore API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Datastore emulator fails to start without project id property
3 participants