The Unified and Autonomous Development Platform
Some minor fixes
Robin Shenb86a87e50626
diff --git a/server-core/src/main/java/io/onedev/server/buildspec/job/Job.java b/server-core/src/main/java/io/onedev/server/buildspec/job/Job.javaindex 36ff21f421..5e4a2385f4 100644--- a/server-core/src/main/java/io/onedev/server/buildspec/job/Job.java+++ b/server-core/src/main/java/io/onedev/server/buildspec/job/Job.java@@ -226,8 +226,10 @@ public class Job implements NamedElement, Serializable, Validatable {}@Editable(order=9114, group="Dependencies & Services", description="Optionally specify services required by this job. "- + "<span class='text-warning'>This property will be ignored if the job is executed by a shell executor</span>")+ + "<b class='text-warning'>NOTE:</b> Services are only supported by docker aware executors "+ + "(server docker executor, remote docker executor, or kubernetes executor)")@ChoiceProvider("getServiceChoices")+ @NameOfEmptyValue("No required services")public List<String> getRequiredServices() {return requiredServices;}diff --git a/server-core/src/main/java/io/onedev/server/buildspec/step/command/interpreter/BorneShellStep.java b/server-core/src/main/java/io/onedev/server/buildspec/step/command/interpreter/BorneShellInterpreter.javasimilarity index 95%rename from server-core/src/main/java/io/onedev/server/buildspec/step/command/interpreter/BorneShellStep.javarename to server-core/src/main/java/io/onedev/server/buildspec/step/command/interpreter/BorneShellInterpreter.javaindex a524bf338f..2ef75a7ef2 100644--- a/server-core/src/main/java/io/onedev/server/buildspec/step/command/interpreter/BorneShellStep.java+++ b/server-core/src/main/java/io/onedev/server/buildspec/step/command/interpreter/BorneShellInterpreter.java@@ -11,7 +11,7 @@ import io.onedev.server.web.editable.annotation.Editable;import io.onedev.server.web.editable.annotation.Interpolative;@Editable(order=200, name="Borne Shell")-public class BorneShellStep extends Interpreter {+public class BorneShellInterpreter extends Interpreter {private static final long serialVersionUID = 1L;diff --git a/server-core/src/main/java/io/onedev/server/buildspec/step/command/interpreter/PowerShellStep.java b/server-core/src/main/java/io/onedev/server/buildspec/step/command/interpreter/PowerShellInterpreter.javasimilarity index 81%rename from server-core/src/main/java/io/onedev/server/buildspec/step/command/interpreter/PowerShellStep.javarename to server-core/src/main/java/io/onedev/server/buildspec/step/command/interpreter/PowerShellInterpreter.javaindex 48f4c5f948..7a576a8d40 100644--- a/server-core/src/main/java/io/onedev/server/buildspec/step/command/interpreter/PowerShellStep.java+++ b/server-core/src/main/java/io/onedev/server/buildspec/step/command/interpreter/PowerShellInterpreter.java@@ -11,15 +11,15 @@ import io.onedev.server.web.editable.annotation.Editable;import io.onedev.server.web.editable.annotation.Interpolative;@Editable(order=300, name="PowerShell")-public class PowerShellStep extends Interpreter {+public class PowerShellInterpreter extends Interpreter {private static final long serialVersionUID = 1L;@Editable(order=110, description="Specify PowerShell commands to execute "+ "under the <a href='$docRoot/pages/concepts.md#job-workspace' target='_blank'>job workspace</a>.<br>"- + "<b class='text-danger'>NOTE: </b> OneDev checks exit code of the script to determine if step is successful. "+ + "<b class='text-warning'>NOTE: </b> OneDev checks exit code of the script to determine if step is successful. "+ "Since PowerShell always exit with 0 even if there are script errors, you should handle errors in the script "- + "and exit with non-zero code, or simply add line <code>$ErrorActionPreference = \"Stop\"</code> at start of "+ + "and exit with non-zero code, or add line <code>$ErrorActionPreference = "Stop"</code> at start of "+ "your script<br>")@Interpolative@Code(language=Code.POWER_SHELL, variableProvider="suggestVariables")diff --git a/server-plugin/server-plugin-executor-remoteshell/src/main/java/io/onedev/server/plugin/executor/remoteshell/RemoteShellExecutor.java b/server-plugin/server-plugin-executor-remoteshell/src/main/java/io/onedev/server/plugin/executor/remoteshell/RemoteShellExecutor.javaindex 5703f50312..2c81afcfa7 100644--- a/server-plugin/server-plugin-executor-remoteshell/src/main/java/io/onedev/server/plugin/executor/remoteshell/RemoteShellExecutor.java+++ b/server-plugin/server-plugin-executor-remoteshell/src/main/java/io/onedev/server/plugin/executor/remoteshell/RemoteShellExecutor.java@@ -58,6 +58,11 @@ public class RemoteShellExecutor extends ServerShellExecutor {jobLogger.log(String.format("Executing job (executor: %s, agent: %s)...", getName(), agentData.getName()));jobContext.notifyJobRunning(agentId);+ if (!jobContext.getServices().isEmpty()) {+ throw new ExplicitException("This job requires services, which can only be supported "+ + "by docker aware executors");+ }+for (CacheSpec cacheSpec: jobContext.getCacheSpecs()) {if (new File(cacheSpec.getPath()).isAbsolute()) {throw new ExplicitException("Shell executor does not support "diff --git a/server-plugin/server-plugin-executor-servershell/src/main/java/io/onedev/server/plugin/executor/servershell/ServerShellExecutor.java b/server-plugin/server-plugin-executor-servershell/src/main/java/io/onedev/server/plugin/executor/servershell/ServerShellExecutor.javaindex b96658edf7..8074432e12 100644--- a/server-plugin/server-plugin-executor-servershell/src/main/java/io/onedev/server/plugin/executor/servershell/ServerShellExecutor.java+++ b/server-plugin/server-plugin-executor-servershell/src/main/java/io/onedev/server/plugin/executor/servershell/ServerShellExecutor.java@@ -88,6 +88,11 @@ public class ServerShellExecutor extends JobExecutor implements Testable<TestDatjobLogger.log(String.format("Executing job with executor '%s'...", getName()));jobContext.notifyJobRunning(null);+ if (!jobContext.getServices().isEmpty()) {+ throw new ExplicitException("This job requires services, which can only be supported "+ + "by docker aware executors");+ }+JobManager jobManager = OneDev.getInstance(JobManager.class);File cacheHomeDir = getCacheHome();