Skip to content

Commit 798ca08

Browse files
author
Alexander Garagatyi
authored
CHE-4098: separate terminal and exec agents (eclipse-che#4486)
Refactor golang terminal code. Add ping frames into terminal websocket connection. Signed-off-by: Alexander Garagatyi <agaragatyi@codenvy.com>
1 parent 6f97130 commit 798ca08

80 files changed

Lines changed: 2790 additions & 889 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

agents/exec/pom.xml

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Copyright (c) 2012-2017 Codenvy, S.A.
5+
All rights reserved. This program and the accompanying materials
6+
are made available under the terms of the Eclipse Public License v1.0
7+
which accompanies this distribution, and is available at
8+
http://www.eclipse.org/legal/epl-v10.html
9+
10+
Contributors:
11+
Codenvy, S.A. - initial API and implementation
12+
13+
-->
14+
<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">
15+
<modelVersion>4.0.0</modelVersion>
16+
<parent>
17+
<artifactId>che-agents-parent</artifactId>
18+
<groupId>org.eclipse.che</groupId>
19+
<version>5.6.0-SNAPSHOT</version>
20+
</parent>
21+
<artifactId>exec-agent</artifactId>
22+
<name>Agent :: Exec</name>
23+
<dependencies>
24+
<dependency>
25+
<groupId>com.google.inject</groupId>
26+
<artifactId>guice</artifactId>
27+
</dependency>
28+
<dependency>
29+
<groupId>javax.inject</groupId>
30+
<artifactId>javax.inject</artifactId>
31+
</dependency>
32+
<dependency>
33+
<groupId>org.eclipse.che.core</groupId>
34+
<artifactId>che-core-api-agent</artifactId>
35+
</dependency>
36+
<dependency>
37+
<groupId>org.eclipse.che.core</groupId>
38+
<artifactId>che-core-api-agent-shared</artifactId>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.eclipse.che.core</groupId>
42+
<artifactId>che-core-api-core</artifactId>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.eclipse.che.core</groupId>
46+
<artifactId>che-core-api-machine</artifactId>
47+
</dependency>
48+
</dependencies>
49+
<build>
50+
<plugins>
51+
<plugin>
52+
<groupId>org.apache.maven.plugins</groupId>
53+
<artifactId>maven-antrun-plugin</artifactId>
54+
<executions>
55+
<execution>
56+
<id>copy-sources</id>
57+
<phase>compile</phase>
58+
<goals>
59+
<goal>run</goal>
60+
</goals>
61+
<configuration>
62+
<target>
63+
<!--To not use godep tool vendored dependencies are copied into correct place of GOPATH
64+
by maven-->
65+
<copy todir="${project.build.directory}/go-workspace/src">
66+
<fileset dir="${basedir}/../go-agents/src/main/go/vendor/" includes="**/*" />
67+
</copy>
68+
<copy todir="${project.build.directory}/go-workspace/src/github.com/eclipse/che/agents/go-agents/src/main/go">
69+
<fileset dir="${basedir}/../go-agents/src/main/go/" excludes="vendor/" includes="**/*.*go" />
70+
</copy>
71+
</target>
72+
</configuration>
73+
</execution>
74+
</executions>
75+
</plugin>
76+
<plugin>
77+
<groupId>com.soebes.maven.plugins</groupId>
78+
<artifactId>iterator-maven-plugin</artifactId>
79+
<version>0.5.0</version>
80+
<executions>
81+
<execution>
82+
<id>compile-go-agents</id>
83+
<phase>compile</phase>
84+
<goals>
85+
<goal>iterator</goal>
86+
</goals>
87+
<configuration>
88+
<itemsWithProperties>
89+
<itemWithProperty>
90+
<name>linux_arm5</name>
91+
<properties>
92+
<go.target.os>linux</go.target.os>
93+
<go.target.architecture>arm</go.target.architecture>
94+
<go.target.arm.version>5</go.target.arm.version>
95+
</properties>
96+
</itemWithProperty>
97+
<itemWithProperty>
98+
<name>linux_arm6</name>
99+
<properties>
100+
<go.target.os>linux</go.target.os>
101+
<go.target.architecture>arm</go.target.architecture>
102+
<go.target.arm.version>6</go.target.arm.version>
103+
</properties>
104+
</itemWithProperty>
105+
<itemWithProperty>
106+
<name>linux_arm7</name>
107+
<properties>
108+
<go.target.os>linux</go.target.os>
109+
<go.target.architecture>arm</go.target.architecture>
110+
<go.target.arm.version>7</go.target.arm.version>
111+
</properties>
112+
</itemWithProperty>
113+
<itemWithProperty>
114+
<name>linux_amd64</name>
115+
<properties>
116+
<go.target.os>linux</go.target.os>
117+
<go.target.architecture>amd64</go.target.architecture>
118+
</properties>
119+
</itemWithProperty>
120+
<itemWithProperty>
121+
<name>linux_i386</name>
122+
<properties>
123+
<go.target.os>linux</go.target.os>
124+
<go.target.architecture>386</go.target.architecture>
125+
</properties>
126+
</itemWithProperty>
127+
</itemsWithProperties>
128+
<pluginExecutors>
129+
<pluginExecutor>
130+
<plugin>
131+
<groupId>org.codehaus.mojo</groupId>
132+
<artifactId>exec-maven-plugin</artifactId>
133+
</plugin>
134+
<goal>exec</goal>
135+
<configuration>
136+
<executable>go</executable>
137+
<workingDirectory>${project.build.directory}/go-workspace/src/github.com/eclipse/che/agents/go-agents/src/main/go/exec-agent</workingDirectory>
138+
<arguments>
139+
<argument>build</argument>
140+
<argument>-a</argument>
141+
<argument>-installsuffix</argument>
142+
<argument>cgo</argument>
143+
<argument>-o</argument>
144+
<argument>${project.build.directory}/${item}/che-exec-agent</argument>
145+
</arguments>
146+
<environmentVariables>
147+
<CGO_ENABLED>0</CGO_ENABLED>
148+
<GOPATH>${project.build.directory}/go-workspace</GOPATH>
149+
<GOOS>${go.target.os}</GOOS>
150+
<GOARCH>${go.target.architecture}</GOARCH>
151+
<GOARM>${go.target.arm.version}</GOARM>
152+
</environmentVariables>
153+
</configuration>
154+
</pluginExecutor>
155+
</pluginExecutors>
156+
</configuration>
157+
</execution>
158+
<execution>
159+
<id>assembly</id>
160+
<phase>package</phase>
161+
<goals>
162+
<goal>iterator</goal>
163+
</goals>
164+
<configuration>
165+
<items>
166+
<item>linux_arm5</item>
167+
<item>linux_arm6</item>
168+
<item>linux_arm7</item>
169+
<item>linux_amd64</item>
170+
<item>linux_i386</item>
171+
</items>
172+
<pluginExecutors>
173+
<pluginExecutor>
174+
<plugin>
175+
<artifactId>maven-assembly-plugin</artifactId>
176+
</plugin>
177+
<goal>single</goal>
178+
<configuration>
179+
<tarLongFileMode>posix</tarLongFileMode>
180+
<descriptors>
181+
<descriptor>${basedir}/src/assembly/assembly.xml</descriptor>
182+
</descriptors>
183+
</configuration>
184+
</pluginExecutor>
185+
</pluginExecutors>
186+
</configuration>
187+
</execution>
188+
</executions>
189+
</plugin>
190+
</plugins>
191+
</build>
192+
</project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!--
2+
3+
Copyright (c) 2012-2017 Codenvy, S.A.
4+
All rights reserved. This program and the accompanying materials
5+
are made available under the terms of the Eclipse Public License v1.0
6+
which accompanies this distribution, and is available at
7+
http://www.eclipse.org/legal/epl-v10.html
8+
9+
Contributors:
10+
Codenvy, S.A. - initial API and implementation
11+
12+
-->
13+
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
14+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
15+
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
16+
<id>${item}</id>
17+
<includeBaseDirectory>true</includeBaseDirectory>
18+
<baseDirectory>exec-agent</baseDirectory>
19+
<formats>
20+
<format>zip</format>
21+
<format>tar.gz</format>
22+
</formats>
23+
<fileSets>
24+
<fileSet>
25+
<directory>${project.build.directory}/${item}</directory>
26+
<includes>
27+
<include>che-exec-agent</include>
28+
</includes>
29+
<fileMode>0755</fileMode>
30+
<outputDirectory></outputDirectory>
31+
</fileSet>
32+
</fileSets>
33+
</assembly>

agents/go-agents/src/main/java/org/eclipse/che/api/agent/ExecAgent.java renamed to agents/exec/src/main/java/org/eclipse/che/api/agent/ExecAgent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
*/
2828
@Singleton
2929
public class ExecAgent extends BasicAgent {
30-
private static final String AGENT_DESCRIPTOR = "org.eclipse.che.terminal.json";
31-
private static final String AGENT_SCRIPT = "org.eclipse.che.terminal.script.sh";
30+
private static final String AGENT_DESCRIPTOR = "org.eclipse.che.exec.json";
31+
private static final String AGENT_SCRIPT = "org.eclipse.che.exec.script.sh";
3232

3333
@Inject
3434
public ExecAgent() throws IOException {

agents/go-agents/src/main/java/org/eclipse/che/api/agent/ExecAgentLauncher.java renamed to agents/exec/src/main/java/org/eclipse/che/api/agent/ExecAgentLauncher.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public class ExecAgentLauncher extends AbstractAgentLauncher {
3333
@Inject
3434
public ExecAgentLauncher(@Named("che.agent.dev.max_start_time_ms") long agentMaxStartTimeMs,
3535
@Named("che.agent.dev.ping_delay_ms") long agentPingDelayMs,
36-
@Named("machine.terminal_agent.run_command") String runCommand) {
37-
super(agentMaxStartTimeMs, agentPingDelayMs, new ProcessIsLaunchedChecker("che-websocket-terminal"));
36+
@Named("machine.exec_agent.run_command") String runCommand) {
37+
super(agentMaxStartTimeMs, agentPingDelayMs, new ProcessIsLaunchedChecker("che-exec-agent"));
3838
this.runCommand = runCommand;
3939
}
4040

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

5353
@Override
5454
public String getAgentId() {
55-
return "org.eclipse.che.terminal";
55+
return "org.eclipse.che.exec";
5656
}
5757
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"id": "org.eclipse.che.exec",
3+
"name": "Exec-agent",
4+
"description": "Agent for command execution",
5+
"dependencies": [],
6+
"properties": {},
7+
"servers": {
8+
"exec-agent": {
9+
"port": "4412/tcp",
10+
"protocol": "http"
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)