use of io.fabric8.agent.model.Config in project docker-maven-plugin by fabric8io.
the class AuthConfigTest method dockerLoginConstructor.
@Test
public void dockerLoginConstructor() {
AuthConfig config = new AuthConfig(Base64.encodeBase64String("roland:secret".getBytes()), "roland@jolokia.org");
check(config);
}
use of io.fabric8.agent.model.Config in project docker-maven-plugin by fabric8io.
the class StopMojo method getNetworksToRemove.
private Set<Network> getNetworksToRemove(QueryService queryService, PomLabel pomLabel) throws DockerAccessException {
if (!autoCreateCustomNetworks) {
return Collections.emptySet();
}
Set<Network> customNetworks = new HashSet<>();
Set<Network> networks = queryService.getNetworks();
for (ImageConfiguration image : getResolvedImages()) {
final NetworkConfig config = image.getRunConfiguration().getNetworkingConfig();
if (config.isCustomNetwork()) {
Network network = getNetworkByName(networks, config.getCustomNetwork());
if (network != null) {
customNetworks.add(network);
for (Container container : getContainersToStop(queryService, image)) {
if (!shouldStopContainer(container, pomLabel, image)) {
// it's sill in use don't collect it
customNetworks.remove(network);
}
}
}
}
}
return customNetworks;
}
use of io.fabric8.agent.model.Config in project docker-maven-plugin by fabric8io.
the class ContainerHostConfig method logConfig.
public ContainerHostConfig logConfig(LogConfiguration logConfig) {
if (logConfig != null) {
LogConfiguration.LogDriver logDriver = logConfig.getDriver();
if (logDriver != null) {
JSONObject logConfigJson = new JSONObject();
logConfigJson.put("Type", logDriver.getName());
Map<String, String> opts = logDriver.getOpts();
if (opts != null && opts.size() > 0) {
JSONObject config = new JSONObject();
for (Map.Entry<String, String> logOpt : opts.entrySet()) {
config.put(logOpt.getKey(), logOpt.getValue());
}
logConfigJson.put("Config", config);
}
startConfig.put("LogConfig", logConfigJson);
}
}
return this;
}
use of io.fabric8.agent.model.Config in project docker-maven-plugin by fabric8io.
the class PropertyConfigHandlerTest method testNoCleanup.
@Test
public void testNoCleanup() throws Exception {
String[] testData = new String[] { k(ConfigKey.NAME), "image", k(ConfigKey.CLEANUP), "none", k(ConfigKey.FROM), "base" };
ImageConfiguration config = resolveExternalImageConfig(testData);
assertEquals(CleanupMode.NONE, config.getBuildConfiguration().cleanupMode());
}
use of io.fabric8.agent.model.Config in project docker-maven-plugin by fabric8io.
the class PropertyConfigHandlerTest method testNoOptimise.
@Test
public void testNoOptimise() throws Exception {
String[] testData = new String[] { k(ConfigKey.NAME), "image", k(ConfigKey.OPTIMISE), "false", k(ConfigKey.FROM), "base" };
ImageConfiguration config = resolveExternalImageConfig(testData);
assertEquals(false, config.getBuildConfiguration().optimise());
}
Aggregations