Skip to content

Commit

Permalink
commit formatted files
Browse files Browse the repository at this point in the history
  • Loading branch information
THWiseman committed Dec 7, 2023
1 parent 88531c9 commit 11b7dde
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ object DockerCredentials {
object DockerCredentialUsernameAndPassword {
private val tokenStringFormat = raw"([^:]*):(.*)".r

def unapply(arg: DockerCredentials): Option[(String, String)] = Try(new String(Base64.getDecoder.decode(arg.token))).toOption match {case Some(tokenStringFormat(username, password)) => Some((username, password))
def unapply(arg: DockerCredentials): Option[(String, String)] = Try(
new String(Base64.getDecoder.decode(arg.token))
).toOption match {
case Some(tokenStringFormat(username, password)) => Some((username, password))
case _ => None
}
}
Expand Down
48 changes: 26 additions & 22 deletions project/ContinuousIntegration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object ContinuousIntegration {
lazy val ciSettings: Seq[Setting[_]] = List(
srcCiResources := sourceDirectory.value / "ci" / "resources",
targetCiResources := target.value / "ci" / "resources",
envFile := srcCiResources.value / "env.temp", //generated by resources/acquire_b2c_token.sh
envFile := srcCiResources.value / "env.temp", // generated by resources/acquire_b2c_token.sh

vaultToken := userHome / ".vault-token",
copyCiResources := {
Expand All @@ -31,29 +31,32 @@ object ContinuousIntegration {

// Only include the local file argument if the file exists (local development w/ acquire_b2c_token.sh)
// Don't include it otherwise (CI/CD and other development)
val localEnvFileArgs = if(envFile.value.exists()) List("-e", s"ENV_FILE=${envFile.value}") else List()
val localEnvFileArgs = if (envFile.value.exists()) List("-e", s"ENV_FILE=${envFile.value}") else List()

val cmd: List[String] = List.concat(List(
"docker",
"run",
"--rm",
"-v",
s"${vaultToken.value}:/root/.vault-token",
"-v",
s"${srcCiResources.value}:${srcCiResources.value}",
"-v",
s"${targetCiResources.value}:${targetCiResources.value}"),
val cmd: List[String] = List.concat(
List(
"docker",
"run",
"--rm",
"-v",
s"${vaultToken.value}:/root/.vault-token",
"-v",
s"${srcCiResources.value}:${srcCiResources.value}",
"-v",
s"${targetCiResources.value}:${targetCiResources.value}"
),
localEnvFileArgs,
List(
"-e",
"ENVIRONMENT=not_used",
"-e",
s"INPUT_PATH=${srcCiResources.value}",
"-e",
s"OUT_PATH=${targetCiResources.value}",
"broadinstitute/dsde-toolbox:dev",
"render-templates.sh"
))
"-e",
"ENVIRONMENT=not_used",
"-e",
s"INPUT_PATH=${srcCiResources.value}",
"-e",
s"OUT_PATH=${targetCiResources.value}",
"broadinstitute/dsde-toolbox:dev",
"render-templates.sh"
)
)
val result = cmd ! log
if (result != 0) {
sys.error(
Expand All @@ -79,7 +82,8 @@ object ContinuousIntegration {
private val srcCiResources: SettingKey[File] = settingKey[File]("Source directory for CI resources")
private val targetCiResources: SettingKey[File] = settingKey[File]("Target directory for CI resources")
private val vaultToken: SettingKey[File] = settingKey[File]("File with the vault token")
private val envFile: SettingKey[File] = settingKey[File]("File with the environment variables needed to render CI resources.")
private val envFile: SettingKey[File] =
settingKey[File]("File with the environment variables needed to render CI resources.")

/**
* For "reasons" these projects are excluded from the root aggregation in build.sbt.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,12 @@ class TesAsyncBackendJobExecutionActorSpec extends AnyFlatSpec with Matchers wit
val mockLogger: JobLogger = mock[JobLogger]
val emptyInputs: List[Input] = List()
val bloblessInputs: List[Input] = List(notBlobInput_1, notBlobInput_2)
TesAsyncBackendJobExecutionActor.determineWSMSasEndpointFromInputs(emptyInputs, pathGetter, mockLogger, blobConverter).isFailure shouldBe true
TesAsyncBackendJobExecutionActor.determineWSMSasEndpointFromInputs(bloblessInputs, pathGetter, mockLogger, blobConverter).isFailure shouldBe true
TesAsyncBackendJobExecutionActor
.determineWSMSasEndpointFromInputs(emptyInputs, pathGetter, mockLogger, blobConverter)
.isFailure shouldBe true
TesAsyncBackendJobExecutionActor
.determineWSMSasEndpointFromInputs(bloblessInputs, pathGetter, mockLogger, blobConverter)
.isFailure shouldBe true
}

it should "return a sas endpoint based on inputs when blob paths are provided" in {
Expand Down

0 comments on commit 11b7dde

Please sign in to comment.