Skip to content

Commit

Permalink
Merge pull request #485 from pcnfernando/dokcer_push_integration
Browse files Browse the repository at this point in the history
[Editor] Docker image push support and set values for templated variables in Siddhi apps
  • Loading branch information
mohanvive authored Oct 1, 2019
2 parents 37797f6 + 9a83b08 commit c1b6cdb
Show file tree
Hide file tree
Showing 32 changed files with 1,549 additions and 184 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private void testHttpResponse(String body, Event[] inputEvents, int expectedResp

@Test(dependsOnMethods = "testStoreApiBundle")
public void testSelectAllWithSuccessResponse() throws InterruptedException {
Thread.sleep(15000);
Thread.sleep(20000);
Event[] events = new Event[]{
new Event(System.currentTimeMillis(), new Object[]{
"recordId1", 10.34f, false, 1200, 300, 400, "2017-11-22"}),
Expand Down
74 changes: 74 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,68 @@
<artifactId>testcontainers</artifactId>
<version>${org.testcontainers.version}</version>
</dependency>
<dependency>
<groupId>com.spotify</groupId>
<artifactId>docker-client</artifactId>
<classifier>shaded</classifier>
<version>${com.spotify.docker.client.version}</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>${commons.lang.commons.lang.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-apache-connector</artifactId>
<version>${org.glassfish.jersey.connectors.jersey.apache.connector.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${org.apache.httpcomponents.httpclient.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>${org.glassfish.jersey.inject.jersey.hk2.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${org.glassfish.jersey.core.jersey.client.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
<version>${org.glassfish.jersey.core.jersey.common.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-api</artifactId>
<version>${org.glassfish.hk2.hk2.api.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.bundles.repackaged</groupId>
<artifactId>jersey-guava</artifactId>
<version>${org.glassfish.jersey.bundles.repackaged.jersey.guava.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
<version>${org.glassfish.hk2.external.javax.inject.version}</version>
</dependency>
<dependency>
<groupId>com.kohlschutter.junixsocket</groupId>
<artifactId>junixsocket-core</artifactId>
<version>${com.kohlschutter.junixsocket.junixsocket.core.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -1243,6 +1305,18 @@
<carbon.feature.plugin.version>3.1.4</carbon.feature.plugin.version>
<maven.resources.plugin.version>3.1.0</maven.resources.plugin.version>
<com.spotify.docker.plugin.version>1.1.1</com.spotify.docker.plugin.version>
<com.spotify.docker.client.version>8.16.0</com.spotify.docker.client.version>
<org.glassfish.jersey.connectors.jersey.apache.connector.version>2.22.2</org.glassfish.jersey.connectors.jersey.apache.connector.version>
<org.apache.httpcomponents.httpclient.version>4.5.6</org.apache.httpcomponents.httpclient.version>
<commons.lang.commons.lang.version>2.6</commons.lang.commons.lang.version>
<org.glassfish.jersey.inject.jersey.hk2.version>2.27</org.glassfish.jersey.inject.jersey.hk2.version>
<org.glassfish.jersey.core.jersey.client.version>2.22.2</org.glassfish.jersey.core.jersey.client.version>
<org.glassfish.jersey.core.jersey.common.version>2.22.2</org.glassfish.jersey.core.jersey.common.version>
<org.glassfish.hk2.hk2.api.version>2.4.0-b34</org.glassfish.hk2.hk2.api.version>
<org.glassfish.jersey.bundles.repackaged.jersey.guava.version>2.22.2</org.glassfish.jersey.bundles.repackaged.jersey.guava.version>
<org.glassfish.hk2.external.javax.inject.version>2.4.0-b34</org.glassfish.hk2.external.javax.inject.version>
<com.kohlschutter.junixsocket.junixsocket.core.version>2.2.0</com.kohlschutter.junixsocket.junixsocket.core.version>

<maven.failsafe.plugin.version>2.22.2</maven.failsafe.plugin.version>
<maven.paxexam.plugin.version>1.2.4</maven.paxexam.plugin.version>
<swagger.codegen.maven.plugin.version>2.4.8</swagger.codegen.maven.plugin.version>
Expand Down
106 changes: 86 additions & 20 deletions tooling/components/io.siddhi.distribution.editor.core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,30 +136,96 @@
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</dependency>
<dependency>
<groupId>com.spotify</groupId>
<artifactId>docker-client</artifactId>
<classifier>shaded</classifier>
</dependency>
</dependencies>

<profiles>
<profile>
<id>extract-dependency</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>compile</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<markersDirectory>${project.build.directory}/dependencies/dependency-maven-plugin-markers</markersDirectory>
<artifactItems>
<artifactItem>
<groupId>com.spotify</groupId>
<artifactId>docker-client</artifactId>
<classifier>shaded</classifier>
<outputDirectory>${project.build.directory}/dependencies/docker-client</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Include-Resource>
web=target/classes/web,
target/classes/mime-map.properties,
META-INF=target/classes/META-INF,
META-INF/services=${project.build.directory}/dependencies/docker-client/META-INF/services
</Include-Resource>
<Private-Package>
com.spotify.docker.*,
com.kenai.*,
org.apache.commons.*,
jni.*,
jersey.repackaged.com.*,
io.siddhi.distribution.editor.core.internal,
io.siddhi.distribution.editor.core.internal.*
</Private-Package>
<Export-Package>
io.siddhi.distribution.editor.core.*,
org.apache.commons.*
</Export-Package>
<Import-Package>
org.osgi.framework.*;version="${osgi.framework.import.version.range}",
org.wso2.carbon.kernel;version="${carbon.kernel.package.import.version.range}",
org.yaml.snakeyaml.*; version="${org.yaml.snakeyaml.version.range}",
io.siddhi.distribution.common.*;version="${io.siddhi.distribution.version.range}",
io.siddhi.distribution.editor.log.appender.*,
org.wso2.msf4j.*;version="${msf4j.import.version.range}",
javax.management.*,
javax.ws.rs.*;version="0.0.0",
com.fasterxml.jackson.core.*;version="${com.fasterxml.jackson.core.version.range}",
com.fasterxml.jackson.databind.*;version="${com.fasterxml.jackson.core.version.range}",
*;resolution:=optional
</Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<properties>
<maven.findbugsplugin.version.exclude>findbugs-exclude.xml</maven.findbugsplugin.version.exclude>
<Private-Package>
io.siddhi.distribution.editor.core.internal,
io.siddhi.distribution.editor.core.internal.*,
</Private-Package>
<export.package>
io.siddhi.distribution.editor.core.*
</export.package>
<import.package>
org.osgi.framework.*;version="${osgi.framework.import.version.range}",
org.wso2.carbon.kernel;version="${carbon.kernel.package.import.version.range}",
org.yaml.snakeyaml.*; version="${org.yaml.snakeyaml.version.range}",
io.siddhi.distribution.common.*;version="${io.siddhi.distribution.version.range}",
io.siddhi.distribution.editor.log.appender.*,
org.wso2.msf4j.*;version="${msf4j.import.version.range}",
javax.management.*,
javax.ws.rs.*;version="0.0.0",
com.fasterxml.jackson.core.*;version="${com.fasterxml.jackson.core.version.range}",
com.fasterxml.jackson.databind.*;version="${com.fasterxml.jackson.core.version.range}",
*;resolution:=optional
</import.package>
<carbon.component>
osgi.service; objectClass="org.wso2.msf4j.Microservice"; serviceCount="1",
osgi.service; objectClass="org.wso2.carbon.deployment.engine.Deployer";serviceCount="1"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package io.siddhi.distribution.editor.core.commons.configs;

/**
* This class holds Docker build and push process related data.
*/
public class DockerBuildConfig {
private String userName;
private String email;
private String password;
private String imageName;

public String getUserName() {
return userName;
}

public String getEmail() {
return email;
}

public String getPassword() {
return password;
}

public String getImageName() {
return imageName;
}

public void setUserName(String userName) {
this.userName = userName;
}

public void setEmail(String email) {
this.email = email;
}

public void setPassword(String password) {
this.password = password;
}

public void setImageName(String imageName) {
this.imageName = imageName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/
public class SiddhiProcessContainer {
private ArrayList<Env> env;
private String image;

public ArrayList<Env> getEnv() {
return env;
Expand All @@ -33,4 +34,12 @@ public ArrayList<Env> getEnv() {
public void setEnv(ArrayList<Env> env) {
this.env = env;
}

public String getImage() {
return image;
}

public void setImage(String image) {
this.image = image;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.siddhi.distribution.editor.core.commons.request;

import java.util.Map;

/**
* Bean class to represent the Siddhi application start request.
*/
public class AppStartRequest {
private String siddhiAppName;
private Map<String, String> variables;

public String getSiddhiAppName() {
return siddhiAppName;
}

public Map<String, String> getVariables() {
return variables;
}

public void setVariables(Map<String, String> variables) {
this.variables = variables;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package io.siddhi.distribution.editor.core.commons.request;

import io.siddhi.distribution.editor.core.commons.configs.DockerBuildConfig;

import java.util.List;
import java.util.Map;

Expand All @@ -31,6 +33,7 @@ public class ExportAppsRequest {
private List<String> bundles;
private List<String> jars;
private String kubernetesConfiguration;
private DockerBuildConfig dockerConfiguration;

public List<Map<String, String>> getTemplatedSiddhiApps() {
return templatedSiddhiApps;
Expand All @@ -55,4 +58,8 @@ public List<String> getJars() {
public String getKubernetesConfiguration() {
return kubernetesConfiguration;
}

public DockerBuildConfig getDockerConfiguration() {
return dockerConfiguration;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package io.siddhi.distribution.editor.core.commons.request;

import java.util.List;
import java.util.Map;

/**
* Request wrapper for Validation Request.
Expand All @@ -28,6 +29,7 @@ public class ValidationRequest {
private List<String> missingStreams;
private List<String> missingAggregationDefinitions;
private List<List<String>> missingInnerStreams;
private Map<String, String> variables;

public String getSiddhiApp() {

Expand Down Expand Up @@ -68,4 +70,12 @@ public void setMissingInnerStreams(List<List<String>> missingInnerStreams) {

this.missingInnerStreams = missingInnerStreams;
}

public Map<String, String> getVariables() {
return variables;
}

public void setVariables(Map<String, String> variables) {
this.variables = variables;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public SiddhiDebugger getDebugger() {
return debugger;
}

public String getSiddhiApp() {
return siddhiApp;
}

public void start() {

if (Mode.STOP.equals(mode)) {
Expand Down
Loading

0 comments on commit c1b6cdb

Please sign in to comment.