Search in sources :

Example 26 with Build

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

the class KafkaConnectDockerfileTest method testNoArtifacts.

@ParallelTest
public void testNoArtifacts() {
    Build connectBuild = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(emptyList()).build()).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) 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 27 with Build

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

the class KafkaConnectDockerfileTest method testNoChecksumZipArtifact.

@ParallelTest
public void testNoChecksumZipArtifact() {
    Build connectBuild = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(zipArtifactNoChecksum).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/d8d533bc' \\", "      && 'curl' '-L' '--output' '/opt/kafka/plugins/my-connector-plugin/d8d533bc.zip' 'https://mydomain.tld/my.zip' \\", "      && 'unzip' '/opt/kafka/plugins/my-connector-plugin/d8d533bc.zip' '-d' '/opt/kafka/plugins/my-connector-plugin/d8d533bc' \\", "      && 'find' '/opt/kafka/plugins/my-connector-plugin/d8d533bc' '-type' 'l' | 'xargs' 'rm' '-f' \\", "      && 'rm' '-vf' '/opt/kafka/plugins/my-connector-plugin/d8d533bc.zip'", "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 28 with Build

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

the class KafkaConnectDockerfileTest method testMultipleTgzArtifact.

@ParallelTest
public void testMultipleTgzArtifact() {
    Build connectBuild = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(tgzArtifactNoChecksum, 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/6718766b' \\", "      && 'curl' '-L' '--output' '/opt/kafka/plugins/my-connector-plugin/6718766b.tgz' 'https://mydomain.tld/my.tgz' \\", "      && 'tar' 'xvfz' '/opt/kafka/plugins/my-connector-plugin/6718766b.tgz' '-C' '/opt/kafka/plugins/my-connector-plugin/6718766b' \\", "      && 'rm' '-vf' '/opt/kafka/plugins/my-connector-plugin/6718766b.tgz'", "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 29 with Build

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

the class KafkaConnectDockerfileTest method testNoUrlWhenRequired.

@ParallelTest
public void testNoUrlWhenRequired() {
    Artifact tgzArtifact = new TgzArtifactBuilder().build();
    Artifact jarArtifact = new JarArtifactBuilder().build();
    Artifact zipArtifact = new ZipArtifactBuilder().build();
    Artifact otherArtifact = new OtherArtifactBuilder().build();
    Build connectBuildTgz = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(singletonList(tgzArtifact)).build()).build();
    Throwable e = assertThrows(InvalidConfigurationException.class, () -> new KafkaConnectDockerfile("myImage:latest", connectBuildTgz));
    assertThat(e.getMessage(), is("`tgz` artifact is missing a URL."));
    Build connectBuildZip = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(singletonList(zipArtifact)).build()).build();
    e = assertThrows(InvalidConfigurationException.class, () -> new KafkaConnectDockerfile("myImage:latest", connectBuildZip));
    assertThat(e.getMessage(), is("`zip` artifact is missing a URL."));
    Build connectBuildJar = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(singletonList(jarArtifact)).build()).build();
    e = assertThrows(InvalidConfigurationException.class, () -> new KafkaConnectDockerfile("myImage:latest", connectBuildJar));
    assertThat(e.getMessage(), is("`jar` artifact is missing a URL."));
    Build connectBuildOther = new BuildBuilder().withPlugins(new PluginBuilder().withName("my-connector-plugin").withArtifacts(singletonList(otherArtifact)).build()).build();
    e = assertThrows(InvalidConfigurationException.class, () -> new KafkaConnectDockerfile("myImage:latest", connectBuildOther));
    assertThat(e.getMessage(), is("`other` artifact is missing a URL."));
}
Also used : ZipArtifactBuilder(io.strimzi.api.kafka.model.connect.build.ZipArtifactBuilder) Build(io.strimzi.api.kafka.model.connect.build.Build) TgzArtifactBuilder(io.strimzi.api.kafka.model.connect.build.TgzArtifactBuilder) PluginBuilder(io.strimzi.api.kafka.model.connect.build.PluginBuilder) Artifact(io.strimzi.api.kafka.model.connect.build.Artifact) ZipArtifact(io.strimzi.api.kafka.model.connect.build.ZipArtifact) OtherArtifact(io.strimzi.api.kafka.model.connect.build.OtherArtifact) MavenArtifact(io.strimzi.api.kafka.model.connect.build.MavenArtifact) JarArtifact(io.strimzi.api.kafka.model.connect.build.JarArtifact) OtherArtifactBuilder(io.strimzi.api.kafka.model.connect.build.OtherArtifactBuilder) JarArtifactBuilder(io.strimzi.api.kafka.model.connect.build.JarArtifactBuilder) BuildBuilder(io.strimzi.api.kafka.model.connect.build.BuildBuilder) InvalidConfigurationException(io.strimzi.operator.common.InvalidConfigurationException) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 30 with Build

use of io.strimzi.api.kafka.model.connect.build.Build in project strimzi-kafka-operator 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)

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