use of io.fabric8.docker.api.model.Image in project docker-maven-plugin by fabric8io.
the class PropertyConfigHandlerTest method testNoCacheEnabled.
@Test
public void testNoCacheEnabled() throws Exception {
String[] testData = new String[] { k(ConfigKey.NAME), "image", k(ConfigKey.NOCACHE), "true", k(ConfigKey.FROM), "base" };
ImageConfiguration config = resolveExternalImageConfig(testData);
assertEquals(true, config.getBuildConfiguration().nocache());
}
use of io.fabric8.docker.api.model.Image in project docker-maven-plugin by fabric8io.
the class PropertyConfigHandlerTest method testNoCacheDisabled.
@Test
public void testNoCacheDisabled() throws Exception {
String[] testData = new String[] { k(ConfigKey.NAME), "image", k(ConfigKey.NOCACHE), "false", k(ConfigKey.FROM), "base" };
ImageConfiguration config = resolveExternalImageConfig(testData);
assertEquals(false, config.getBuildConfiguration().nocache());
}
use of io.fabric8.docker.api.model.Image in project docker-maven-plugin by fabric8io.
the class PropertyConfigHandlerTest method resolveExternalImageConfig.
private ImageConfiguration resolveExternalImageConfig(String[] testData) {
Map<String, String> external = new HashMap<>();
external.put("type", "props");
ImageConfiguration config = new ImageConfiguration.Builder().name("image").alias("alias").externalConfig(external).build();
List<ImageConfiguration> resolvedImageConfigs = resolveImage(config, props(testData));
assertEquals(1, resolvedImageConfigs.size());
return resolvedImageConfigs.get(0);
}
use of io.fabric8.docker.api.model.Image in project docker-maven-plugin by fabric8io.
the class PropertyConfigHandlerTest method testFilter.
@Test
public void testFilter() {
String filter = "@";
String[] testData = new String[] { k(ConfigKey.NAME), "image", k(ConfigKey.FROM), "base", k(ConfigKey.FILTER), filter };
ImageConfiguration config = resolveExternalImageConfig(testData);
assertEquals(filter, config.getBuildConfiguration().getFilter());
}
use of io.fabric8.docker.api.model.Image in project kie-wb-common by kiegroup.
the class OpenShiftClient method destroy.
public void destroy(String id) throws OpenShiftClientException {
try {
OpenShiftRuntimeId runtimeId = OpenShiftRuntimeId.fromString(id);
String prjName = runtimeId.project();
String svcName = runtimeId.service();
// TODO: should we always depend on the app label being specified, or gotten from the service?
String appName = runtimeId.application();
if (appName == null || appName.isEmpty()) {
Service service = delegate.services().inNamespace(prjName).withName(svcName).get();
if (service != null) {
appName = service.getMetadata().getLabels().get(APP_LABEL);
}
}
/*
* cascading delete of deploymentConfigs means we don't have to also do the following:
* delegate.deploymentConfigs().inNamespace(prjName).withLabel(APP_LABEL, appName).delete();
* delegate.replicationControllers().inNamespace(prjName).withLabel(APP_LABEL, appName).delete();
* delegate.pods().inNamespace(prjName).withLabel(APP_LABEL, appName).delete();
* , but deleting services and routes are still necessary:
*/
delegate.deploymentConfigs().inNamespace(prjName).withName(svcName).cascading(true).delete();
if (appName != null) {
delegate.services().inNamespace(prjName).withLabel(APP_LABEL, appName).delete();
delegate.routes().inNamespace(prjName).withLabel(APP_LABEL, appName).delete();
} else {
delegate.services().inNamespace(prjName).delete();
delegate.routes().inNamespace(prjName).delete();
}
// clean up any generated image streams, secrets, and service accounts
for (ImageStream item : delegate.imageStreams().inNamespace(prjName).list().getItems()) {
if (isGuvnorAlaGenerated(item)) {
delegate.imageStreams().inNamespace(prjName).delete(item);
}
}
for (Secret item : delegate.secrets().inNamespace(prjName).list().getItems()) {
if (isGuvnorAlaGenerated(item)) {
delegate.secrets().inNamespace(prjName).delete(item);
}
}
for (ServiceAccount item : delegate.serviceAccounts().inNamespace(prjName).list().getItems()) {
if (isGuvnorAlaGenerated(item)) {
delegate.serviceAccounts().inNamespace(prjName).delete(item);
}
}
// clean up generated project
if (isGuvnorAlaGenerated(delegate.projects().withName(prjName).get())) {
delegate.projects().withName(prjName).delete();
}
} catch (Throwable t) {
throw new OpenShiftClientException(t.getMessage(), t);
}
}
Aggregations