Skip to content
Closed
600 changes: 18 additions & 582 deletions azure-pipelines.yml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ object JarManifestModifier {
manifest.getMainAttributes.putValue(patchedByRorVersionPropertyName, rorVersion)
Using(new JarOutputStream(tempJarFile.newOutputStream.buffered, manifest)) { jarOutput =>
copyJarContentExceptManifestFile(jarFile, jarOutput)
}.getOrElse(throw new IllegalStateException(s"Could not copy content of jar file ${file.name}"))
}.failed.map(IllegalStateException(s"Could not copy content of jar file ${file.name}", _)).get
tempJarFile.moveTo(file)(File.CopyOptions(overwrite = true))
}.getOrElse(throw new IllegalStateException(s"Could not add ROR version to jar file ${file.name}"))
}.failed.map(IllegalStateException(s"Could not add ROR version to jar file ${file.name}", _)).get
}

def findPatchedFiles(esDirectory: EsDirectory): List[PatchedJarFile] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ class RorToolsAppSuite
RorToolsTestApp.run(Array("unpatch", "--es-path", esLocalPath.toString))(_)
}
unpatchResult should equal(Result.Failure)

// The assertion cannot check specific filenames, because they are ES-version specific
unpatchOutput should include(
s"""Checking if Elasticsearch is patched ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class ExampleEsWithRorContainer(implicit scheduler: Scheduler) extends EsContain
),
initializer = nodeDataInitializer,
startedClusterDependencies = startedClusterDependencies,
customEntrypoint = Some(Path("""/bin/sh -c "while true; do sleep 30; done"""")),
customEntrypoint = Some("""/bin/sh -c "while true; do sleep 30; done""""),
awaitingReadyStrategy = AwaitingReadyStrategy.ImmediatelyTreatAsReady,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package tech.beshu.ror.utils.containers

import com.typesafe.scalalogging.StrictLogging
import org.testcontainers.images.builder.ImageFromDockerfile
import os.Path
import tech.beshu.ror.utils.containers.ElasticsearchNodeWaitingStrategy.AwaitingReadyStrategy
import tech.beshu.ror.utils.containers.images.domain.Enabled
import tech.beshu.ror.utils.containers.images.{DockerImageCreator, Elasticsearch, ReadonlyRestWithEnabledXpackSecurityPlugin}
Expand Down Expand Up @@ -63,7 +62,7 @@ object EsContainerWithRorAndXpackSecurity extends StrictLogging {
securityConfig: ReadonlyRestWithEnabledXpackSecurityPlugin.Config,
initializer: ElasticsearchNodeDataInitializer,
startedClusterDependencies: StartedClusterDependencies,
customEntrypoint: Option[Path],
customEntrypoint: Option[String],
awaitingReadyStrategy: AwaitingReadyStrategy): EsContainer = {
create(
esVersion = esVersion,
Expand All @@ -82,7 +81,7 @@ object EsContainerWithRorAndXpackSecurity extends StrictLogging {
securityConfig: ReadonlyRestWithEnabledXpackSecurityPlugin.Config,
initializer: ElasticsearchNodeDataInitializer,
startedClusterDependencies: StartedClusterDependencies,
customEntrypoint: Option[Path],
customEntrypoint: Option[String],
performPatching: Boolean,
awaitingReadyStrategy: AwaitingReadyStrategy): EsContainer = {
val rorContainer = new EsContainerWithRorAndXpackSecurity(
Expand All @@ -101,7 +100,7 @@ object EsContainerWithRorAndXpackSecurity extends StrictLogging {
private def esImageWithRorAndXpackFromDockerfile(esVersion: String,
esConfig: Elasticsearch.Config,
securityConfig: ReadonlyRestWithEnabledXpackSecurityPlugin.Config,
customEntrypoint: Option[Path],
customEntrypoint: Option[String],
performPatching: Boolean) = {
DockerImageCreator.create(
Elasticsearch.create(esVersion, esConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ object DockerImageCreator extends StrictLogging {
def setEntrypointFrom(imageDescription: DockerImageDescription): DockerfileBuilder = {
imageDescription
.entrypoint
.foldLeft(builder) { case (b, entrypoint) => b.entryPoint(entrypoint.toIO.getAbsolutePath) }
.foldLeft(builder) { case (b, entrypoint) => b.entryPoint(entrypoint) }
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final case class DockerImageDescription(baseImage: String,
runCommands: Seq[Command],
copyFiles: Set[CopyFile],
envs: Set[Env],
entrypoint: Option[Path]) {
entrypoint: Option[String]) {

def run(command: String): DockerImageDescription = {
this.copy(runCommands = this.runCommands :+ Command.Run(command))
Expand Down Expand Up @@ -61,7 +61,7 @@ final case class DockerImageDescription(baseImage: String,
this.copy(envs = this.envs ++ envs.map { case (k, v) => Env(k, v) })
}

def setEntrypoint(entrypoint: Path): DockerImageDescription = {
def setEntrypoint(entrypoint: String): DockerImageDescription = {
this.copy(entrypoint = Some(entrypoint))
}
}
Expand All @@ -75,7 +75,7 @@ object DockerImageDescription {
final case class CopyFile(destination: Path, file: File)
final case class Env(name: String, value: String)

def create(image: String, customEntrypoint: Option[Path] = None): DockerImageDescription = DockerImageDescription(
def create(image: String, customEntrypoint: Option[String] = None): DockerImageDescription = DockerImageDescription(
baseImage = image,
runCommands = Seq.empty,
copyFiles = Set.empty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ object Elasticsearch {
class Elasticsearch(esVersion: String,
config: Config,
plugins: Seq[Plugin],
customEntrypoint: Option[Path])
customEntrypoint: Option[String])
extends LazyLogging {

def this(esVersion: String, config: Config) = {
Expand All @@ -72,7 +72,7 @@ class Elasticsearch(esVersion: String,
new Elasticsearch(esVersion, config, plugins :+ plugin, customEntrypoint)
}

def setEntrypoint(entrypoint: Path): Elasticsearch = {
def setEntrypoint(entrypoint: String): Elasticsearch = {
new Elasticsearch(esVersion, config, plugins, Some(entrypoint))
}

Expand Down
Loading