mirror of
https://github.com/theonedev/onedev.git
synced 2025-12-08 18:26:30 +00:00
feat: able to specify docker sock path
This commit is contained in:
parent
8c83037506
commit
d8c984d471
4
pom.xml
4
pom.xml
@ -9,7 +9,7 @@
|
||||
<version>1.2.0</version>
|
||||
</parent>
|
||||
<artifactId>server</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
<packaging>pom</packaging>
|
||||
<build>
|
||||
<finalName>${project.groupId}.${project.artifactId}-${project.version}</finalName>
|
||||
@ -615,7 +615,7 @@
|
||||
</repositories>
|
||||
<properties>
|
||||
<commons.version>2.7.15</commons.version>
|
||||
<agent.version>1.8.9</agent.version>
|
||||
<agent.version>1.8.10</agent.version>
|
||||
<slf4j.version>1.7.36</slf4j.version>
|
||||
<logback.version>1.2.11</logback.version>
|
||||
<antlr.version>4.7.2</antlr.version>
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<build>
|
||||
<resources>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.authenticator.ldap.LdapModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.buildspec.gradle.GradleModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.buildspec.maven.MavenModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.buildspec.node.NodePluginModule</moduleClass>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.executor.kubernetes.KubernetesModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -195,7 +195,8 @@ public class RemoteDockerExecutor extends ServerDockerExecutor {
|
||||
}
|
||||
|
||||
TestDockerJobData jobData = new TestDockerJobData(getName(), jobToken,
|
||||
testData.getDockerImage(), registryLogins, getRunOptions());
|
||||
testData.getDockerImage(), getDockerSockPath(), registryLogins,
|
||||
getRunOptions());
|
||||
|
||||
long timeout = 300*1000L;
|
||||
if (getLogManager().getJobLogger(jobToken) == null) {
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.executor.serverdocker.ServerDockerModule</moduleClass>
|
||||
|
||||
@ -102,7 +102,17 @@ public class ServerDockerExecutor extends JobExecutor implements Testable<TestDa
|
||||
this.concurrency = concurrency;
|
||||
}
|
||||
|
||||
@Editable(order=500, group="More Settings", description="Whether or not to mount docker sock into job container to "
|
||||
@Editable(order=510, group="More Settings", placeholder="Default", description="Optionally specify docker sock to use. "
|
||||
+ "Defaults to <i>/var/run/docker.sock</i> on Linux, and <i>//./pipe/docker_engine</i> on Windows")
|
||||
public String getDockerSockPath() {
|
||||
return dockerSockPath;
|
||||
}
|
||||
|
||||
public void setDockerSockPath(String dockerSockPath) {
|
||||
this.dockerSockPath = dockerSockPath;
|
||||
}
|
||||
|
||||
@Editable(order=520, group="More Settings", description="Whether or not to mount docker sock into job container to "
|
||||
+ "support docker operations in job commands, for instance to build docker image.<br>"
|
||||
+ "<b class='text-danger'>WARNING</b>: Malicious jobs can take control of whole OneDev "
|
||||
+ "by operating the mounted docker sock. You should configure job requirement above to make sure the " +
|
||||
@ -114,22 +124,6 @@ public class ServerDockerExecutor extends JobExecutor implements Testable<TestDa
|
||||
public void setMountDockerSock(boolean mountDockerSock) {
|
||||
this.mountDockerSock = mountDockerSock;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static boolean isMountDockerSockEnabled() {
|
||||
return (Boolean)EditContext.get().getInputValue("mountDockerSock");
|
||||
}
|
||||
|
||||
@Editable(order=510, group="More Settings", placeholder="Default", description="Optionally specify docker sock path to mount from. "
|
||||
+ "Defaults to <i>/var/run/docker.sock</i> on Linux, and <i>//./pipe/docker_engine</i> on Windows")
|
||||
@ShowCondition("isMountDockerSockEnabled")
|
||||
public String getDockerSockPath() {
|
||||
return dockerSockPath;
|
||||
}
|
||||
|
||||
public void setDockerSockPath(String dockerSockPath) {
|
||||
this.dockerSockPath = dockerSockPath;
|
||||
}
|
||||
|
||||
@Editable(order=50010, group="More Settings", placeholder = "No limit", description = "" +
|
||||
"Optionally specify cpu limit of jobs/services using this executor. This will be " +
|
||||
@ -176,12 +170,15 @@ public class ServerDockerExecutor extends JobExecutor implements Testable<TestDa
|
||||
}
|
||||
|
||||
private Commandline newDocker() {
|
||||
Commandline docker;
|
||||
if (getDockerExecutable() != null)
|
||||
return new Commandline(getDockerExecutable());
|
||||
docker = new Commandline(getDockerExecutable());
|
||||
else if (SystemUtils.IS_OS_MAC_OSX && new File("/usr/local/bin/docker").exists())
|
||||
return new Commandline("/usr/local/bin/docker");
|
||||
docker = new Commandline("/usr/local/bin/docker");
|
||||
else
|
||||
return new Commandline("docker");
|
||||
docker = new Commandline("docker");
|
||||
useDockerSock(docker, getDockerSockPath());
|
||||
return docker;
|
||||
}
|
||||
|
||||
private File getCacheHome(JobExecutor jobExecutor) {
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.executor.servershell.ServerShellModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.imports.bitbucketcloud.BitbucketModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.imports.gitea.GiteaModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.imports.github.GitHubModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.imports.gitlab.GitLabModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.imports.jiracloud.JiraModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.imports.url.UrlModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.imports.youtrack.YouTrackModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.notification.discord.DiscordModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.notification.slack.SlackModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.report.coverage.CoverageModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.report.markdown.MarkdownModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.report.problem.ProblemModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.report.unittest.UnitTestModule</moduleClass>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.sso.discord.DiscordModule</moduleClass>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server-plugin</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<moduleClass>io.onedev.server.plugin.sso.openid.OpenIdModule</moduleClass>
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>io.onedev</groupId>
|
||||
<artifactId>server</artifactId>
|
||||
<version>8.2.7</version>
|
||||
<version>8.2.8</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user