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

[WX-1395] Scalafmt GitHub Action #7337

Merged
merged 21 commits into from
Dec 8, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
commit formatted files
THWiseman committed Dec 7, 2023
commit 11b7dde8c3edd2ca7c1b6c40fbccc1706ee833fd
Original file line number Diff line number Diff line change
@@ -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
}
}
48 changes: 26 additions & 22 deletions project/ContinuousIntegration.scala
Original file line number Diff line number Diff line change
@@ -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 := {
@@ -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(
@@ -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.
Original file line number Diff line number Diff line change
@@ -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 {