use of io.fabric8.openshift.api.model.BinaryBuildSource in project strimzi by strimzi.
the class KafkaConnectS2ICluster method generateBuildConfig.
/**
* Generate new BuildConfig
*
* @return BuildConfig resource definition
*/
public BuildConfig generateBuildConfig() {
BuildTriggerPolicy triggerConfigChange = new BuildTriggerPolicy();
triggerConfigChange.setType("ConfigChange");
BuildTriggerPolicy triggerImageChange = new BuildTriggerPolicy();
triggerImageChange.setType("ImageChange");
triggerImageChange.setImageChange(new ImageChangeTrigger());
BuildConfig build = new BuildConfigBuilder().withNewMetadata().withName(name).withLabels(getLabelsWithName()).withNamespace(namespace).endMetadata().withNewSpec().withFailedBuildsHistoryLimit(5).withNewOutput().withNewTo().withKind("ImageStreamTag").withName(image).endTo().endOutput().withRunPolicy("Serial").withNewSource().withType("Binary").withBinary(new BinaryBuildSource()).endSource().withNewStrategy().withType("Source").withNewSourceStrategy().withNewFrom().withKind("ImageStreamTag").withName(getSourceImageStreamName() + ":" + sourceImageTag).endFrom().endSourceStrategy().endStrategy().withTriggers(triggerConfigChange, triggerImageChange).endSpec().build();
return build;
}
use of io.fabric8.openshift.api.model.BinaryBuildSource in project strimzi by strimzi.
the class KafkaConnectS2IClusterTest method testGenerateBuildConfig.
@Test
public void testGenerateBuildConfig() {
BuildConfig bc = kc.generateBuildConfig();
assertEquals(kc.kafkaConnectClusterName(cluster), bc.getMetadata().getName());
assertEquals(namespace, bc.getMetadata().getNamespace());
assertEquals(ResourceUtils.labels(Labels.STRIMZI_CLUSTER_LABEL, cluster, Labels.STRIMZI_TYPE_LABEL, "kafka-connect-s2i", "my-user-label", "cromulent", Labels.STRIMZI_NAME_LABEL, kc.kafkaConnectClusterName(cluster)), bc.getMetadata().getLabels());
assertEquals("ImageStreamTag", bc.getSpec().getOutput().getTo().getKind());
assertEquals(kc.image, bc.getSpec().getOutput().getTo().getName());
assertEquals("Serial", bc.getSpec().getRunPolicy());
assertEquals("Binary", bc.getSpec().getSource().getType());
assertEquals(new BinaryBuildSource(), bc.getSpec().getSource().getBinary());
assertEquals("Source", bc.getSpec().getStrategy().getType());
assertEquals("ImageStreamTag", bc.getSpec().getStrategy().getSourceStrategy().getFrom().getKind());
assertEquals(kc.getSourceImageStreamName() + ":" + kc.sourceImageTag, bc.getSpec().getStrategy().getSourceStrategy().getFrom().getName());
assertEquals(2, bc.getSpec().getTriggers().size());
assertEquals("ConfigChange", bc.getSpec().getTriggers().get(0).getType());
assertEquals("ImageChange", bc.getSpec().getTriggers().get(1).getType());
assertEquals(new ImageChangeTrigger(), bc.getSpec().getTriggers().get(1).getImageChange());
}
Aggregations