@@ -68,7 +68,7 @@ case class DockerClientTimeoutConfig(run: Duration,
68
68
/**
69
69
* Configuration for docker client
70
70
*/
71
- case class DockerClientConfig (parallelRuns : Int , timeouts : DockerClientTimeoutConfig )
71
+ case class DockerClientConfig (parallelRuns : Int , timeouts : DockerClientTimeoutConfig , maskDockerRunArgs : Boolean )
72
72
73
73
/**
74
74
* Serves as interface to the docker CLI tool.
@@ -135,7 +135,10 @@ class DockerClient(dockerHost: Option[String] = None,
135
135
}
136
136
}.flatMap { _ =>
137
137
// Iff the semaphore was acquired successfully
138
- runCmd(Seq (" run" , " -d" ) ++ args ++ Seq (image), config.timeouts.run)
138
+ runCmd(
139
+ Seq (" run" , " -d" ) ++ args ++ Seq (image),
140
+ config.timeouts.run,
141
+ if (config.maskDockerRunArgs) Some (Seq (" run" , " -d" , " **ARGUMENTS HIDDEN**" , image)) else None )
139
142
.andThen {
140
143
// Release the semaphore as quick as possible regardless of the runCmd() result
141
144
case _ => runSemaphore.release()
@@ -200,12 +203,13 @@ class DockerClient(dockerHost: Option[String] = None,
200
203
def isOomKilled (id : ContainerId )(implicit transid : TransactionId ): Future [Boolean ] =
201
204
runCmd(Seq (" inspect" , id.asString, " --format" , " {{.State.OOMKilled}}" ), config.timeouts.inspect).map(_.toBoolean)
202
205
203
- protected def runCmd (args : Seq [String ], timeout : Duration )(implicit transid : TransactionId ): Future [String ] = {
206
+ protected def runCmd (args : Seq [String ], timeout : Duration , maskedArgs : Option [Seq [String ]] = None )(
207
+ implicit transid : TransactionId ): Future [String ] = {
204
208
val cmd = dockerCmd ++ args
205
209
val start = transid.started(
206
210
this ,
207
211
LoggingMarkers .INVOKER_DOCKER_CMD (args.head),
208
- s " running ${cmd.mkString(" " )} (timeout: $timeout) " ,
212
+ s " running ${maskedArgs.map(maskedArgs => (dockerCmd ++ maskedArgs).mkString( " " )).getOrElse( cmd.mkString(" " ) )} (timeout: $timeout) " ,
209
213
logLevel = InfoLevel )
210
214
executeProcess(cmd, timeout).andThen {
211
215
case Success (_) => transid.finished(this , start)
0 commit comments