Search in sources :

Example 16 with Build

use of io.strimzi.api.kafka.model.connect.build.Build in project strimzi-kafka-operator by strimzi.

the class KafkaConnectDockerfileTest method testChecksumTgzArtifact.

@ParallelTest
public void testChecksumTgzArtifact() {
    Build connectBuild = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(tgzArtifactWithChecksum).build()).build();
    KafkaConnectDockerfile df = new KafkaConnectDockerfile("myImage:latest", connectBuild);
    assertThat(df.getDockerfile(), isEquivalent("FROM myImage:latest", "USER root:root", "RUN 'mkdir' '-p' '/opt/kafka/plugins/my-connector-plugin/638bd501' \\", "      && 'curl' '-L' '--output' '/opt/kafka/plugins/my-connector-plugin/638bd501.tgz' 'https://mydomain.tld/my2.tgz' \\", "      && 'echo' 'sha-512-checksum /opt/kafka/plugins/my-connector-plugin/638bd501.tgz' > '/opt/kafka/plugins/my-connector-plugin/638bd501.tgz.sha512' \\", "      && 'sha512sum' '--check' '/opt/kafka/plugins/my-connector-plugin/638bd501.tgz.sha512' \\", "      && 'rm' '-f' '/opt/kafka/plugins/my-connector-plugin/638bd501.tgz.sha512' \\", "      && 'tar' 'xvfz' '/opt/kafka/plugins/my-connector-plugin/638bd501.tgz' '-C' '/opt/kafka/plugins/my-connector-plugin/638bd501' \\", "      && 'rm' '-vf' '/opt/kafka/plugins/my-connector-plugin/638bd501.tgz'", "USER 1001"));
}
Also used : Build(io.strimzi.api.kafka.model.connect.build.Build) PluginBuilder(io.strimzi.api.kafka.model.connect.build.PluginBuilder) BuildBuilder(io.strimzi.api.kafka.model.connect.build.BuildBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 17 with Build

use of io.strimzi.api.kafka.model.connect.build.Build in project strimzi-kafka-operator by strimzi.

the class KafkaConnectDockerfileTest method testEmptyDockerfile.

@ParallelTest
public void testEmptyDockerfile() {
    Build connectBuild = new BuildBuilder().withPlugins(emptyList()).build();
    KafkaConnectDockerfile df = new KafkaConnectDockerfile("myImage:latest", connectBuild);
    assertThat(df.getDockerfile(), isEquivalent("FROM myImage:latest", "USER root:root", "USER 1001"));
}
Also used : Build(io.strimzi.api.kafka.model.connect.build.Build) BuildBuilder(io.strimzi.api.kafka.model.connect.build.BuildBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 18 with Build

use of io.strimzi.api.kafka.model.connect.build.Build in project strimzi-kafka-operator by strimzi.

the class KafkaConnectDockerfileTest method testDockerfileWithComments.

@ParallelTest
public void testDockerfileWithComments() {
    Build connectBuild = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(jarArtifactNoChecksum, jarArtifactWithChecksum).build()).build();
    KafkaConnectDockerfile df = new KafkaConnectDockerfile("myImage:latest", connectBuild);
    assertThat(df.getDockerfile(), is("##############################\n" + "##############################\n" + "# This file is automatically generated by the Strimzi Cluster Operator\n" + "# Any changes to this file will be ignored and overwritten!\n" + "##############################\n" + "##############################\n" + "\n" + "FROM myImage:latest\n" + "\n" + "USER root:root\n" + "\n" + "##########\n" + "# Connector plugin my-connector-plugin\n" + "##########\n" + "RUN 'mkdir' '-p' '/opt/kafka/plugins/my-connector-plugin/51e5038c' \\\n" + "      && 'curl' '-L' '--output' '/opt/kafka/plugins/my-connector-plugin/51e5038c/51e5038c.jar' 'https://mydomain.tld/my.jar'\n" + "\n" + "RUN 'mkdir' '-p' '/opt/kafka/plugins/my-connector-plugin/0df6d15c' \\\n" + "      && 'curl' '-L' '--output' '/opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar' 'https://mydomain.tld/my2.jar' \\\n" + "      && 'echo' 'sha-512-checksum /opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar' > '/opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar.sha512' \\\n" + "      && 'sha512sum' '--check' '/opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar.sha512' \\\n" + "      && 'rm' '-f' '/opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar.sha512'\n" + "\n" + "USER 1001\n\n"));
}
Also used : Build(io.strimzi.api.kafka.model.connect.build.Build) PluginBuilder(io.strimzi.api.kafka.model.connect.build.PluginBuilder) BuildBuilder(io.strimzi.api.kafka.model.connect.build.BuildBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 19 with Build

use of io.strimzi.api.kafka.model.connect.build.Build in project strimzi by strimzi.

the class KafkaConnectDockerfileTest method testNoChecksumOtherArtifact.

@ParallelTest
public void testNoChecksumOtherArtifact() {
    Build connectBuild = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(otherArtifactNoChecksum).build()).build();
    KafkaConnectDockerfile df = new KafkaConnectDockerfile("myImage:latest", connectBuild);
    assertThat(df.getDockerfile(), isEquivalent("FROM myImage:latest", "USER root:root", "RUN 'mkdir' '-p' '/opt/kafka/plugins/my-connector-plugin/2c3b64c7' \\", "      && 'curl' '-L' '--output' '/opt/kafka/plugins/my-connector-plugin/2c3b64c7/my.so' 'https://mydomain.tld/download?artifact=my.so'", "USER 1001"));
}
Also used : Build(io.strimzi.api.kafka.model.connect.build.Build) PluginBuilder(io.strimzi.api.kafka.model.connect.build.PluginBuilder) BuildBuilder(io.strimzi.api.kafka.model.connect.build.BuildBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 20 with Build

use of io.strimzi.api.kafka.model.connect.build.Build in project strimzi by strimzi.

the class KafkaConnectDockerfileTest method testMultipleJarArtifact.

@ParallelTest
public void testMultipleJarArtifact() {
    Build connectBuild = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(jarArtifactNoChecksum, jarArtifactWithChecksum).build()).build();
    KafkaConnectDockerfile df = new KafkaConnectDockerfile("myImage:latest", connectBuild);
    assertThat(df.getDockerfile(), isEquivalent("FROM myImage:latest", "USER root:root", "RUN 'mkdir' '-p' '/opt/kafka/plugins/my-connector-plugin/51e5038c' \\", "      && 'curl' '-L' '--output' '/opt/kafka/plugins/my-connector-plugin/51e5038c/51e5038c.jar' 'https://mydomain.tld/my.jar'", "RUN 'mkdir' '-p' '/opt/kafka/plugins/my-connector-plugin/0df6d15c' \\", "      && 'curl' '-L' '--output' '/opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar' 'https://mydomain.tld/my2.jar' \\", "      && 'echo' 'sha-512-checksum /opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar' > '/opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar.sha512' \\", "      && 'sha512sum' '--check' '/opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar.sha512' \\", "      && 'rm' '-f' '/opt/kafka/plugins/my-connector-plugin/0df6d15c/0df6d15c.jar.sha512'", "USER 1001"));
}
Also used : Build(io.strimzi.api.kafka.model.connect.build.Build) PluginBuilder(io.strimzi.api.kafka.model.connect.build.PluginBuilder) BuildBuilder(io.strimzi.api.kafka.model.connect.build.BuildBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Aggregations

Build (io.strimzi.api.kafka.model.connect.build.Build)37 BuildBuilder (io.strimzi.api.kafka.model.connect.build.BuildBuilder)36 ParallelTest (io.strimzi.test.annotations.ParallelTest)36 PluginBuilder (io.strimzi.api.kafka.model.connect.build.PluginBuilder)34 JarArtifact (io.strimzi.api.kafka.model.connect.build.JarArtifact)4 JarArtifactBuilder (io.strimzi.api.kafka.model.connect.build.JarArtifactBuilder)4 MavenArtifact (io.strimzi.api.kafka.model.connect.build.MavenArtifact)4 OtherArtifact (io.strimzi.api.kafka.model.connect.build.OtherArtifact)4 OtherArtifactBuilder (io.strimzi.api.kafka.model.connect.build.OtherArtifactBuilder)4 ZipArtifact (io.strimzi.api.kafka.model.connect.build.ZipArtifact)4 ZipArtifactBuilder (io.strimzi.api.kafka.model.connect.build.ZipArtifactBuilder)4 Artifact (io.strimzi.api.kafka.model.connect.build.Artifact)2 MavenArtifactBuilder (io.strimzi.api.kafka.model.connect.build.MavenArtifactBuilder)2 TgzArtifactBuilder (io.strimzi.api.kafka.model.connect.build.TgzArtifactBuilder)2 InvalidConfigurationException (io.strimzi.operator.common.InvalidConfigurationException)2 KafkaConnect (io.strimzi.api.kafka.model.KafkaConnect)1 KafkaConnectBuilder (io.strimzi.api.kafka.model.KafkaConnectBuilder)1