@@ -744,4 +744,51 @@ public void testMavenArtifactWithIncludeScope() {
744744 "USER 1001\n " +
745745 "\n " ));
746746 }
747+
748+ @ Test
749+ public void testInsecureMavenArtifactWithIncludeScope () {
750+ MavenArtifact mvn = new MavenArtifactBuilder ()
751+ .withRepository ("https://my-maven-repository.com/maven2" )
752+ .withGroup ("g1" )
753+ .withArtifact ("a1" )
754+ .withVersion ("v1" )
755+ .withInsecure (true )
756+ .withIncludeScope (io .strimzi .api .kafka .model .connect .build .MavenArtifactIncludeScope .RUNTIME )
757+ .build ();
758+
759+ Build connectBuild = new BuildBuilder ()
760+ .withPlugins (
761+ new PluginBuilder ()
762+ .withName ("my-connector-plugin" )
763+ .withArtifacts (mvn )
764+ .build ())
765+ .build ();
766+
767+ KafkaConnectDockerfile df = new KafkaConnectDockerfile ("myImage:latest" , connectBuild , SHARED_ENV_PROVIDER );
768+
769+ assertThat (df .getDockerfile (), is ("##############################\n " +
770+ "##############################\n " +
771+ "# This file is automatically generated by the Strimzi Cluster Operator\n " +
772+ "# Any changes to this file will be ignored and overwritten!\n " +
773+ "##############################\n " +
774+ "##############################\n " +
775+ "\n " +
776+ "FROM quay.io/strimzi/maven-builder:latest AS downloadArtifacts\n " +
777+ "RUN 'curl' '-f' '-k' '-L' '--create-dirs' '--output' '/tmp/my-connector-plugin/64cebd9c/pom.xml' 'https://my-maven-repository.com/maven2/g1/a1/v1/a1-v1.pom' \\ \n " +
778+ " && 'echo' '<settings xmlns=\" http://maven.apache.org/SETTINGS/1.0.0\" ><profiles><profile><id>download</id><repositories><repository><id>custom-repo</id><url>https://my-maven-repository.com/maven2/</url></repository></repositories></profile></profiles><activeProfiles><activeProfile>download</activeProfile></activeProfiles></settings>' > '/tmp/64cebd9c.xml' \\ \n " +
779+ " && 'mvn' 'dependency:copy-dependencies' '-s' '/tmp/64cebd9c.xml' '-DoutputDirectory=/tmp/artifacts/my-connector-plugin/64cebd9c' '-DincludeScope=runtime' '-Daether.connector.https.securityMode=insecure' '-Dmaven.wagon.http.ssl.insecure=true' '-Dmaven.wagon.http.ssl.allowall=true' '-Dmaven.wagon.http.ssl.ignore.validity.dates=true' '-f' '/tmp/my-connector-plugin/64cebd9c/pom.xml' \\ \n " +
780+ " && 'curl' '-f' '-k' '-L' '--create-dirs' '--output' '/tmp/artifacts/my-connector-plugin/64cebd9c/a1-v1.jar' 'https://my-maven-repository.com/maven2/g1/a1/v1/a1-v1.jar'\n " +
781+ "\n " +
782+ "FROM myImage:latest\n " +
783+ "\n " +
784+ "USER root:root\n " +
785+ "\n " +
786+ "##########\n " +
787+ "# Connector plugin my-connector-plugin\n " +
788+ "##########\n " +
789+ "COPY --from=downloadArtifacts '/tmp/artifacts/my-connector-plugin/64cebd9c' '/opt/kafka/plugins/my-connector-plugin/64cebd9c'\n " +
790+ "\n " +
791+ "USER 1001\n " +
792+ "\n " ));
793+ }
747794}
0 commit comments