use of com.openshift.restclient.model.build.ISourceBuildStrategy in project jbosstools-openshift by jbosstools.
the class BuildConfigPropertySourceTest method givenSTIBuildStrategy.
private ISourceBuildStrategy givenSTIBuildStrategy() {
ISourceBuildStrategy strategy = mock(ISourceBuildStrategy.class);
when(strategy.getType()).thenReturn(BuildStrategyType.SOURCE);
when(strategy.getScriptsLocation()).thenReturn("scriptlocation");
when(strategy.getImage()).thenReturn(new DockerImageURI("foobar"));
Map<String, String> env = new HashMap<>();
env.put("foo", "bar");
when(strategy.getEnvironmentVariables()).thenReturn(env);
when(resource.getBuildStrategy()).thenReturn(strategy);
return strategy;
}
use of com.openshift.restclient.model.build.ISourceBuildStrategy in project jbosstools-openshift by jbosstools.
the class OpenshiftEapProfileDetector method isEapStyle.
@SuppressWarnings({ "deprecation" })
public boolean isEapStyle(IBuildConfig buildConfig) {
if (buildConfig == null) {
return false;
}
// First check buildconfig docker image name
IBuildStrategy strategy = buildConfig.getBuildStrategy();
DockerImageURI image = null;
boolean isEapStyle = false;
if (strategy instanceof ISourceBuildStrategy) {
image = ((ISourceBuildStrategy) strategy).getImage();
} else if (strategy instanceof ICustomBuildStrategy) {
image = ((ICustomBuildStrategy) strategy).getImage();
} else if (strategy instanceof IDockerBuildStrategy) {
image = ((IDockerBuildStrategy) strategy).getBaseImage();
} else if (strategy instanceof ISTIBuildStrategy) {
image = ((ISTIBuildStrategy) strategy).getImage();
}
if (image != null) {
isEapStyle = containsEapLikeKeywords(image.getName());
}
if (!isEapStyle) {
// Check template labels as a last resort
// not sure it's even possible to reach this point
Map<String, String> labels = buildConfig.getLabels();
if (labels != null) {
String template = labels.get("template");
isEapStyle = containsEapLikeKeywords(template);
}
}
return isEapStyle;
}
Aggregations