Skip to content

Commit 53bf686

Browse files
feat: use gcloud application default credentials (#3712)
* Adjustments to use application default credentials * feat: modify "Manage Google Accounts" button to rely on gcloud ADC (#3715) * feat: modify "Manage Google Accounts" button to rely on gcloud ADC * fix: use `setBaseEnabled()` to correctly propagate login state * chore: better UI, on-demand cred check * chore: adapt single account to deploy dialog (#3717) * feat: modify "Manage Google Accounts" button to rely on gcloud ADC * fix: use `setBaseEnabled()` to correctly propagate login state * chore: better UI, on-demand cred check * chore: [wip] adapt single account to deploy dialog * chore: display gcloud instruction messages * fix: layout to wrap no ADC message * chore: cleanup of `gcloud-cli-creds` (#3714) * chore: cleanup of deploy classes * chore: cleanup of deploy UI classes * chore: cleanup of cloudsdk staging helper * chore: better missing-credentials handling * chore: removal of Credential argument in `newApi()` methods (#3713) * feat: initial removal of Credential argument in newApi() methods * chore: move account resolution to new class * chore: correct precond check, correct exception logging * chore: do not throw exception when checking for credentials * fix: compilation errors * fix: compilation errors in tests * chore: enable or disable deploy button depending on ADC being found. (#3718) * feat: modify "Manage Google Accounts" button to rely on gcloud ADC * fix: use `setBaseEnabled()` to correctly propagate login state * chore: better UI, on-demand cred check * chore: [wip] adapt single account to deploy dialog * chore: display gcloud instruction messages * fix: layout to wrap no ADC message * chore: disable deploy button when not logged in * chore: use new `hasCredentialsSet` method * chore: fix unit tests using gcloud ADC (#3722) * feat: initial removal of Credential argument in newApi() methods * chore: move account resolution to new class * chore: cleanup of deploy classes * chore: cleanup of deploy UI classes * chore: cleanup of cloudsdk staging helper * chore: correct precond check, correct exception logging * feat: modify "Manage Google Accounts" button to rely on gcloud ADC * fix: use `setBaseEnabled()` to correctly propagate login state * chore: better UI, on-demand cred check * chore: [wip] adapt single account to deploy dialog * chore: display gcloud instruction messages * fix: layout to wrap no ADC message * chore: disable deploy button when not logged in * chore: do not throw exception when checking for credentials * fix: compilation errors * fix: compilation errors in tests * chore: initial compilation-enabling adjustments * chore: use `hasCredentialsSet()` * chore: add test account provider * chore: fix usagetracker and projectselector test * chore: expose `getCredential()` * chore: fix projectselector tests * chore: null check for `setPRoviderState()` * chore: add avatar URL to test accounts * chore: fix login tests * chore: fix googleapis tests * chore: add convenience state+defaultprovider method * chore: fix dataflow tests * chore: fix dataflow core tests * chore: fix error-prone state check in localserver * chore: correct static member initialization order in `TestAccountProvider` * chore: initialize static account provider once * chore: use mock methods instead of test acct provider in `MiniSelectorTest` * chore: fixes after merging `gcloud-cli-creds` * chore: use avatar urls in test accounts * chore: fix accounts panel tests * chore: fix dataflow preferences test * chore: fix login `Account` package * chore: fix usagetracker test ii * fix: project repository test * chore: fix googleapis proxy tests * fix: dataflow preferences test * chore: fix login tests, remove unused elements (pending cleanup) * chore: fix app engine deploy tests * chore: remove unnecessary test in `GcpProjectQueryJobTest` * chore: fix localserver tests iii * chore: more dataflow ui test fixes * chore: fix project repository test * chore: accounts panel test to assert correct number of children * chore: run tests on any pr * chore: fix update accounts logic in `GoogleLoginService` * chore: remove initialization of static members in constructors * chore: fire listeners in `AccountSelector` * chore: fix `GoogleApiFactory` initalization in `GcpLocalRunTabTest` * chore: fix cache check in `AccountSelector` * chore: fix `CloudSdkProcessWrapperTest` * chore: correct stubbing in `DefaultedPipelineOptionsComponentTest` * chore: remove unused imports in `CloudSdkProcessWrapper` * chore: remove unused import in `AccountPanelsTest` * chore: trigger update on `GcpLocalRunTabTest` * chore: fix `fireSelectionListeners` after setting change tracker variable * chore: fix `GcpLocalRUnTabTest` * chore: refactor force `AccountSelector` check to a better named method * chore: return validation states in `RunOptionsDefaultsComponent` * chore: add status checks to other test in `RODCTest` * chore: make `forceCheck()` public in `AccountSelector` * chore: remove unused thrown exception from delcaration in `GcpLocalRunTabTest` * chore: set flag to enable `forceAccountCheck` * chore: have dataflow Command RunOptionsDefaultScomponent not found to return gcloud CLI email * chore: fix login service test * chore: fix assertions, verify projects loaded in `RunOptionsDefaultCOmponentsStest` * chore: update project lists on account change in `RunOptionsDefaultsComponent` * chore: lock `login` `com.google.api` versions to `1.25.0` * chore: remove unthrown exception declaration in `GcpLocalRunTabTest` * chore: fix tests in `RunOptionsDefaultsCOmponentTest` * chore: correct versions in login MANIFEST.MF * chore: fix Command setUpServiceKeyCreation not found in Command GcpLocalRunTabTest not found' * chore: make account selector to return update result * chore: fix non-existent version of `com.google.api.services.oauth2` * chore: fix logic check in `forceAccountCHeck` for `AccountSelector` * chore: exclude `oauth2` package in manifest check * chore: fix comments in default pipeline options test * chore: fixes in dataflow tests * chore: remove TODO comment * chore: using `EnumMap` in `TestAccountProvider` * chore: handle `GoogleApiFactory` credential-related methods internally (#3726) * chore: change credential and account to `Optional` * chore: adapt localserver tests * chore: adapt dataflow plugin * chore: adapt login plugin * chore: adapt projectselector tests * chore: adapt projectselector (credential) * chore: adapt appengine deploy (hascredentials) * chore: move ITestAccountProvider * chore: adapt appengine.deploy (hascredentials) * chore: adapt appengine.localserver (hascredentials) * chore: adapt dataflow.ui (hascredentials) * chore: adapt googleapis test (hascredential) * chore: adapt login (hascredentials) * chore: adapt projectselector (hascredentials) * chore: fix setup in gcplocalruntabtest * chore: adapt test account provider to new interface * chore: remove `hasCredentialsSet` from `TestAccountProvider` * chore: test fixes * chore: correct import (`java.util.Optional`) * chore: workaround for undetected mock in `FlexDeployPreferencesDialogTest` * chore: remove unused import * chore: `Optional` convenience methods * chore: adapt tests of `AccountSelector` (#3728) * chore: remove unnecessary login module classes (#3727) * chore: remove login service OAuth related classes * chore: adapt appengine deploy * chore: adapt appengine deploy tests * chore: adapt dataflow core * chore: adapt dataflow core tests * chore: adapt dataflow ui * chore:adapt dataflow ui tests * chore: adapt tests in login ui * chore: fix test case in dataflow core * chore: improve Optional usage * chore: update appengine-plugins-core to 0.9.11 (#3732) * chore: fix project list initialization in local server launch config (#3729) * chore: fix project list initialization in local server launch config * chore: adapt tests to initially set credentials * chore: initialize account selector at right time * chore: fix initialization * chore: fix initialization ii * chore: initialize account selector with empty creds * chore: initialize api factory before instantiating the localserver tabl * chore: (cleanup) convert `GoogleApiFactory` to static usage (#3733) * chore: update snakeyaml to 2.0 * chore: adapt appengine.deploy.ui * chore: adapt appengine.deploy.ui.test * chore: remove usages in `appengine.deploy.ui` * chore: remove reference from appengine.deploy.ui.test * chore: hide constructor in googleapis * chore: adapt localserver * chore: adapt localserver tests * chore: adapt dataflow core * chore: adapt dataflow ui * chore: adapt dataflow ui test * chore: adapt googleapis * chore: adapt login * chore: adapt projectselector * chore: adapt projectselector tests * chore: delete `GoogleLoginService` (due at last merge) * chore: compilation errors * chore: compilation errors ii * chore: adapt localserver test ii * chore: adapt dataflow core test ii * chore: adapt dataflow ui ii * chore: adapt datafow ui test ii * chore: use GoogleApiFactory mock * chore: use static instance in defaulted pipeline options * chore: more compilation errors * feat: compute credentials from well-known ADC file path (apiary credentials) (#3731) * chore: compute adc path with auth java library * chore: add polling and subscription to adc * chore: fix listener logic for credential changes * chore: compute cred identifier (refresh token) manually * chore: adapt test account provider * chore: listen to cred changes in credentials menu item * chore: non optional-wrapped ADC file * chore: add dispose listener to account selector * chore: use `WatchService` * chore: tests for `DefaultAccountProvider` * chore: update snakeyaml to 2.0 * chore temp folder to be public * chore: add more propagation checks * chore: reorder change counters * chore: debug info for test * chore: more logging * chore: info level for adc watcher * chore: use custom constructor * chore: fix constructor * chore: wait for adc file change in test * chore: use class level listener * chore: mock non-final method to identify credential * chore: make `CredentialWithId` public * chore: various test fixes * test: fix listener wait workflow * chore: adapt to static apifacotry instance * chore: adapt to static apifactory instance ii * chore: correct tests * chore: compute custom refresh token * chore: improve logging * chore: more logging * chore: increase delay between event handling * chore: more logging ii * chore: thread safety * chore: changes polling logging * chore: fix break on polling * chore: thread safety in credentials * chore: more logging for account and credential test logic * chore: final test fixes * chore: fix logging levels for production class * chore: better path resolution * chore: init transport cache manually * chore: exclide OSGI-INF from build * chore: adapt transport cache tests * chore: correct reactivity in appengine deploy dialog (#3735) * chore: remove `@Component` annotation from api factory * chore: react on credential change via gcloud CLI * chore: remove comments * chore: handle correct exception type * chore: grace period for json file to be written * chore: use separate thread logic to check adc file * chore: accomodate (deprecated) dataflow tests * chore: accomodate (deprecate) dataflow tests ii * chore: accomodate (deprecate) dataflow tests iii * chore: revert default pipeline adjustments * chore: reset mock singleton in `GoogleApiFactory` * chore: remove unused import --------- Co-authored-by: Burke Davison <[email protected]>
1 parent cf10c10 commit 53bf686

File tree

99 files changed

+2352
-2245
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+2352
-2245
lines changed

eclipse/ide-target-platform/category.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<bundle id="org.apache.commons.commons-compress" version="0.0.0"/>
3737
<bundle id="jackson-core-asl" version="1.9.13"/>
3838
<bundle id="com.fasterxml.jackson.core.jackson-core" version="0.0.0"/>
39-
<bundle id="org.yaml.snakeyaml" version="1.32"/>
39+
<bundle id="org.yaml.snakeyaml" version="2.0"/>
4040
<bundle id="org.glassfish.javax.json" version="1.0.4"/>
4141

4242
<!--

features/com.google.cloud.tools.eclipse.3rdparty.feature/feature.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
id="org.yaml.snakeyaml"
107107
download-size="0"
108108
install-size="0"
109-
version="1.32.0"
109+
version="2.0"
110110
unpack="false"/>
111111

112112
<plugin

plugins/com.google.cloud.tools.eclipse.appengine.deploy.test/src/com/google/cloud/tools/eclipse/appengine/deploy/util/CloudSdkProcessWrapperTest.java

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,17 @@
1717
package com.google.cloud.tools.eclipse.appengine.deploy.util;
1818

1919
import static org.junit.Assert.assertEquals;
20-
import static org.junit.Assert.assertFalse;
2120
import static org.junit.Assert.assertNotNull;
2221
import static org.junit.Assert.assertTrue;
2322
import static org.junit.Assert.fail;
2423

2524
import com.google.cloud.tools.appengine.operations.AppEngineWebXmlProjectStaging;
2625
import com.google.cloud.tools.appengine.operations.Deployment;
2726
import com.google.cloud.tools.appengine.operations.cloudsdk.CloudSdkNotFoundException;
28-
import java.io.IOException;
29-
import java.nio.file.Files;
30-
import java.nio.file.Path;
27+
import com.google.cloud.tools.eclipse.test.util.TestAccountProvider;
28+
import com.google.cloud.tools.eclipse.test.util.TestAccountProvider.State;
3129
import org.eclipse.core.runtime.Status;
30+
import org.junit.Before;
3231
import org.junit.Rule;
3332
import org.junit.Test;
3433
import org.junit.rules.TemporaryFolder;
@@ -39,34 +38,25 @@ public class CloudSdkProcessWrapperTest {
3938

4039
private final CloudSdkProcessWrapper wrapper = new CloudSdkProcessWrapper();
4140

41+
@Before
42+
public void setUp() {
43+
TestAccountProvider.setAsDefaultProvider(State.NOT_LOGGED_IN);
44+
}
45+
4246
@Test
4347
public void testGetAppEngineDeployment_nullCredentialFile() throws CloudSdkNotFoundException {
4448
try {
45-
wrapper.getAppEngineDeployment(null, null);
49+
wrapper.getAppEngineDeployment(null);
4650
fail();
47-
} catch (NullPointerException ex) {
51+
} catch (IllegalStateException ex) {
4852
assertEquals(ex.getMessage(), "credential required for deploying");
4953
}
5054
}
5155

5256
@Test
53-
public void testGetAppEngineDeployment_nonExistingCredentialFile()
54-
throws CloudSdkNotFoundException {
55-
Path credential = tempFolder.getRoot().toPath().resolve("non-existing-file");
56-
assertFalse(Files.exists(credential));
57-
58-
try {
59-
wrapper.getAppEngineDeployment(credential, null);
60-
fail();
61-
} catch (IllegalArgumentException ex) {
62-
assertEquals(ex.getMessage(), "non-existing credential file");
63-
}
64-
}
65-
66-
@Test
67-
public void testGetAppEngineDeployment() throws IOException, CloudSdkNotFoundException {
68-
Path credential = tempFolder.newFile().toPath();
69-
Deployment deployment = wrapper.getAppEngineDeployment(credential, null);
57+
public void testGetAppEngineDeployment() throws CloudSdkNotFoundException {
58+
TestAccountProvider.setProviderState(State.LOGGED_IN);
59+
Deployment deployment = wrapper.getAppEngineDeployment(null);
7060
assertNotNull(deployment);
7161
}
7262

@@ -78,11 +68,11 @@ public void testGetAppEngineStandardStaging() throws CloudSdkNotFoundException {
7868

7969
@Test
8070
public void testGetAppEngineDeployment_cannotSetUpTwice()
81-
throws IOException, CloudSdkNotFoundException {
82-
Path credential = tempFolder.newFile().toPath();
83-
wrapper.getAppEngineDeployment(credential, null);
71+
throws CloudSdkNotFoundException {
72+
TestAccountProvider.setProviderState(State.LOGGED_IN);
73+
wrapper.getAppEngineDeployment(null);
8474
try {
85-
wrapper.getAppEngineDeployment(credential, null);
75+
wrapper.getAppEngineDeployment(null);
8676
fail();
8777
} catch (IllegalStateException ex) {
8878
assertEquals(ex.getMessage(), "process wrapper already set up");

plugins/com.google.cloud.tools.eclipse.appengine.deploy.ui.test/META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Comment: .appengine.localserver required for WTP server runtime definitions
1111
Require-Bundle: com.google.cloud.tools.eclipse.test.dependencies,
1212
com.google.cloud.tools.eclipse.appengine.localserver
1313
Import-Package: com.google.cloud.tools.eclipse.appengine.standard.java8,
14+
com.google.cloud.tools.eclipse.googleapis,
1415
com.google.cloud.tools.eclipse.swtbot,
1516
com.google.cloud.tools.eclipse.test.util,
1617
com.google.cloud.tools.eclipse.test.util.project,

0 commit comments

Comments
 (0)