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

Use GOOGLE_APPLICATION_CREDENTIALS and GCLOUD_PROJECT vars in RemoteGcsHelper #339

Merged
merged 2 commits into from
Nov 17, 2015

Conversation

mziccard
Copy link
Contributor

@mziccard mziccard commented Nov 9, 2015

This fixes #335

@mziccard mziccard added auth api: storage Issues related to the Cloud Storage API. testing labels Nov 9, 2015
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 9, 2015
* variables {@code GCLOUD_TESTS_PROJECT_ID} and {@code GCLOUD_TESTS_KEY} are not set or if
* the file pointed by {@code GCLOUD_TESTS_KEY} does not exist
* variables {@code GCLOUD_PROJECT} and {@code GOOGLE_APPLICATION_CREDENTIALS} are not set or
* if the file pointed by {@code GOOGLE_APPLICATION_CREDENTIALS} does not exist
*/
public static RemoteGcsHelper create() throws GcsHelperException {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@mziccard mziccard added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Nov 10, 2015
@mziccard
Copy link
Contributor Author

I fixed the comment and now RemoteGcsHelper uses default auth credentials.
This should not be merged until we fix default auth credentials NPE.

@ajkannan
Copy link

#344 is now merged in, which fixes the default auth credentials NPE

@mziccard
Copy link
Contributor Author

I realized now that using default authentication credentials causes signUrl method to fail (see here) and consequently also signUrl IT tests fail.

We can manually pass a ServiceAccountAuthCredentials to signUrl but that is the same as explicitly creating ServiceAccountAuthCredentials from the env variables in RemoteGcsHelper.

I suggest that we do not use default lookup in RemoteGcsHelper unless you know a way to workaround the signUrl problem

@@ -45,8 +45,8 @@

private static final Logger log = Logger.getLogger(RemoteGcsHelper.class.getName());
private static final String BUCKET_NAME_PREFIX = "gcloud-test-bucket-temp-";
private static final String PROJECT_ID_ENV_VAR = "GCLOUD_TESTS_PROJECT_ID";
private static final String PRIVATE_KEY_ENV_VAR = "GCLOUD_TESTS_KEY";
private static final String PROJECT_ID_ENV_VAR = "GCLOUD_PROJECT";

This comment was marked as spam.

@aozarov
Copy link
Contributor

aozarov commented Nov 10, 2015

I realized now that using default authentication credentials causes signUrl method to fail (see here) and consequently also signUrl IT tests fail.

We could also support it when GoogleCredentials is instanceof ServiceAccountCredentials. There are various ways we could deal with it.

- Add a method to convert ApplicationDefaultCredentials to ServiceAccountAuthCredentials
- Add type check and conversion to Storage.signUrl
@mziccard
Copy link
Contributor Author

In 82ebc71 I fixed the comment and:

  • Added a method to convert ApplicationDefaultCredentials to ServiceAccountAuthCredentials if GoogleCredentials object is an instance of ServiceAccountCredentials
  • Add type check and conversion to Storage.signUrl to work with ApplicationDefaultCredentials

@aozarov
Copy link
Contributor

aozarov commented Nov 17, 2015

Great! Looks good to me. Any reason you still have the "don't merge" label?

@mziccard
Copy link
Contributor Author

I just forgot to remove :)

