From 509cca4dfe20ebdd47399a544f94df5692e9e1e1 Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Tue, 22 Oct 2024 18:46:21 -0400 Subject: [PATCH 01/20] Update application.yml --- service/src/main/resources/application.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml index 6edd73c0f3..39ae98f90d 100644 --- a/service/src/main/resources/application.yml +++ b/service/src/main/resources/application.yml @@ -166,6 +166,7 @@ workspace: state: operating azure: + azureEnvironment: AZURE sas-token-start-time-minutes-offset: 15 sas-token-expiry-time-minutes-offset: 60 sas-token-expiry-time-maximum-minutes-offset: 1440 From c5debebffd44e6ebdef920286c8681a5422a2441 Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Tue, 22 Oct 2024 18:49:01 -0400 Subject: [PATCH 02/20] Update dependencies.gradle --- service/dependencies.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/dependencies.gradle b/service/dependencies.gradle index 622a409a69..4e2f3910fc 100644 --- a/service/dependencies.gradle +++ b/service/dependencies.gradle @@ -44,8 +44,8 @@ dependencies { implementation group: 'bio.terra', name: 'terra-cloud-resource-lib', version: "1.2.31-SNAPSHOT" // Terra Landing Zone Service - implementation ('bio.terra:terra-landing-zone-service:0.0.334-SNAPSHOT') - implementation ('bio.terra:landing-zone-service-client:0.0.334-SNAPSHOT') + implementation ('bio.terra:terra-landing-zone-service:0.0.368-2b007fb') + implementation ('bio.terra:landing-zone-service-client:0.0.368-2b007fb') // Storage transfer service implementation group: 'com.google.apis', name: 'google-api-services-storagetransfer', version: 'v1-rev20230831-2.0.0' From 67429ab118f58d5f7bb4327ec9802135b239368f Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Tue, 22 Oct 2024 18:58:29 -0400 Subject: [PATCH 03/20] Update dependencies.gradle --- service/dependencies.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/dependencies.gradle b/service/dependencies.gradle index 4e2f3910fc..ec0a055277 100644 --- a/service/dependencies.gradle +++ b/service/dependencies.gradle @@ -44,8 +44,8 @@ dependencies { implementation group: 'bio.terra', name: 'terra-cloud-resource-lib', version: "1.2.31-SNAPSHOT" // Terra Landing Zone Service - implementation ('bio.terra:terra-landing-zone-service:0.0.368-2b007fb') - implementation ('bio.terra:landing-zone-service-client:0.0.368-2b007fb') + implementation ('bio.terra:terra-landing-zone-service:0.0.368-2b007fb-SNAPSHOT') + implementation ('bio.terra:landing-zone-service-client:0.0.368-2b007fb-SNAPSHOT') // Storage transfer service implementation group: 'com.google.apis', name: 'google-api-services-storagetransfer', version: 'v1-rev20230831-2.0.0' From 3558db86b39ec6632e3ba9898e50c0da088c5ee4 Mon Sep 17 00:00:00 2001 From: Jonathon Saunders Date: Tue, 22 Oct 2024 16:36:18 -0700 Subject: [PATCH 04/20] Update dependencies.gradle --- service/dependencies.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/dependencies.gradle b/service/dependencies.gradle index ec0a055277..95eff39480 100644 --- a/service/dependencies.gradle +++ b/service/dependencies.gradle @@ -44,8 +44,8 @@ dependencies { implementation group: 'bio.terra', name: 'terra-cloud-resource-lib', version: "1.2.31-SNAPSHOT" // Terra Landing Zone Service - implementation ('bio.terra:terra-landing-zone-service:0.0.368-2b007fb-SNAPSHOT') - implementation ('bio.terra:landing-zone-service-client:0.0.368-2b007fb-SNAPSHOT') + implementation ('bio.terra:terra-landing-zone-service:0.0.367-DEV') + implementation ('bio.terra:landing-zone-service-client:0.0.367-DEV') // Storage transfer service implementation group: 'com.google.apis', name: 'google-api-services-storagetransfer', version: 'v1-rev20230831-2.0.0' From 69276baa152796ba5c34f3a4bbfbca2183079b35 Mon Sep 17 00:00:00 2001 From: Jonathon Saunders Date: Tue, 22 Oct 2024 16:48:53 -0700 Subject: [PATCH 05/20] Update settings.gradle --- settings.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.gradle b/settings.gradle index 3cee9888b2..727327cf2e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -11,6 +11,7 @@ pluginManagement { } } } + mavenLocal() maven { url "https://broadinstitute.jfrog.io/broadinstitute/libs-snapshot-local/" } From b4abf04b5628250e8fa60c9a60a50489cdc9fa02 Mon Sep 17 00:00:00 2001 From: Jonathon Saunders Date: Tue, 22 Oct 2024 17:05:01 -0700 Subject: [PATCH 06/20] Update terra-workspace-manager.java-conventions.gradle --- .../main/groovy/terra-workspace-manager.java-conventions.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/groovy/terra-workspace-manager.java-conventions.gradle b/buildSrc/src/main/groovy/terra-workspace-manager.java-conventions.gradle index 2451cdac5a..433d7b927e 100644 --- a/buildSrc/src/main/groovy/terra-workspace-manager.java-conventions.gradle +++ b/buildSrc/src/main/groovy/terra-workspace-manager.java-conventions.gradle @@ -7,7 +7,7 @@ plugins { id 'com.srcclr.gradle' } -def useMavenLocal = false +def useMavenLocal = true repositories { if (useMavenLocal) { mavenLocal() From cb3d31e198eb006109c53209c21e977e5ef9bfb5 Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Wed, 23 Oct 2024 13:27:24 -0400 Subject: [PATCH 07/20] Update GoogleCredentialsConfiguration.java --- .../app/configuration/GoogleCredentialsConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/main/java/bio/terra/workspace/app/configuration/GoogleCredentialsConfiguration.java b/service/src/main/java/bio/terra/workspace/app/configuration/GoogleCredentialsConfiguration.java index b3783d6eca..628fb3a949 100644 --- a/service/src/main/java/bio/terra/workspace/app/configuration/GoogleCredentialsConfiguration.java +++ b/service/src/main/java/bio/terra/workspace/app/configuration/GoogleCredentialsConfiguration.java @@ -11,7 +11,7 @@ @Configuration public class GoogleCredentialsConfiguration { @Bean - @Profile("!unit-test") + @Profile("!unit-test & !azure") public GoogleCredentials getGoogleCredentials() { try { GoogleCredentials googleCredentials = GoogleCredentials.getApplicationDefault(); From 0c9e9e935e58245f78a17ecaf0199457c8b09ad6 Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Thu, 24 Oct 2024 12:21:22 -0400 Subject: [PATCH 08/20] Update CrlService.java --- .../main/java/bio/terra/workspace/service/crl/CrlService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java b/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java index 06692d5555..68d3dc7ce5 100644 --- a/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java +++ b/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java @@ -589,7 +589,7 @@ private AzureProfile getAzureProfile(AzureCloudContext azureCloudContext) { public AzureEnvironment getAzureEnvironmentFromName(String envName) { try { return switch (envName.toUpperCase()) { - case "AZURE_US_GOVERNMENT" -> AzureEnvironment.AZURE_US_GOVERNMENT; + case "AZURE_GOV" -> AzureEnvironment.AZURE_US_GOVERNMENT; case "AZURE_CHINA" -> AzureEnvironment.AZURE_CHINA; default -> AzureEnvironment.AZURE; }; From f0ea9f54b0729cf85020f64a039c48154bb8a69f Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Thu, 24 Oct 2024 13:05:14 -0400 Subject: [PATCH 09/20] update azure token to use azure environment --- .../external/AzureConfiguration.java | 16 ++++++++++++++-- .../external/PolicyServiceConfiguration.java | 1 + .../terra/workspace/common/utils/AuthUtils.java | 6 +++++- .../terra/workspace/service/crl/CrlService.java | 13 +------------ .../terra/workspace/service/iam/SamService.java | 1 + .../cloud/azure/AzureStorageAccessService.java | 2 +- 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java b/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java index ca19040c1f..3f81f01a4a 100644 --- a/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java +++ b/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java @@ -1,6 +1,8 @@ package bio.terra.workspace.app.configuration.external; import java.util.List; + +import com.azure.core.management.AzureEnvironment; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Configuration; @@ -25,8 +27,16 @@ public class AzureConfiguration { private String wsmServiceManagedIdentity; private String azureEnvironment; - public String getAzureEnvironment() { - return azureEnvironment; + public AzureEnvironment getAzureEnvironment() { + try { + return switch (azureEnvironment.toUpperCase()) { + case "AZURE_GOV" -> AzureEnvironment.AZURE_US_GOVERNMENT; + case "AZURE_CHINA" -> AzureEnvironment.AZURE_CHINA; + default -> AzureEnvironment.AZURE; + }; + } catch (IllegalArgumentException e) { + return AzureEnvironment.AZURE; + } } public void setAzureEnvironment(String azureEnvironment) { @@ -137,4 +147,6 @@ public String getWsmServiceManagedIdentity() { public void setWsmServiceManagedIdentity(String wsmServiceManagedIdentity) { this.wsmServiceManagedIdentity = wsmServiceManagedIdentity; } + + } diff --git a/service/src/main/java/bio/terra/workspace/app/configuration/external/PolicyServiceConfiguration.java b/service/src/main/java/bio/terra/workspace/app/configuration/external/PolicyServiceConfiguration.java index 1b8bb48f0f..d01a12b90e 100644 --- a/service/src/main/java/bio/terra/workspace/app/configuration/external/PolicyServiceConfiguration.java +++ b/service/src/main/java/bio/terra/workspace/app/configuration/external/PolicyServiceConfiguration.java @@ -54,6 +54,7 @@ public String getAccessToken() { features.isAzureControlPlaneEnabled(), POLICY_SERVICE_ACCOUNT_SCOPES, Arrays.asList(azureConfiguration.getAuthTokenScope()), + azureConfiguration.getAzureEnvironment(), clientCredentialFilePath); } catch (IOException e) { throw new InternalServerErrorException("Internal server error retrieving WSM credentials", e); diff --git a/service/src/main/java/bio/terra/workspace/common/utils/AuthUtils.java b/service/src/main/java/bio/terra/workspace/common/utils/AuthUtils.java index ef0bf0f5cb..c38fcc9634 100644 --- a/service/src/main/java/bio/terra/workspace/common/utils/AuthUtils.java +++ b/service/src/main/java/bio/terra/workspace/common/utils/AuthUtils.java @@ -2,6 +2,7 @@ import com.azure.core.credential.TokenCredential; import com.azure.core.credential.TokenRequestContext; +import com.azure.core.management.AzureEnvironment; import com.azure.identity.DefaultAzureCredentialBuilder; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; @@ -16,10 +17,13 @@ public static String getAccessToken( boolean isAzureControlPlaneEnabled, Collection gcpScopes, Collection azureScopes, + AzureEnvironment azureEnvironment, String credentialsPath) throws IOException { if (isAzureControlPlaneEnabled) { - TokenCredential credential = new DefaultAzureCredentialBuilder().build(); + TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(azureEnvironment.getActiveDirectoryEndpoint()) + .build(); // The Microsoft Authentication Library (MSAL) currently specifies offline_access, openid, // profile, and email by default in authorization and token requests. com.azure.core.credential.AccessToken token = diff --git a/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java b/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java index 68d3dc7ce5..443a7e8ecd 100644 --- a/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java +++ b/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java @@ -583,20 +583,9 @@ private AzureProfile getAzureProfile(AzureCloudContext azureCloudContext) { return new AzureProfile( azureCloudContext.getAzureTenantId(), azureCloudContext.getAzureSubscriptionId(), - getAzureEnvironmentFromName(azureConfiguration.getAzureEnvironment())); + azureConfiguration.getAzureEnvironment()); } - public AzureEnvironment getAzureEnvironmentFromName(String envName) { - try { - return switch (envName.toUpperCase()) { - case "AZURE_GOV" -> AzureEnvironment.AZURE_US_GOVERNMENT; - case "AZURE_CHINA" -> AzureEnvironment.AZURE_CHINA; - default -> AzureEnvironment.AZURE; - }; - } catch (IllegalArgumentException e) { - return AzureEnvironment.AZURE; - } - } @VisibleForTesting public ClientConfig getClientConfig() { diff --git a/service/src/main/java/bio/terra/workspace/service/iam/SamService.java b/service/src/main/java/bio/terra/workspace/service/iam/SamService.java index d7551f1518..e7cf3648e6 100644 --- a/service/src/main/java/bio/terra/workspace/service/iam/SamService.java +++ b/service/src/main/java/bio/terra/workspace/service/iam/SamService.java @@ -162,6 +162,7 @@ public String getWsmServiceAccountToken() { features.isAzureControlPlaneEnabled(), SAM_OAUTH_SCOPES, Arrays.asList(azureConfiguration.getAuthTokenScope()), + azureConfiguration.getAzureEnvironment(), null); } catch (IOException e) { throw new InternalServerErrorException("Internal server error retrieving WSM credentials", e); diff --git a/service/src/main/java/bio/terra/workspace/service/resource/controlled/cloud/azure/AzureStorageAccessService.java b/service/src/main/java/bio/terra/workspace/service/resource/controlled/cloud/azure/AzureStorageAccessService.java index 3cbdce770b..50d36add0a 100644 --- a/service/src/main/java/bio/terra/workspace/service/resource/controlled/cloud/azure/AzureStorageAccessService.java +++ b/service/src/main/java/bio/terra/workspace/service/resource/controlled/cloud/azure/AzureStorageAccessService.java @@ -266,7 +266,7 @@ public AzureSasBundle createAzureStorageContainerSasToken( URLDecoder.decode(sig, StandardCharsets.UTF_8)) .toUpperCase(); - var azureEnv = crlService.getAzureEnvironmentFromName(azureConfiguration.getAzureEnvironment()); + var azureEnv = azureConfiguration.getAzureEnvironment(); logger.info( "SAS token with expiry time of {} generated for user {} [SubjectId={}] on container {} in workspace {} [sha256 = {}] [AzureEnvironment portal = {}]", From 6d1ff4139a196ee276d573c9b20ad652f0de79bd Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Mon, 4 Nov 2024 12:35:07 -0500 Subject: [PATCH 10/20] update azure environment config --- azureDatabaseUtils/src/main/resources/application.yml | 7 +++++-- .../app/configuration/external/AzureConfiguration.java | 2 ++ .../cloud/azure/database/AzureDatabaseUtilsRunner.java | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/azureDatabaseUtils/src/main/resources/application.yml b/azureDatabaseUtils/src/main/resources/application.yml index 9783c283bb..7ca021968e 100644 --- a/azureDatabaseUtils/src/main/resources/application.yml +++ b/azureDatabaseUtils/src/main/resources/application.yml @@ -1,7 +1,9 @@ env: db: - host: ${DB_SERVER_NAME}.postgres.database.azure.com:5432 - url: ${DB_SERVER_NAME}.postgres.database.azure.com + host: '#{"${AZURE_ENVIRONMENT:}".equals("AZURE_GOV")?${DB_SERVER_NAME}.postgres.database.usgovcloudapi.net:5432":"${DB_SERVER_NAME}.postgres.database.azure.com:5432"}' + #host: ${DB_SERVER_NAME}.postgres.database.azure.com:5432 + url: '#{"${AZURE_ENVIRONMENT:}".equals("AZURE_GOV")?${DB_SERVER_NAME}.postgres.database.usgovcloudapi.net":"${DB_SERVER_NAME}.postgres.database.azure.com"}' + #url: ${DB_SERVER_NAME}.postgres.database.azure.com port: 5432 user: ${ADMIN_DB_USER_NAME} connectToDatabase: ${CONNECT_TO_DATABASE:postgres} @@ -16,6 +18,7 @@ env: blobContainerName: ${BLOB_CONTAINER_NAME} blobContainerUrlAuthenticated: ${BLOB_CONTAINER_URL_AUTHENTICATED} encryptionKey: ${ENCRYPTION_KEY} + azureEnvironment: ${AZURE_ENVIRONMENT} spring: diff --git a/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java b/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java index 3f81f01a4a..d6ea6d955d 100644 --- a/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java +++ b/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java @@ -39,6 +39,8 @@ public AzureEnvironment getAzureEnvironment() { } } + public String getAzureEnvironmentConfigString(){return this.azureEnvironment;} + public void setAzureEnvironment(String azureEnvironment) { this.azureEnvironment = azureEnvironment; } diff --git a/service/src/main/java/bio/terra/workspace/service/resource/controlled/cloud/azure/database/AzureDatabaseUtilsRunner.java b/service/src/main/java/bio/terra/workspace/service/resource/controlled/cloud/azure/database/AzureDatabaseUtilsRunner.java index a105f6d04c..a20079f601 100644 --- a/service/src/main/java/bio/terra/workspace/service/resource/controlled/cloud/azure/database/AzureDatabaseUtilsRunner.java +++ b/service/src/main/java/bio/terra/workspace/service/resource/controlled/cloud/azure/database/AzureDatabaseUtilsRunner.java @@ -79,6 +79,8 @@ public class AzureDatabaseUtilsRunner { public static final String PARAM_CONNECT_TO_DATABASE = "CONNECT_TO_DATABASE"; public static final String PARAM_NEW_DB_USER_NAME = "NEW_DB_USER_NAME"; public static final String PARAM_NEW_DB_USER_OID = "NEW_DB_USER_OID"; + public static final String PARAM_AZURE_ENVIRONMENT = "AZURE_ENVIRONMENT"; + // Workflow cloning - TODO: which params can be reused? public static final String PARAM_BLOB_FILE_NAME = "BLOB_FILE_NAME"; @@ -597,6 +599,7 @@ private V1Pod createPodDefinition(UUID workspaceId, String podName, List new IllegalStateException("No shared database admin identity found"))); List envVarsWithCommonArgs = new ArrayList<>(); + envVarsWithCommonArgs.add(new V1EnvVar().name(PARAM_AZURE_ENVIRONMENT).value(azureConfig.getAzureEnvironmentConfigString())); envVarsWithCommonArgs.add(new V1EnvVar().name(PARAM_DB_SERVER_NAME).value(dbServerName)); envVarsWithCommonArgs.add(new V1EnvVar().name(PARAM_ADMIN_DB_USER_NAME).value(adminDbUserName)); envVarsWithCommonArgs.addAll(envVars); From 5a16ece63a22e430e8faf545e5ba098d2d8163c4 Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Thu, 7 Nov 2024 15:37:07 -0500 Subject: [PATCH 11/20] Update application.yml --- azureDatabaseUtils/src/main/resources/application.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/azureDatabaseUtils/src/main/resources/application.yml b/azureDatabaseUtils/src/main/resources/application.yml index 7ca021968e..d06907f609 100644 --- a/azureDatabaseUtils/src/main/resources/application.yml +++ b/azureDatabaseUtils/src/main/resources/application.yml @@ -1,10 +1,14 @@ +azureEnvironmentConfig: + AZURE_GOV: ${DB_SERVER_NAME}.postgres.database.usgovcloudapi.net + AZURE: ${DB_SERVER_NAME}.postgres.database.azure.com + env: db: - host: '#{"${AZURE_ENVIRONMENT:}".equals("AZURE_GOV")?${DB_SERVER_NAME}.postgres.database.usgovcloudapi.net:5432":"${DB_SERVER_NAME}.postgres.database.azure.com:5432"}' + port: 5432 + host: ${azureEnvironmentConfig.${AZURE_ENVIRONMENT:AZURE}}\:${env.db.port} #host: ${DB_SERVER_NAME}.postgres.database.azure.com:5432 - url: '#{"${AZURE_ENVIRONMENT:}".equals("AZURE_GOV")?${DB_SERVER_NAME}.postgres.database.usgovcloudapi.net":"${DB_SERVER_NAME}.postgres.database.azure.com"}' + url: ${azureEnvironmentConfig.${AZURE_ENVIRONMENT:AZURE}} #url: ${DB_SERVER_NAME}.postgres.database.azure.com - port: 5432 user: ${ADMIN_DB_USER_NAME} connectToDatabase: ${CONNECT_TO_DATABASE:postgres} params: From 5feb939315954f1902e373c35195b990747834fe Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Thu, 7 Nov 2024 16:15:05 -0500 Subject: [PATCH 12/20] Update application.yml --- azureDatabaseUtils/src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azureDatabaseUtils/src/main/resources/application.yml b/azureDatabaseUtils/src/main/resources/application.yml index d06907f609..ab7124980c 100644 --- a/azureDatabaseUtils/src/main/resources/application.yml +++ b/azureDatabaseUtils/src/main/resources/application.yml @@ -5,7 +5,7 @@ azureEnvironmentConfig: env: db: port: 5432 - host: ${azureEnvironmentConfig.${AZURE_ENVIRONMENT:AZURE}}\:${env.db.port} + host: ${azureEnvironmentConfig.${AZURE_ENVIRONMENT:AZURE}}:5432 #host: ${DB_SERVER_NAME}.postgres.database.azure.com:5432 url: ${azureEnvironmentConfig.${AZURE_ENVIRONMENT:AZURE}} #url: ${DB_SERVER_NAME}.postgres.database.azure.com From f7f36764387fc89a785e1ab4b3cad69da67ee101 Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Mon, 18 Nov 2024 14:22:06 -0500 Subject: [PATCH 13/20] update azure environment config --- azureDatabaseUtils/src/main/resources/application.yml | 8 ++++---- .../app/configuration/external/AzureConfiguration.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/azureDatabaseUtils/src/main/resources/application.yml b/azureDatabaseUtils/src/main/resources/application.yml index ab7124980c..01f55bcb4d 100644 --- a/azureDatabaseUtils/src/main/resources/application.yml +++ b/azureDatabaseUtils/src/main/resources/application.yml @@ -1,13 +1,13 @@ azureEnvironmentConfig: - AZURE_GOV: ${DB_SERVER_NAME}.postgres.database.usgovcloudapi.net - AZURE: ${DB_SERVER_NAME}.postgres.database.azure.com + AzureUSGovernmentCloud: ${DB_SERVER_NAME}.postgres.database.usgovcloudapi.net + AzureCloud: ${DB_SERVER_NAME}.postgres.database.azure.com env: db: port: 5432 - host: ${azureEnvironmentConfig.${AZURE_ENVIRONMENT:AZURE}}:5432 + host: ${azureEnvironmentConfig.${AZURE_ENVIRONMENT:AzureCloud}}:5432 #host: ${DB_SERVER_NAME}.postgres.database.azure.com:5432 - url: ${azureEnvironmentConfig.${AZURE_ENVIRONMENT:AZURE}} + url: ${azureEnvironmentConfig.${AZURE_ENVIRONMENT:AzureCloud}} #url: ${DB_SERVER_NAME}.postgres.database.azure.com user: ${ADMIN_DB_USER_NAME} connectToDatabase: ${CONNECT_TO_DATABASE:postgres} diff --git a/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java b/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java index d6ea6d955d..b15a92e2d0 100644 --- a/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java +++ b/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java @@ -30,8 +30,8 @@ public class AzureConfiguration { public AzureEnvironment getAzureEnvironment() { try { return switch (azureEnvironment.toUpperCase()) { - case "AZURE_GOV" -> AzureEnvironment.AZURE_US_GOVERNMENT; - case "AZURE_CHINA" -> AzureEnvironment.AZURE_CHINA; + case "AzureUSGovernmentCloud" -> AzureEnvironment.AZURE_US_GOVERNMENT; + case "AzureCloud" -> AzureEnvironment.AZURE; default -> AzureEnvironment.AZURE; }; } catch (IllegalArgumentException e) { From 286df3f9df0e14881184376f919c8b71ac9a52d0 Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Tue, 19 Nov 2024 19:48:24 -0500 Subject: [PATCH 14/20] Update AzureConfiguration.java --- .../app/configuration/external/AzureConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java b/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java index b15a92e2d0..f8866ed65c 100644 --- a/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java +++ b/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java @@ -29,7 +29,7 @@ public class AzureConfiguration { public AzureEnvironment getAzureEnvironment() { try { - return switch (azureEnvironment.toUpperCase()) { + return switch (azureEnvironment) { case "AzureUSGovernmentCloud" -> AzureEnvironment.AZURE_US_GOVERNMENT; case "AzureCloud" -> AzureEnvironment.AZURE; default -> AzureEnvironment.AZURE; From ec8fad7a3f868e59a75f0dc176516e11a8fe3783 Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Tue, 10 Dec 2024 10:43:36 -0500 Subject: [PATCH 15/20] cleanup --- .../groovy/terra-workspace-manager.java-conventions.gradle | 2 +- service/dependencies.gradle | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/groovy/terra-workspace-manager.java-conventions.gradle b/buildSrc/src/main/groovy/terra-workspace-manager.java-conventions.gradle index 433d7b927e..2451cdac5a 100644 --- a/buildSrc/src/main/groovy/terra-workspace-manager.java-conventions.gradle +++ b/buildSrc/src/main/groovy/terra-workspace-manager.java-conventions.gradle @@ -7,7 +7,7 @@ plugins { id 'com.srcclr.gradle' } -def useMavenLocal = true +def useMavenLocal = false repositories { if (useMavenLocal) { mavenLocal() diff --git a/service/dependencies.gradle b/service/dependencies.gradle index aa0f4dfb2e..a89184c653 100644 --- a/service/dependencies.gradle +++ b/service/dependencies.gradle @@ -44,8 +44,8 @@ dependencies { implementation group: 'bio.terra', name: 'terra-cloud-resource-lib', version: "1.2.31-SNAPSHOT" // Terra Landing Zone Service - implementation ('bio.terra:terra-landing-zone-service:0.0.367-DEV') - implementation ('bio.terra:landing-zone-service-client:0.0.367-DEV') + implementation ('bio.terra:terra-landing-zone-service:0.0.367-SNAPSHOT') + implementation ('bio.terra:landing-zone-service-client:0.0.367-SNAPSHOT') // Storage transfer service implementation group: 'com.google.apis', name: 'google-api-services-storagetransfer', version: 'v1-rev20230831-2.0.0' From e6227e1a4de396faabaaeb97c9a4b68341b51863 Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Mon, 16 Dec 2024 21:59:39 -0500 Subject: [PATCH 16/20] cleanup --- azureDatabaseUtils/src/main/resources/application.yml | 2 -- service/src/main/resources/application.yml | 1 - settings.gradle | 1 - 3 files changed, 4 deletions(-) diff --git a/azureDatabaseUtils/src/main/resources/application.yml b/azureDatabaseUtils/src/main/resources/application.yml index 01f55bcb4d..ce97767045 100644 --- a/azureDatabaseUtils/src/main/resources/application.yml +++ b/azureDatabaseUtils/src/main/resources/application.yml @@ -6,9 +6,7 @@ env: db: port: 5432 host: ${azureEnvironmentConfig.${AZURE_ENVIRONMENT:AzureCloud}}:5432 - #host: ${DB_SERVER_NAME}.postgres.database.azure.com:5432 url: ${azureEnvironmentConfig.${AZURE_ENVIRONMENT:AzureCloud}} - #url: ${DB_SERVER_NAME}.postgres.database.azure.com user: ${ADMIN_DB_USER_NAME} connectToDatabase: ${CONNECT_TO_DATABASE:postgres} params: diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml index 70a9b6955e..8057002b8d 100644 --- a/service/src/main/resources/application.yml +++ b/service/src/main/resources/application.yml @@ -166,7 +166,6 @@ workspace: state: operating azure: - azureEnvironment: AZURE sas-token-start-time-minutes-offset: 15 sas-token-expiry-time-minutes-offset: 60 sas-token-expiry-time-maximum-minutes-offset: 1440 diff --git a/settings.gradle b/settings.gradle index ea8990df2b..3edbb99a9a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -11,7 +11,6 @@ pluginManagement { } } } - mavenLocal() maven { url "https://broadinstitute.jfrog.io/broadinstitute/libs-snapshot-local/" } From ef9f2862a22253705e741a22b7403eab1a8d19f6 Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Mon, 16 Dec 2024 22:04:50 -0500 Subject: [PATCH 17/20] Update application.yml --- azureDatabaseUtils/src/main/resources/application.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/azureDatabaseUtils/src/main/resources/application.yml b/azureDatabaseUtils/src/main/resources/application.yml index ce97767045..38b90b3905 100644 --- a/azureDatabaseUtils/src/main/resources/application.yml +++ b/azureDatabaseUtils/src/main/resources/application.yml @@ -1,12 +1,13 @@ azureEnvironmentConfig: - AzureUSGovernmentCloud: ${DB_SERVER_NAME}.postgres.database.usgovcloudapi.net - AzureCloud: ${DB_SERVER_NAME}.postgres.database.azure.com + dbHostNames: + AzureUSGovernmentCloud: ${DB_SERVER_NAME}.postgres.database.usgovcloudapi.net + AzureCloud: ${DB_SERVER_NAME}.postgres.database.azure.com env: db: port: 5432 - host: ${azureEnvironmentConfig.${AZURE_ENVIRONMENT:AzureCloud}}:5432 - url: ${azureEnvironmentConfig.${AZURE_ENVIRONMENT:AzureCloud}} + host: ${azureEnvironmentConfig.dbHostNames.${AZURE_ENVIRONMENT:AzureCloud}}:5432 + url: ${azureEnvironmentConfig.dbHostNames.${AZURE_ENVIRONMENT:AzureCloud}} user: ${ADMIN_DB_USER_NAME} connectToDatabase: ${CONNECT_TO_DATABASE:postgres} params: From 992a70c4513c3314848472bc1db7a82dcb297ced Mon Sep 17 00:00:00 2001 From: bennettn4 <117685842+bennettn4@users.noreply.github.com> Date: Mon, 20 Jan 2025 23:35:51 -0500 Subject: [PATCH 18/20] spotless --- .../app/configuration/external/AzureConfiguration.java | 9 ++++----- .../java/bio/terra/workspace/common/utils/AuthUtils.java | 3 ++- .../java/bio/terra/workspace/service/crl/CrlService.java | 2 -- .../cloud/azure/database/AzureDatabaseUtilsRunner.java | 6 ++++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java b/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java index f8866ed65c..6d929105d5 100644 --- a/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java +++ b/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java @@ -1,8 +1,7 @@ package bio.terra.workspace.app.configuration.external; -import java.util.List; - import com.azure.core.management.AzureEnvironment; +import java.util.List; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Configuration; @@ -39,7 +38,9 @@ public AzureEnvironment getAzureEnvironment() { } } - public String getAzureEnvironmentConfigString(){return this.azureEnvironment;} + public String getAzureEnvironmentConfigString() { + return this.azureEnvironment; + } public void setAzureEnvironment(String azureEnvironment) { this.azureEnvironment = azureEnvironment; @@ -149,6 +150,4 @@ public String getWsmServiceManagedIdentity() { public void setWsmServiceManagedIdentity(String wsmServiceManagedIdentity) { this.wsmServiceManagedIdentity = wsmServiceManagedIdentity; } - - } diff --git a/service/src/main/java/bio/terra/workspace/common/utils/AuthUtils.java b/service/src/main/java/bio/terra/workspace/common/utils/AuthUtils.java index c38fcc9634..ea34ad5c3f 100644 --- a/service/src/main/java/bio/terra/workspace/common/utils/AuthUtils.java +++ b/service/src/main/java/bio/terra/workspace/common/utils/AuthUtils.java @@ -21,7 +21,8 @@ public static String getAccessToken( String credentialsPath) throws IOException { if (isAzureControlPlaneEnabled) { - TokenCredential credential = new DefaultAzureCredentialBuilder() + TokenCredential credential = + new DefaultAzureCredentialBuilder() .authorityHost(azureEnvironment.getActiveDirectoryEndpoint()) .build(); // The Microsoft Authentication Library (MSAL) currently specifies offline_access, openid, diff --git a/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java b/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java index 443a7e8ecd..8eaff5e28a 100644 --- a/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java +++ b/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java @@ -26,7 +26,6 @@ import bio.terra.workspace.service.workspace.model.AzureCloudContext; import com.azure.core.credential.TokenCredential; import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; import com.azure.identity.ClientSecretCredentialBuilder; import com.azure.resourcemanager.batch.BatchManager; @@ -586,7 +585,6 @@ private AzureProfile getAzureProfile(AzureCloudContext azureCloudContext) { azureConfiguration.getAzureEnvironment()); } - @VisibleForTesting public ClientConfig getClientConfig() { assertCrlInUse(); diff --git a/service/src/main/java/bio/terra/workspace/service/resource/controlled/cloud/azure/database/AzureDatabaseUtilsRunner.java b/service/src/main/java/bio/terra/workspace/service/resource/controlled/cloud/azure/database/AzureDatabaseUtilsRunner.java index a20079f601..bd68d89d58 100644 --- a/service/src/main/java/bio/terra/workspace/service/resource/controlled/cloud/azure/database/AzureDatabaseUtilsRunner.java +++ b/service/src/main/java/bio/terra/workspace/service/resource/controlled/cloud/azure/database/AzureDatabaseUtilsRunner.java @@ -81,7 +81,6 @@ public class AzureDatabaseUtilsRunner { public static final String PARAM_NEW_DB_USER_OID = "NEW_DB_USER_OID"; public static final String PARAM_AZURE_ENVIRONMENT = "AZURE_ENVIRONMENT"; - // Workflow cloning - TODO: which params can be reused? public static final String PARAM_BLOB_FILE_NAME = "BLOB_FILE_NAME"; public static final String PARAM_DEST_WORKSPACE_ID = "DEST_WORKSPACE_ID"; @@ -599,7 +598,10 @@ private V1Pod createPodDefinition(UUID workspaceId, String podName, List new IllegalStateException("No shared database admin identity found"))); List envVarsWithCommonArgs = new ArrayList<>(); - envVarsWithCommonArgs.add(new V1EnvVar().name(PARAM_AZURE_ENVIRONMENT).value(azureConfig.getAzureEnvironmentConfigString())); + envVarsWithCommonArgs.add( + new V1EnvVar() + .name(PARAM_AZURE_ENVIRONMENT) + .value(azureConfig.getAzureEnvironmentConfigString())); envVarsWithCommonArgs.add(new V1EnvVar().name(PARAM_DB_SERVER_NAME).value(dbServerName)); envVarsWithCommonArgs.add(new V1EnvVar().name(PARAM_ADMIN_DB_USER_NAME).value(adminDbUserName)); envVarsWithCommonArgs.addAll(envVars); From c653e85d21b2fdb78f0f37112f98a244e97c0759 Mon Sep 17 00:00:00 2001 From: bennettn4 Date: Tue, 21 Jan 2025 10:49:41 -0500 Subject: [PATCH 19/20] fix tests --- .../app/configuration/external/AzureConfiguration.java | 5 +++++ .../java/bio/terra/workspace/service/crl/CrlService.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java b/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java index 6d929105d5..e547a3eaaf 100644 --- a/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java +++ b/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java @@ -27,6 +27,10 @@ public class AzureConfiguration { private String azureEnvironment; public AzureEnvironment getAzureEnvironment() { + return getAzureEnvironmentFromString(azureEnvironment); + } + + public AzureEnvironment getAzureEnvironmentFromString(String azureEnvironment){ try { return switch (azureEnvironment) { case "AzureUSGovernmentCloud" -> AzureEnvironment.AZURE_US_GOVERNMENT; @@ -38,6 +42,7 @@ public AzureEnvironment getAzureEnvironment() { } } + public String getAzureEnvironmentConfigString() { return this.azureEnvironment; } diff --git a/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java b/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java index 8eaff5e28a..46969be45e 100644 --- a/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java +++ b/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java @@ -26,6 +26,7 @@ import bio.terra.workspace.service.workspace.model.AzureCloudContext; import com.azure.core.credential.TokenCredential; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; import com.azure.identity.ClientSecretCredentialBuilder; import com.azure.resourcemanager.batch.BatchManager; @@ -585,6 +586,10 @@ private AzureProfile getAzureProfile(AzureCloudContext azureCloudContext) { azureConfiguration.getAzureEnvironment()); } + public AzureEnvironment getAzureEnvironmentFromName(String azureEnvironment) { + return azureConfiguration.getAzureEnvironmentFromString(azureEnvironment); + } + @VisibleForTesting public ClientConfig getClientConfig() { assertCrlInUse(); From 642ba0ca689a9f5ff1ce91ef7bbd1034fc1ce191 Mon Sep 17 00:00:00 2001 From: bennettn4 <117685842+bennettn4@users.noreply.github.com> Date: Tue, 21 Jan 2025 10:53:20 -0500 Subject: [PATCH 20/20] spotless --- .../app/configuration/external/AzureConfiguration.java | 3 +-- .../main/java/bio/terra/workspace/service/crl/CrlService.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java b/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java index e547a3eaaf..12c9163ebc 100644 --- a/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java +++ b/service/src/main/java/bio/terra/workspace/app/configuration/external/AzureConfiguration.java @@ -30,7 +30,7 @@ public AzureEnvironment getAzureEnvironment() { return getAzureEnvironmentFromString(azureEnvironment); } - public AzureEnvironment getAzureEnvironmentFromString(String azureEnvironment){ + public AzureEnvironment getAzureEnvironmentFromString(String azureEnvironment) { try { return switch (azureEnvironment) { case "AzureUSGovernmentCloud" -> AzureEnvironment.AZURE_US_GOVERNMENT; @@ -42,7 +42,6 @@ public AzureEnvironment getAzureEnvironmentFromString(String azureEnvironment){ } } - public String getAzureEnvironmentConfigString() { return this.azureEnvironment; } diff --git a/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java b/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java index 46969be45e..9272e49f75 100644 --- a/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java +++ b/service/src/main/java/bio/terra/workspace/service/crl/CrlService.java @@ -587,7 +587,7 @@ private AzureProfile getAzureProfile(AzureCloudContext azureCloudContext) { } public AzureEnvironment getAzureEnvironmentFromName(String azureEnvironment) { - return azureConfiguration.getAzureEnvironmentFromString(azureEnvironment); + return azureConfiguration.getAzureEnvironmentFromString(azureEnvironment); } @VisibleForTesting