mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 00:47:11 +02:00
Use local credential to deploy beam pipelines
We are moving away from using Application Default Credentials generated by "gcloud auth application-default login" in our code base and consolidate on using self-managed credentials provided from AuthModule. One of the remaining dependencies on the ADCs is from beam pipeline deployment commands, which by default use the ADCs to talk to GCS and upload the jar files and templates. In this CL, we explicitly provide the locally created credential to the Options used in deployments. Also moved all credential qualifiers to CredentialModule, and removed @AppEngineAdminApiCredential, which is no longer used. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=224199812
This commit is contained in:
parent
fdda03eb53
commit
a612e9bf66
12 changed files with 77 additions and 67 deletions
|
@ -16,7 +16,6 @@ package google.registry.tools;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
@ -34,8 +33,6 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
import org.junit.Before;
|
||||
|
@ -156,14 +153,10 @@ public class AuthModuleTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_provideLocalCredentialStream() {
|
||||
InputStream jsonStream =
|
||||
AuthModule.provideLocalCredentialStream(getSecrets(), getCredential()).get();
|
||||
public void test_provideLocalCredentialJson() {
|
||||
String credentialJson = AuthModule.provideLocalCredentialJson(getSecrets(), getCredential());
|
||||
Map<String, String> jsonMap =
|
||||
new Gson()
|
||||
.fromJson(
|
||||
new InputStreamReader(jsonStream, UTF_8),
|
||||
new TypeToken<Map<String, String>>() {}.getType());
|
||||
new Gson().fromJson(credentialJson, new TypeToken<Map<String, String>>() {}.getType());
|
||||
assertThat(jsonMap.get("type")).isEqualTo("authorized_user");
|
||||
assertThat(jsonMap.get("client_secret")).isEqualTo(CLIENT_SECRET);
|
||||
assertThat(jsonMap.get("client_id")).isEqualTo(CLIENT_ID);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue