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

Support for deployment in Azure Government Cloud (Workbench-Libs) #1713

Merged
merged 7 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

private def buildApplicationInsightsManager(cloudContext: AzureCloudContext): F[ApplicationInsightsManager] = {
val azureProfile =
new AzureProfile(cloudContext.tenantId.value, cloudContext.subscriptionId.value, AzureEnvironment.AZURE)
new AzureProfile(cloudContext.tenantId.value,
cloudContext.subscriptionId.value,
AzureEnvironmentConfig.fromCurrentHostingEnv()

Check warning on line 37 in azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureApplicationInsightsServiceInterp.scala

View check run for this annotation

Codecov / codecov/patch

azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureApplicationInsightsServiceInterp.scala#L35-L37

Added lines #L35 - L37 were not covered by tests
)
F.blocking(ApplicationInsightsManager.authenticate(clientSecretCredential, azureProfile))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

private def buildBatchManager(cloudContext: AzureCloudContext): F[BatchManager] = {
val azureProfile =
new AzureProfile(cloudContext.tenantId.value, cloudContext.subscriptionId.value, AzureEnvironment.AZURE)
new AzureProfile(cloudContext.tenantId.value,
cloudContext.subscriptionId.value,
AzureEnvironmentConfig.fromCurrentHostingEnv()

Check warning on line 37 in azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureBatchServiceInterp.scala

View check run for this annotation

Codecov / codecov/patch

azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureBatchServiceInterp.scala#L35-L37

Added lines #L35 - L37 were not covered by tests
)
F.blocking(BatchManager.authenticate(clientSecretCredential, azureProfile))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@

private def buildContainerServiceManager(cloudContext: AzureCloudContext): F[ContainerServiceManager] = {
val azureProfile =
new AzureProfile(cloudContext.tenantId.value, cloudContext.subscriptionId.value, AzureEnvironment.AZURE)
new AzureProfile(cloudContext.tenantId.value,
cloudContext.subscriptionId.value,
AzureEnvironmentConfig.fromCurrentHostingEnv()

Check warning on line 99 in azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureContainerServiceInterp.scala

View check run for this annotation

Codecov / codecov/patch

azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureContainerServiceInterp.scala#L97-L99

Added lines #L97 - L99 were not covered by tests
)
F.blocking(ContainerServiceManager.authenticate(clientSecretCredential, azureProfile))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.broadinstitute.dsde.workbench.azure

import com.azure.core.management.AzureEnvironment

object AzureEnvironmentConfig {
val AZURE_ENVIRONMENT_CONFIG = "AZURE_ENVIRONMENT"

Check warning on line 6 in azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureEnvironmentConfig.scala

View check run for this annotation

Codecov / codecov/patch

azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureEnvironmentConfig.scala#L6

Added line #L6 was not covered by tests

private val Azure: String = "AzureCloud"
private val AzureGov: String = "AzureUSGovernmentCloud"

Check warning on line 9 in azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureEnvironmentConfig.scala

View check run for this annotation

Codecov / codecov/patch

azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureEnvironmentConfig.scala#L8-L9

Added lines #L8 - L9 were not covered by tests

def fromString(s: String): AzureEnvironment = s match {
case AzureGov => AzureEnvironment.AZURE_US_GOVERNMENT
case Azure => AzureEnvironment.AZURE
case _ => throw new IllegalArgumentException(s"Unknown Azure environment: $s")

Check warning on line 14 in azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureEnvironmentConfig.scala

View check run for this annotation

Codecov / codecov/patch

azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureEnvironmentConfig.scala#L12-L14

Added lines #L12 - L14 were not covered by tests
}

def fromCurrentHostingEnv(): AzureEnvironment =
fromString(scala.util.Properties.envOrElse(AZURE_ENVIRONMENT_CONFIG, Azure))

Check warning on line 18 in azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureEnvironmentConfig.scala

View check run for this annotation

Codecov / codecov/patch

azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureEnvironmentConfig.scala#L18

Added line #L18 was not covered by tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@

private def buildRelayManager(azureCloudContext: AzureCloudContext): F[RelayManager] = {
val azureProfile =
new AzureProfile(azureCloudContext.tenantId.value, azureCloudContext.subscriptionId.value, AzureEnvironment.AZURE)
new AzureProfile(azureCloudContext.tenantId.value,
azureCloudContext.subscriptionId.value,
AzureEnvironmentConfig.fromCurrentHostingEnv()

Check warning on line 129 in azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureRelayInterp.scala

View check run for this annotation

Codecov / codecov/patch

azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureRelayInterp.scala#L127-L129

Added lines #L127 - L129 were not covered by tests
)

F.blocking(RelayManager.authenticate(clientSecretCredential, azureProfile))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@

private def buildComputeManager(azureCloudContext: AzureCloudContext): F[ComputeManager] = {
val azureProfile =
new AzureProfile(azureCloudContext.tenantId.value, azureCloudContext.subscriptionId.value, AzureEnvironment.AZURE)
new AzureProfile(azureCloudContext.tenantId.value,
azureCloudContext.subscriptionId.value,
AzureEnvironmentConfig.fromCurrentHostingEnv()

Check warning on line 102 in azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureVmServiceInterp.scala

View check run for this annotation

Codecov / codecov/patch

azure/src/main/scala/org/broadinstitute/dsde/workbench/azure/AzureVmServiceInterp.scala#L100-L102

Added lines #L100 - L102 were not covered by tests
)
F.blocking(ComputeManager.authenticate(clientSecretCredential, azureProfile))
}

Expand Down
Loading