Skip to content

Commit

Permalink
WIP solution
Browse files Browse the repository at this point in the history
  • Loading branch information
stromnet committed Feb 16, 2018
1 parent 5492b02 commit e5c137a
Show file tree
Hide file tree
Showing 23 changed files with 965 additions and 301 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public class AssemblyConfiguration implements Serializable {
@Parameter
private Boolean ignorePermissions;

@Deprecated
public Boolean getIgnorePermissions() {
return ignorePermissions;
}

@Parameter
private AssemblyMode mode;

Expand All @@ -71,6 +76,10 @@ public class AssemblyConfiguration implements Serializable {
@Parameter
private String tarLongFileMode;

public Boolean getExportTargetDir() {
return exportTargetDir;
}

public Boolean exportTargetDir() {
if (exportTargetDir != null) {
return exportTargetDir;
Expand Down Expand Up @@ -120,6 +129,10 @@ public AssemblyMode getMode() {
return mode != null ? mode : AssemblyMode.dir;
}

public String getModeRaw() {
return mode != null ? mode.name() : null;
}

public String getTarLongFileMode() {
return tarLongFileMode;
}
Expand All @@ -136,6 +149,10 @@ public PermissionMode getPermissions() {
return permissions != null ? permissions : PermissionMode.keep;
}

public String getPermissionsRaw() {
return permissions != null ? permissions.name() : null;
}

public String getName() {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package io.fabric8.maven.docker.config;

import java.awt.*;
import java.io.File;
import java.io.Serializable;
import java.util.*;
import java.util.List;

import io.fabric8.maven.docker.util.*;
import org.apache.maven.plugins.annotations.Parameter;
Expand Down Expand Up @@ -47,7 +45,7 @@ public class BuildImageConfiguration implements Serializable {
* How interpolation of a dockerfile should be performed
*/
@Parameter
private String filter = DEFAULT_FILTER;
private String filter;

/**
* Base Image
Expand Down Expand Up @@ -83,13 +81,13 @@ public class BuildImageConfiguration implements Serializable {
private List<String> runCmds;

@Parameter
private String cleanup = DEFAULT_CLEANUP;
private String cleanup;

@Parameter
private boolean nocache = false;
private Boolean nocache;

@Parameter
private boolean optimise = false;
private Boolean optimise;

@Parameter
private List<String> volumes;
Expand Down Expand Up @@ -129,7 +127,7 @@ public class BuildImageConfiguration implements Serializable {
private AssemblyConfiguration assembly;

@Parameter
private boolean skip = false;
private Boolean skip;

@Parameter
private ArchiveCompression compression = ArchiveCompression.none;
Expand All @@ -154,7 +152,23 @@ public File getDockerArchive() {
return dockerArchiveFile;
}

public String getDockerFileRaw() {
return dockerFile;
}

public String getDockerArchiveRaw() {
return dockerArchive;
}

public String getDockerFileDirRaw() {
return dockerFileDir;
}

public String getFilter() {
return filter != null ? filter : DEFAULT_FILTER;
}

public String getFilterNoDefault() {
return filter;
}

Expand Down Expand Up @@ -221,19 +235,35 @@ public String getCommand() {
return command;
}

public String getCleanup() {
return cleanup;
}

public CleanupMode cleanupMode() {
return CleanupMode.parse(cleanup);
return CleanupMode.parse(cleanup != null ? cleanup : DEFAULT_CLEANUP);
}

public boolean nocache() {
return nocache;
return nocache != null ? nocache : false;
}

public boolean optimise() {
return optimise;
return optimise != null ? optimise : false;
}

public boolean skip() {
return skip != null ? skip : false;
}

public Boolean getNoCache() {
return nocache;
}

public Boolean getOptimise() {
return optimise;
}

public Boolean getSkip() {
return skip;
}

Expand Down Expand Up @@ -305,11 +335,7 @@ public Builder dockerArchive(String archive) {
}

public Builder filter(String filter) {
if (filter == null) {
config.filter = DEFAULT_FILTER;
} else {
config.filter = filter;
}
config.filter = filter;
return this;
}

Expand Down Expand Up @@ -395,11 +421,7 @@ public Builder cmd(String cmd) {
}

public Builder cleanup(String cleanup) {
if (cleanup == null) {
config.cleanup = DEFAULT_CLEANUP;
} else {
config.cleanup = cleanup;
}
config.cleanup = cleanup;
return this;
}

Expand All @@ -412,17 +434,13 @@ public Builder compression(String compression) {
return this;
}

public Builder nocache(String nocache) {
if (nocache != null) {
config.nocache = Boolean.valueOf(nocache);
}
public Builder nocache(Boolean nocache) {
config.nocache = nocache;
return this;
}

public Builder optimise(String optimise) {
if (optimise != null) {
config.optimise = Boolean.valueOf(optimise);
}
public Builder optimise(Boolean optimise) {
config.optimise = optimise;
return this;
}

Expand All @@ -443,10 +461,8 @@ public Builder healthCheck(HealthCheckConfiguration healthCheck) {
return this;
}

public Builder skip(String skip) {
if (skip != null) {
config.skip = Boolean.valueOf(skip);
}
public Builder skip(Boolean skip) {
config.skip = skip;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public RunImageConfiguration getRunConfiguration() {
return (run == null) ? RunImageConfiguration.DEFAULT : run;
}

public RunImageConfiguration getRunConfigurationRaw() {
return run;
}
public BuildImageConfiguration getBuildConfiguration() {
return build;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ public boolean hasAliases() {
return aliases != null && !aliases.isEmpty();
}

public Mode getMode() {
return mode;
}

public String getName() {
return name;
}

// ==============================================================================

// Mode used for determining the network
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
import java.util.Map;

import io.fabric8.maven.docker.util.DeepCopy;
import org.apache.maven.plugins.annotations.Parameter;

import io.fabric8.maven.docker.util.EnvUtil;
import org.apache.maven.plugins.annotations.Parameter;

import javax.annotation.Nonnull;

Expand Down Expand Up @@ -144,7 +143,7 @@ public class RunImageConfiguration implements Serializable {
private List<UlimitConfig> ulimits;

@Parameter
private boolean skip = false;
private Boolean skip;

/**
* Policy for pulling the image to start
Expand Down Expand Up @@ -257,6 +256,11 @@ public List<String> getDns() {
return dns;
}

@Deprecated
public String getNetRaw() {
return net;
}

public NetworkConfig getNetworkingConfig() {
if (network != null) {
return network;
Expand Down Expand Up @@ -308,6 +312,11 @@ public NamingStrategy getNamingStrategy() {
return namingStrategy == null ? NamingStrategy.none : namingStrategy;
}

public NamingStrategy getNamingStrategyRaw() {
return namingStrategy;

}

public String getExposedPropertyKey() {
return exposedPropertyKey;
}
Expand All @@ -320,7 +329,15 @@ public RestartPolicy getRestartPolicy() {
return (restartPolicy == null) ? RestartPolicy.DEFAULT : restartPolicy;
}

public RestartPolicy getRestartPolicyRaw() {
return restartPolicy;
}

public boolean skip() {
return skip != null ? skip : false;
}

public Boolean getSkip() {
return skip;
}

Expand Down Expand Up @@ -533,10 +550,8 @@ public Builder restartPolicy(RestartPolicy restartPolicy) {
return this;
}

public Builder skip(String skip) {
if (skip != null) {
config.skip = Boolean.valueOf(skip);
}
public Builder skip(Boolean skip) {
config.skip = skip;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,10 @@ private Integer asInteger(String number) {
}
return Integer.parseInt(number);
}

public String serialize() {
if(hard != null)
return name + "="+hard+":"+soft;
return name + "="+soft;
}
}
Loading

0 comments on commit e5c137a

Please sign in to comment.