Skip to content

Commit 0c1c7d0

Browse files
authored
Merge pull request #358 from FlowCI/fix/docker_client
Fix/docker client
2 parents c2d44ab + 8d13119 commit 0c1c7d0

Some content is hidden

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

48 files changed

+1117
-1746
lines changed

core/pom.xml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
<artifactId>domain</artifactId>
2020
</dependency>
2121

22+
<dependency>
23+
<groupId>com.flowci</groupId>
24+
<artifactId>docker</artifactId>
25+
</dependency>
26+
2227
<dependency>
2328
<groupId>com.flowci</groupId>
2429
<artifactId>sm</artifactId>
@@ -49,11 +54,6 @@
4954
<artifactId>zookeeper</artifactId>
5055
</dependency>
5156

52-
<dependency>
53-
<groupId>com.flowci</groupId>
54-
<artifactId>pool</artifactId>
55-
</dependency>
56-
5757
<dependency>
5858
<groupId>com.auth0</groupId>
5959
<artifactId>java-jwt</artifactId>
@@ -104,11 +104,6 @@
104104
<artifactId>org.eclipse.jgit</artifactId>
105105
</dependency>
106106

107-
<dependency>
108-
<groupId>com.google.protobuf</groupId>
109-
<artifactId>protobuf-java</artifactId>
110-
</dependency>
111-
112107
<dependency>
113108
<groupId>com.rabbitmq</groupId>
114109
<artifactId>amqp-client</artifactId>

core/src/main/java/com/flowci/core/agent/domain/AgentHost.java

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,16 @@
1616

1717
package com.flowci.core.agent.domain;
1818

19-
import java.time.Instant;
20-
import java.time.temporal.ChronoUnit;
21-
import java.util.Date;
22-
import java.util.HashSet;
23-
import java.util.Set;
24-
2519
import com.flowci.core.common.domain.Mongoable;
26-
27-
import org.springframework.data.mongodb.core.index.Indexed;
28-
2920
import lombok.Getter;
3021
import lombok.NonNull;
3122
import lombok.Setter;
23+
import org.springframework.data.mongodb.core.index.Indexed;
3224
import org.springframework.data.mongodb.core.mapping.Document;
3325

26+
import java.util.HashSet;
27+
import java.util.Set;
28+
3429
@Getter
3530
@Setter
3631
@Document(collection = "agent_host")
@@ -73,17 +68,7 @@ public enum Type {
7368
/**
7469
* Max agent size on the host
7570
*/
76-
private int maxSize = 10;
77-
78-
/**
79-
* Stop agent container if over the idle seconds
80-
*/
81-
private int maxIdleSeconds = 3600;
82-
83-
/**
84-
* Remove agent container if over the offline seconds
85-
*/
86-
private int maxOfflineSeconds = 600;
71+
private int maxSize = 5;
8772

8873
/**
8974
* Tags for all agent holed by host
@@ -94,18 +79,4 @@ public enum Type {
9479
* Error message if connection fail
9580
*/
9681
private String error;
97-
98-
public boolean isOverMaxIdleSeconds(Date date) {
99-
if (maxIdleSeconds == NoLimit) {
100-
return false;
101-
}
102-
return date.toInstant().plus(maxIdleSeconds, ChronoUnit.SECONDS).isBefore(Instant.now());
103-
}
104-
105-
public boolean isOverMaxOfflineSeconds(Date date) {
106-
if (maxOfflineSeconds == NoLimit) {
107-
return false;
108-
}
109-
return date.toInstant().plus(maxOfflineSeconds, ChronoUnit.SECONDS).isBefore(Instant.now());
110-
}
11182
}

core/src/main/java/com/flowci/core/agent/domain/CreateOrUpdateSshAgentHost.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ public class CreateOrUpdateSshAgentHost {
4545

4646
private String ip;
4747

48-
private int maxSize = 10;
49-
50-
private int maxIdleSeconds = 3600;
51-
52-
private int maxOfflineSeconds = 600;
48+
private int maxSize = 5;
5349

5450
public AgentHost toObj() {
5551
if (type == AgentHost.Type.SSH) {
@@ -61,8 +57,6 @@ public AgentHost toObj() {
6157
host.setIp(ip);
6258
host.setTags(tags);
6359
host.setMaxSize(maxSize);
64-
host.setMaxIdleSeconds(maxIdleSeconds);
65-
host.setMaxOfflineSeconds(maxOfflineSeconds);
6660
return host;
6761
}
6862

@@ -71,8 +65,6 @@ public AgentHost toObj() {
7165
host.setId(id);
7266
host.setName(name);
7367
host.setMaxSize(maxSize);
74-
host.setMaxIdleSeconds(maxIdleSeconds);
75-
host.setMaxOfflineSeconds(maxOfflineSeconds);
7668
return host;
7769
}
7870

core/src/main/java/com/flowci/core/agent/domain/LocalUnixAgentHost.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ public class LocalUnixAgentHost extends AgentHost {
2828

2929
public LocalUnixAgentHost() {
3030
this.setType(AgentHost.Type.LocalUnixSocket);
31+
this.setMaxSize(2);
3132
}
3233
}

core/src/main/java/com/flowci/core/agent/domain/SshAgentHost.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public class SshAgentHost extends AgentHost {
3535
@NonNull
3636
private String ip;
3737

38+
private int port = 22;
39+
3840
public SshAgentHost() {
3941
setType(Type.SSH);
4042
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.flowci.core.agent.domain;
2+
3+
public abstract class Variables {
4+
5+
public static final String SERVER_URL = "FLOWCI_SERVER_URL";
6+
7+
public static final String AGENT_TOKEN = "FLOWCI_AGENT_TOKEN";
8+
9+
public static final String AGENT_LOG_LEVEL = "FLOWCI_AGENT_LOG_LEVEL";
10+
11+
public static final String AGENT_VOLUMES = "FLOWCI_AGENT_VOLUMES";
12+
13+
public static final String AGENT_WORKSPACE = "FLOWCI_AGENT_WORKSPACE";
14+
}

core/src/main/java/com/flowci/core/agent/event/CreateAgentEvent.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)