@mziccard mziccard removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Nov 17, 2015
aozarov added a commit that referenced this pull request Nov 17, 2015
Use GOOGLE_APPLICATION_CREDENTIALS and GCLOUD_PROJECT vars in RemoteGcsHelper
@aozarov aozarov merged commit 4ecd840 into googleapis:master Nov 17, 2015
github-actions bot pushed a commit to suztomo/google-cloud-java that referenced this pull request Jun 29, 2022
…manager to v0.118.6-alpha (googleapis#339)

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

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [com.google.cloud:google-cloud-resourcemanager](https://github.com/GoogleCloudPlatform/google-cloud-java) | patch | `0.118.5-alpha` -> `0.118.6-alpha` |

---

### Renovate configuration

:date: **Schedule**: At any time (no schedule defined).

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

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

:no_bell: **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 [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-resourcemanager).
github-actions bot pushed a commit that referenced this pull request Jul 1, 2022
github-actions bot pushed a commit that referenced this pull request Aug 11, 2022
🤖 I have created a release *beep* *boop*
---


## [2.3.2](googleapis/java-workflow-executions@v2.3.1...v2.3.2) (2022-08-11)


### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v3 ([#336](googleapis/java-workflow-executions#336)) ([eab4139](googleapis/java-workflow-executions@eab4139))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
github-actions bot pushed a commit that referenced this pull request Sep 15, 2022
…ator_java versions (#339)

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 472750037

Source-Link: googleapis/googleapis@88f2ea3

Source-Link: googleapis/googleapis-gen@230a558
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjMwYTU1ODgzMDZhYWUxOGZlOGYyYTU3ZjE0ZDQwMzlhZDcyYzkwMSJ9
github-actions bot pushed a commit that referenced this pull request Oct 5, 2022
🤖 I have created a release *beep* *boop*
---


## [2.3.9](https://github.com/googleapis/java-contact-center-insights/compare/v2.3.8...v2.3.9) (2022-10-04)


### Bug Fixes

* update protobuf to v3.21.7 ([4758cf0](https://github.com/googleapis/java-contact-center-insights/commit/4758cf035c2092ffc1f1cad1b3984a0344eb67d5))


### Documentation

* Updating comments ([#345](https://github.com/googleapis/java-contact-center-insights/issues/345)) ([ebadaa5](https://github.com/googleapis/java-contact-center-insights/commit/ebadaa5e44ded908d5517d12f52e193b70be2dda))


### Dependencies

* Update dependency certifi to v2022.9.24 ([#362](https://github.com/googleapis/java-contact-center-insights/issues/362)) ([5d1ce8b](https://github.com/googleapis/java-contact-center-insights/commit/5d1ce8bf7dd759b4019e4b189d8c2054384e919d))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.14.6 ([#341](https://github.com/googleapis/java-contact-center-insights/issues/341)) ([4456bd4](https://github.com/googleapis/java-contact-center-insights/commit/4456bd42500b1da5d427702c187f8e71140acd94))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.14.7 ([#346](https://github.com/googleapis/java-contact-center-insights/issues/346)) ([5e0de9e](https://github.com/googleapis/java-contact-center-insights/commit/5e0de9ec21b8eb55a4622ec2f018cd4bfd79b304))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.15.0 ([#348](https://github.com/googleapis/java-contact-center-insights/issues/348)) ([e1c52f6](https://github.com/googleapis/java-contact-center-insights/commit/e1c52f6fd766c918756f4045926b2a02c9478cba))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.16.0 ([#353](https://github.com/googleapis/java-contact-center-insights/issues/353)) ([4744d87](https://github.com/googleapis/java-contact-center-insights/commit/4744d876764bc18f52e2c570f2c72a34b3ef1a53))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.16.1 ([#356](https://github.com/googleapis/java-contact-center-insights/issues/356)) ([3c860f8](https://github.com/googleapis/java-contact-center-insights/commit/3c860f8a0377fd88e344ad228835cc0ff932c41d))
* Update dependency com.google.cloud:google-cloud-pubsub to v1.120.12 ([#339](https://github.com/googleapis/java-contact-center-insights/issues/339)) ([4e329c4](https://github.com/googleapis/java-contact-center-insights/commit/4e329c4ee1d5072fcd2c48958a6d48576813bcdd))
* Update dependency com.google.cloud:google-cloud-pubsub to v1.120.13 ([#347](https://github.com/googleapis/java-contact-center-insights/issues/347)) ([45b3540](https://github.com/googleapis/java-contact-center-insights/commit/45b35403b2997ef8421e9573f050537812c61cea))
* Update dependency com.google.cloud:google-cloud-pubsub to v1.120.14 ([#352](https://github.com/googleapis/java-contact-center-insights/issues/352)) ([9fc2624](https://github.com/googleapis/java-contact-center-insights/commit/9fc2624a370c0bd81d7d88204830a162a41f0f23))
* Update dependency com.google.cloud:google-cloud-pubsub to v1.120.16 ([#354](https://github.com/googleapis/java-contact-center-insights/issues/354)) ([9b355ad](https://github.com/googleapis/java-contact-center-insights/commit/9b355ad24da4561a7e10b7a06dcb6bf57e4aa9a7))
* Update dependency com.google.cloud:google-cloud-pubsub to v1.120.17 ([#358](https://github.com/googleapis/java-contact-center-insights/issues/358)) ([7d2a878](https://github.com/googleapis/java-contact-center-insights/commit/7d2a8784bc7f0422831844f823a304f3bfda3192))
* Update dependency com.google.cloud:google-cloud-pubsub to v1.120.18 ([#359](https://github.com/googleapis/java-contact-center-insights/issues/359)) ([4e93e08](https://github.com/googleapis/java-contact-center-insights/commit/4e93e08c425b09ca35c977c5ea22f4c7b2538ae3))
* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.2 ([#351](https://github.com/googleapis/java-contact-center-insights/issues/351)) ([c1e8dfa](https://github.com/googleapis/java-contact-center-insights/commit/c1e8dfa39db2d82f89401b0aa14a95dd1d2b00e1))
* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.3 ([#355](https://github.com/googleapis/java-contact-center-insights/issues/355)) ([8a57045](https://github.com/googleapis/java-contact-center-insights/commit/8a57045112d9b905dc3edae8b9b01d25d3f1788d))
* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.4 ([#368](https://github.com/googleapis/java-contact-center-insights/issues/368)) ([c8e9ca4](https://github.com/googleapis/java-contact-center-insights/commit/c8e9ca43bf90feacda4129e1ac2f26592c8ae47e))
* Update dependency gcp-releasetool to v1.8.8 ([#363](https://github.com/googleapis/java-contact-center-insights/issues/363)) ([22d1d6b](https://github.com/googleapis/java-contact-center-insights/commit/22d1d6bada56d263474b8550bf92b72f6bfc24ad))
* Update dependency google-auth to v2.11.1 ([#364](https://github.com/googleapis/java-contact-center-insights/issues/364)) ([04b3da7](https://github.com/googleapis/java-contact-center-insights/commit/04b3da765c19bd53b4d7c5dfa814d1dd450a480d))
* Update dependency google-cloud-core to v2.3.2 ([#365](https://github.com/googleapis/java-contact-center-insights/issues/365)) ([94a569f](https://github.com/googleapis/java-contact-center-insights/commit/94a569f7adb2f3c59a57d1428eb70ca17c52f827))
* Update dependency pyjwt to v2.5.0 ([#366](https://github.com/googleapis/java-contact-center-insights/issues/366)) ([96d97a8](https://github.com/googleapis/java-contact-center-insights/commit/96d97a8c1dbe616f48474949dc936503842b170e))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
suztomo pushed a commit that referenced this pull request Feb 1, 2023
🤖 I have created a release *beep* *boop*
---


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

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. auth cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove RemoteGcsHelper specific environment variables for setting projectId and key.
4 participants