Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert unix command to command to prevend breaking changes #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

@DataBoundConstructor
public DockerSwarmAgentTemplate(final String image, final String hostBinds, final String hostNamedPipes, final String dnsIps,
final String dnsSearchDomains, final String unixCommand,final String windowsCommand, final String user, final String workingDir,
final String dnsSearchDomains, final String command,final String windowsCommand, final String user, final String workingDir,
final String hosts, final String metadata, final String secrets, final String configs, final String label, final String cacheDir,
final String tmpfsDir, final String envVars, final long limitsNanoCPUs, final long limitsMemoryBytes,
final long reservationsNanoCPUs, final long reservationsMemoryBytes, String portBinds, final boolean osWindows,
Expand All @@ -69,7 +69,7 @@
this.hostNamedPipes = hostNamedPipes;
this.dnsIps = dnsIps;
this.dnsSearchDomains = dnsSearchDomains;
this.unixCommand = unixCommand;
this.unixCommand = command;

Check warning on line 72 in src/main/java/org/jenkinsci/plugins/docker/swarm/DockerSwarmAgentTemplate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 72 is not covered by tests
this.windowsCommand = windowsCommand;
this.user = user;
this.workingDir = workingDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<f:entry title="Image" field="image">
<f:textbox value="${dockerSwarmAgentTemplate.image}" default="java:8"/>
</f:entry>
<f:entry title="Unix Command" field="unixCommand">
<f:textarea value="${dockerSwarmAgentTemplate.unixCommand}" default="sh&#10;-cx&#10;curl --connect-timeout 20 --max-time 60 -o agent.jar $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_JAR_URL &amp;&amp; java -classpath agent.jar hudson.remoting.jnlp.Main -headless -url $DOCKER_SWARM_PLUGIN_JENKINS_URL -noreconnect -workDir /tmp $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_SECRET $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_NAME"/>
<f:entry title="Unix Command" field="command">
<f:textarea value="${dockerSwarmAgentTemplate.command}" default="sh&#10;-cx&#10;curl --connect-timeout 20 --max-time 60 -o agent.jar $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_JAR_URL &amp;&amp; java -classpath agent.jar hudson.remoting.jnlp.Main -headless -url $DOCKER_SWARM_PLUGIN_JENKINS_URL -noreconnect -workDir /tmp $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_SECRET $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_NAME"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way just

Suggested change
<f:textarea value="${dockerSwarmAgentTemplate.command}" default="sh&#10;-cx&#10;curl --connect-timeout 20 --max-time 60 -o agent.jar $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_JAR_URL &amp;&amp; java -classpath agent.jar hudson.remoting.jnlp.Main -headless -url $DOCKER_SWARM_PLUGIN_JENKINS_URL -noreconnect -workDir /tmp $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_SECRET $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_NAME"/>
<f:textarea default="sh&#10;-cx&#10;curl --connect-timeout 20 --max-time 60 -o agent.jar $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_JAR_URL &amp;&amp; java -classpath agent.jar hudson.remoting.jnlp.Main -headless -url $DOCKER_SWARM_PLUGIN_JENKINS_URL -noreconnect -workDir /tmp $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_SECRET $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_NAME"/>

should work (same for other properties): the point of the field attr on f:entry is that it takes care of the plumbing needed for config form round-trips so long as you are consistent in your naming.

</f:entry>
<f:entry title="Windows Command" field="windowsCommand">
<f:textbox value="${dockerSwarmAgentTemplate.windowsCommand}" default="powershell.exe &amp; { Invoke-WebRequest -TimeoutSec 20 -OutFile agent.jar %DOCKER_SWARM_PLUGIN_JENKINS_AGENT_JAR_URL%; if($?) { java -classpath agent.jar hudson.remoting.jnlp.Main -headless -url %DOCKER_SWARM_PLUGIN_JENKINS_URL% -noreconnect %DOCKER_SWARM_PLUGIN_JENKINS_AGENT_SECRET% %DOCKER_SWARM_PLUGIN_JENKINS_AGENT_NAME% } }"/>
Expand Down