Skip to content

Commit

Permalink
Renamed <params><param> to <exec><args>
Browse files Browse the repository at this point in the history
since this maps better to Dockerfile syntax. #130
  • Loading branch information
rhuss committed Jun 14, 2015
1 parent b2544cc commit cc6f348
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 28 deletions.
41 changes: 39 additions & 2 deletions doc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,44 @@

* **0.12**
- Add a new parameter 'docker.skipTags' that suppresses tagging of images that have been built.
- Allow CMD and ENTRYPOINT with shell and exec arguments (#130, #149)

Please note that for consistencies sake `<command>` has been renamed to `<cmd>` which contains inner elements
to match better the equivalent Dockerfile argument. The update should be trivial and easy to spot since a build will croak immediately.

The old format

````xml
<build>
<command>java -jar /server.jar</command>
</build>
````

becomes now

````xml
<build>
<cmd>
<exec>
<arg>java</arg>
<arg>-jar</arg>
<arg>/server.jar</arg>
</exec>
</cmd>
</build>
````

or

````xml
<build>
<cmd>
<shell>java -jar /server.jar
</cmd>
</build>
````

depending on whether you prefer the `exec` or `shell` form.

* **0.11.5**
- Fix problem with http:// URLs when a CERT path is set
Expand All @@ -14,8 +52,7 @@
- Workaround Docker problem when using an implicit registry `index.docker.io` when no registry is explicitly given.
- Fixed references to docker hub in documentation (#169)
- Fixed registry authentication lookup (#146)



* **0.11.4**
- Fixed documentation for available properties
- Changed property `docker.assembly.exportBase` to `docker.assembly.exportBaseDir` (#164)
Expand Down
26 changes: 13 additions & 13 deletions doc/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ of an image configuration. The available subelements are
* **cmd** A command to execute by default (i.e. if no command
is provided when a container for this image is started). See
[Start-up Arguments](#start-up-arguments) for details.
* **entrypoint** An entrypoint allows you to configure a container that will run as an executable where the entrypoint
points to the non-overidable executable. Set [Start-up Arguments](#start-up-arguments) for details.
* **entrypoint** An entrypoint allows you to configure a container that will run as an executable.
See [Start-up Arguments](#start-up-arguments) for details.
* **env** hold environments as described in
[Setting Environment Variables](#setting-environment-variables).
* **from** specifies the base image which should be used for this
Expand Down Expand Up @@ -271,11 +271,11 @@ Here's an example:

<entryPoint>
<!-- exec form for ENTRYPOINT -->
<params>
<param>java</param>
<param>-jar</param>
<param>/opt/demo/server.jar</param>
</params>
<exec>
<arg>java</arg>
<arg>-jar</arg>
<arg>/opt/demo/server.jar</arg>
</exec>
</entryPoint>

<assembly>
Expand Down Expand Up @@ -347,7 +347,7 @@ for an even more detailed explanation.
A entry point or command can be specified in two alternative formats:

* **shell** shell form in which the whole line is given to `shell -c` for interpretation.
* **params** list of arguments which will be given to the `exec` call directly without any shell interpretation.
* **exec** list of arguments (with inner `<args>`) arguments which will be given to the `exec` call directly without any shell interpretation.

Either shell or params should be specified.

Expand All @@ -365,11 +365,11 @@ or
````xml
<entryPoint>
<!-- exec form -->
<params>
<param>java</param>
<param>-jar</param>
<param>/opt/demo/server.jar</param>
</params>
<exec>
<args>java</args>
<args>-jar</args>
<args>/opt/demo/server.jar</args>
</exec>
</entryPoint>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private static void buildArguments(StringBuilder b, String name, Arguments argum
if (arguments.getShell() != null) {
b.append(arguments.getShell());
} else {
b.append("[\"").append(JOIN_ON_COMMA.join(arguments.getParams())).append("\"]");
b.append("[\"").append(JOIN_ON_COMMA.join(arguments.getExec())).append("\"]");
}
b.append("\n");
}
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/jolokia/docker/maven/config/Arguments.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Arguments {
/**
* @parameter
*/
private List<String> params;
private List<String> exec;

public void setShell(String shell) {
this.shell = shell;
Expand All @@ -23,19 +23,19 @@ public String getShell() {
return shell;
}

public void setParams(List<String> params) {
this.params = params;
public void setExec(List<String> exec) {
this.exec = exec;
}

public List<String> getParams() {
return params;
public List<String> getExec() {
return exec;
}

public void validate() throws IllegalArgumentException {
if (shell == null && (params == null || params.isEmpty())){
if (shell == null && (exec == null || exec.isEmpty())){
throw new IllegalArgumentException("Argument conflict, either shell or params should be specified");
}
if (shell != null && params != null) {
if (shell != null && exec != null) {
throw new IllegalArgumentException("Argument conflict, either shell or params should be specified");
}
}
Expand Down Expand Up @@ -64,7 +64,7 @@ public Builder withParam(String param){
public Arguments build(){
Arguments a = new Arguments();
a.setShell(shell);
a.setParams(params);
a.setExec(params);
return a;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package org.jolokia.docker.maven.config;

import org.apache.maven.plugin.MojoExecutionException;
import java.util.*;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.apache.maven.plugin.MojoExecutionException;

/**
* @author roland
Expand Down Expand Up @@ -58,6 +56,7 @@ public class BuildImageConfiguration {
*/
private Arguments cmd;


/**
* @parameter
*/
Expand Down

0 comments on commit cc6f348

Please sign in to comment.