Skip to content

Commit

Permalink
#175 Add worker definition config to build config provided to worker
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Apr 4, 2019
1 parent 0224539 commit d16a2a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion app/org/thp/cortex/services/DockerJobRunnerSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ class DockerJobRunnerSrv(client: DockerClient, autoUpdate: Boolean, implicit val
"errorMessage" -> message)
Files.write(jobDirectory.resolve("output").resolve("output.json"), report.toString.getBytes(StandardCharsets.UTF_8))
}
client.removeContainer(containerCreation.id())
}
timeout.fold(execution)(t execution.withTimeout(t, client.stopContainer(containerCreation.id(), 3)))
.andThen {
Expand Down
6 changes: 5 additions & 1 deletion app/org/thp/cortex/services/JobRunnerSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ class JobRunnerSrv @Inject() (
.map { artifact
val proxy_http = (worker.config \ "proxy_http").asOpt[String].fold(JsObject.empty) { proxy Json.obj("proxy" Json.obj("http" proxy)) }
val proxy_https = (worker.config \ "proxy_https").asOpt[String].fold(JsObject.empty) { proxy Json.obj("proxy" Json.obj("https" proxy)) }
val config = worker.config.deepMerge(proxy_http).deepMerge(proxy_https)
val config = workerSrv.getDefinition(worker.workerDefinitionId())
.fold(_ JsObject.empty, _.configuration)
.deepMerge(worker.config)
.deepMerge(proxy_http)
.deepMerge(proxy_https)
(worker.config \ "cacerts").asOpt[String].foreach { cacerts
val cacertsFile = jobFolder.resolve("input").resolve("cacerts")
Files.write(cacertsFile, cacerts.getBytes)
Expand Down

0 comments on commit d16a2a8

Please sign in to comment.