Skip to content

Commit

Permalink
CHE-4098: separate terminal and exec agents (#4486)
Browse files Browse the repository at this point in the history
Refactor golang terminal code.
Add ping frames into terminal websocket connection.
Signed-off-by: Alexander Garagatyi <[email protected]>
  • Loading branch information
Alexander Garagatyi authored Mar 27, 2017
1 parent 6f97130 commit 798ca08
Show file tree
Hide file tree
Showing 80 changed files with 2,790 additions and 889 deletions.
192 changes: 192 additions & 0 deletions agents/exec/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012-2017 Codenvy, S.A.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
Codenvy, S.A. - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>che-agents-parent</artifactId>
<groupId>org.eclipse.che</groupId>
<version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>exec-agent</artifactId>
<name>Agent :: Exec</name>
<dependencies>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-agent</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-agent-shared</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-core</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-machine</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy-sources</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!--To not use godep tool vendored dependencies are copied into correct place of GOPATH
by maven-->
<copy todir="${project.build.directory}/go-workspace/src">
<fileset dir="${basedir}/../go-agents/src/main/go/vendor/" includes="**/*" />
</copy>
<copy todir="${project.build.directory}/go-workspace/src/github.com/eclipse/che/agents/go-agents/src/main/go">
<fileset dir="${basedir}/../go-agents/src/main/go/" excludes="vendor/" includes="**/*.*go" />
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.soebes.maven.plugins</groupId>
<artifactId>iterator-maven-plugin</artifactId>
<version>0.5.0</version>
<executions>
<execution>
<id>compile-go-agents</id>
<phase>compile</phase>
<goals>
<goal>iterator</goal>
</goals>
<configuration>
<itemsWithProperties>
<itemWithProperty>
<name>linux_arm5</name>
<properties>
<go.target.os>linux</go.target.os>
<go.target.architecture>arm</go.target.architecture>
<go.target.arm.version>5</go.target.arm.version>
</properties>
</itemWithProperty>
<itemWithProperty>
<name>linux_arm6</name>
<properties>
<go.target.os>linux</go.target.os>
<go.target.architecture>arm</go.target.architecture>
<go.target.arm.version>6</go.target.arm.version>
</properties>
</itemWithProperty>
<itemWithProperty>
<name>linux_arm7</name>
<properties>
<go.target.os>linux</go.target.os>
<go.target.architecture>arm</go.target.architecture>
<go.target.arm.version>7</go.target.arm.version>
</properties>
</itemWithProperty>
<itemWithProperty>
<name>linux_amd64</name>
<properties>
<go.target.os>linux</go.target.os>
<go.target.architecture>amd64</go.target.architecture>
</properties>
</itemWithProperty>
<itemWithProperty>
<name>linux_i386</name>
<properties>
<go.target.os>linux</go.target.os>
<go.target.architecture>386</go.target.architecture>
</properties>
</itemWithProperty>
</itemsWithProperties>
<pluginExecutors>
<pluginExecutor>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
</plugin>
<goal>exec</goal>
<configuration>
<executable>go</executable>
<workingDirectory>${project.build.directory}/go-workspace/src/github.com/eclipse/che/agents/go-agents/src/main/go/exec-agent</workingDirectory>
<arguments>
<argument>build</argument>
<argument>-a</argument>
<argument>-installsuffix</argument>
<argument>cgo</argument>
<argument>-o</argument>
<argument>${project.build.directory}/${item}/che-exec-agent</argument>
</arguments>
<environmentVariables>
<CGO_ENABLED>0</CGO_ENABLED>
<GOPATH>${project.build.directory}/go-workspace</GOPATH>
<GOOS>${go.target.os}</GOOS>
<GOARCH>${go.target.architecture}</GOARCH>
<GOARM>${go.target.arm.version}</GOARM>
</environmentVariables>
</configuration>
</pluginExecutor>
</pluginExecutors>
</configuration>
</execution>
<execution>
<id>assembly</id>
<phase>package</phase>
<goals>
<goal>iterator</goal>
</goals>
<configuration>
<items>
<item>linux_arm5</item>
<item>linux_arm6</item>
<item>linux_arm7</item>
<item>linux_amd64</item>
<item>linux_i386</item>
</items>
<pluginExecutors>
<pluginExecutor>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
<goal>single</goal>
<configuration>
<tarLongFileMode>posix</tarLongFileMode>
<descriptors>
<descriptor>${basedir}/src/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</pluginExecutor>
</pluginExecutors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
33 changes: 33 additions & 0 deletions agents/exec/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!--
Copyright (c) 2012-2017 Codenvy, S.A.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
Codenvy, S.A. - initial API and implementation
-->
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>${item}</id>
<includeBaseDirectory>true</includeBaseDirectory>
<baseDirectory>exec-agent</baseDirectory>
<formats>
<format>zip</format>
<format>tar.gz</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}/${item}</directory>
<includes>
<include>che-exec-agent</include>
</includes>
<fileMode>0755</fileMode>
<outputDirectory></outputDirectory>
</fileSet>
</fileSets>
</assembly>
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
*/
@Singleton
public class ExecAgent extends BasicAgent {
private static final String AGENT_DESCRIPTOR = "org.eclipse.che.terminal.json";
private static final String AGENT_SCRIPT = "org.eclipse.che.terminal.script.sh";
private static final String AGENT_DESCRIPTOR = "org.eclipse.che.exec.json";
private static final String AGENT_SCRIPT = "org.eclipse.che.exec.script.sh";

@Inject
public ExecAgent() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class ExecAgentLauncher extends AbstractAgentLauncher {
@Inject
public ExecAgentLauncher(@Named("che.agent.dev.max_start_time_ms") long agentMaxStartTimeMs,
@Named("che.agent.dev.ping_delay_ms") long agentPingDelayMs,
@Named("machine.terminal_agent.run_command") String runCommand) {
super(agentMaxStartTimeMs, agentPingDelayMs, new ProcessIsLaunchedChecker("che-websocket-terminal"));
@Named("machine.exec_agent.run_command") String runCommand) {
super(agentMaxStartTimeMs, agentPingDelayMs, new ProcessIsLaunchedChecker("che-exec-agent"));
this.runCommand = runCommand;
}

Expand All @@ -52,6 +52,6 @@ public String getMachineType() {

@Override
public String getAgentId() {
return "org.eclipse.che.terminal";
return "org.eclipse.che.exec";
}
}
13 changes: 13 additions & 0 deletions agents/exec/src/main/resources/org.eclipse.che.exec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"id": "org.eclipse.che.exec",
"name": "Exec-agent",
"description": "Agent for command execution",
"dependencies": [],
"properties": {},
"servers": {
"exec-agent": {
"port": "4412/tcp",
"protocol": "http"
}
}
}
Loading

0 comments on commit 798ca08

Please sign in to comment.