Skip to content

The Unified and Autonomous Development Platform

fix: environment var with step Execute command via SSH (#1456)

Robin Shen80484f9d65ce
diff --git a/server-core/src/main/java/io/onedev/server/buildspec/step/SSHCommandStep.java b/server-core/src/main/java/io/onedev/server/buildspec/step/SSHCommandStep.java
index 7e394910c7..a360ce9796 100644
--- a/server-core/src/main/java/io/onedev/server/buildspec/step/SSHCommandStep.java
+++ b/server-core/src/main/java/io/onedev/server/buildspec/step/SSHCommandStep.java
@@ -133,7 +133,9 @@ public class SSHCommandStep extends CommandStep {
"EOF",
"chmod 600 /root/.ssh/id_rsa",
sshBuilder.toString()));
- commands.addAll(SSHCommandStep.this.getCommands());
+ // Fix issue #1456
+ for (var command: SSHCommandStep.this.getCommands())
+ commands.add(command.replace("$", "\\$"));
commands.add("EOF");
return commands;
}
diff --git a/server-core/src/main/java/io/onedev/server/web/page/admin/AdministrationPage.html b/server-core/src/main/java/io/onedev/server/web/page/admin/AdministrationPage.html
index 8be9fbdc61..7488009ee1 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/admin/AdministrationPage.html
+++ b/server-core/src/main/java/io/onedev/server/web/page/admin/AdministrationPage.html
@@ -2,4 +2,4 @@
<div id="administration" class="m-2 m-sm-5">
<wicket:child></wicket:child>
</div>
-</wicket:extend>
\ No newline at end of file
+</wicket:extend>s
\ No newline at end of file