use of org.eclipse.jkube.kit.config.service.BuildServiceConfig in project jkube by eclipse.
the class TaskUtilTest method buildServiceConfigBuilder_shouldInitializeBuildServiceConfigWithDefaults.
@Test
public void buildServiceConfigBuilder_shouldInitializeBuildServiceConfigWithDefaults() {
// When
BuildServiceConfig buildServiceConfig = TaskUtil.buildServiceConfigBuilder(extension).build();
// Then
assertThat(buildServiceConfig).hasFieldOrPropertyWithValue("buildRecreateMode", BuildRecreateMode.none).hasFieldOrPropertyWithValue("jKubeBuildStrategy", JKubeBuildStrategy.docker).hasFieldOrPropertyWithValue("forcePull", false).hasFieldOrPropertyWithValue("buildDirectory", null);
}
use of org.eclipse.jkube.kit.config.service.BuildServiceConfig in project jkube by eclipse.
the class OpenShiftBuildServiceUtilsTest method computeS2IBuildName_withImageNameAndBuildServiceWithCustomSuffix_shouldReturnNameWithCustomSuffix.
@Test
public void computeS2IBuildName_withImageNameAndBuildServiceWithCustomSuffix_shouldReturnNameWithCustomSuffix() {
// Given
final BuildServiceConfig buildServiceConfig = BuildServiceConfig.builder().jKubeBuildStrategy(JKubeBuildStrategy.s2i).s2iBuildNameSuffix("-custom").buildDirectory(temporaryFolder.getRoot().getAbsolutePath()).build();
final ImageName imageName = new ImageName("registry/name:tag");
// When
final String result = computeS2IBuildName(buildServiceConfig, imageName);
// Then
assertThat(result).isEqualTo("name-custom");
}
use of org.eclipse.jkube.kit.config.service.BuildServiceConfig in project jkube by eclipse.
the class OpenShiftBuildServiceUtilsTest method createBuildOutput_withOutputKindDockerAndPushSecret_shouldReturnDocker.
@Test
public void createBuildOutput_withOutputKindDockerAndPushSecret_shouldReturnDocker() {
// Given
final BuildServiceConfig buildServiceConfig = BuildServiceConfig.builder().buildOutputKind("DockerImage").openshiftPushSecret("my-push-secret").buildDirectory(temporaryFolder.getRoot().getAbsolutePath()).build();
// When
final BuildOutput result = createBuildOutput(buildServiceConfig, new ImageName("my-app-image"));
// Then
assertThat(result).hasFieldOrPropertyWithValue("pushSecret.name", "my-push-secret").extracting(BuildOutput::getTo).hasFieldOrPropertyWithValue("kind", "DockerImage").hasFieldOrPropertyWithValue("name", "my-app-image:latest");
}
use of org.eclipse.jkube.kit.config.service.BuildServiceConfig in project jkube by eclipse.
the class OpenShiftBuildServiceUtilsTest method createBuildOutput_withDefaults_shouldReturnImageStreamTag.
@Test
public void createBuildOutput_withDefaults_shouldReturnImageStreamTag() {
// When
final BuildOutput result = createBuildOutput(new BuildServiceConfig(), new ImageName("my-app-image"));
// Then
assertThat(result).extracting(BuildOutput::getTo).hasFieldOrPropertyWithValue("kind", "ImageStreamTag").hasFieldOrPropertyWithValue("name", "my-app-image:latest");
}
use of org.eclipse.jkube.kit.config.service.BuildServiceConfig in project jkube by eclipse.
the class OpenshiftBuildServiceIntegrationTest method testDockerBuildFromExt.
@Test
public void testDockerBuildFromExt() throws Exception {
final BuildServiceConfig dockerConfig = withBuildServiceConfig(BuildServiceConfig.builder().buildDirectory(baseDir).buildRecreateMode(BuildRecreateMode.none).s2iBuildNameSuffix("-docker").jKubeBuildStrategy(JKubeBuildStrategy.docker).resourceConfig(mockedResourceConfig).build());
final WebServerEventCollector collector = prepareMockServer(dockerConfig, true, false, false);
OpenshiftBuildService service = new OpenshiftBuildService(jKubeServiceHub);
Map<String, String> fromExt = ImmutableMap.of("name", "app:1.2-1", "kind", "ImageStreamTag", "namespace", "my-project");
ImageConfiguration fromExtImage = ImageConfiguration.builder().name(projectName).build(BuildConfiguration.builder().fromExt(fromExt).nocache(Boolean.TRUE).build()).build();
service.build(fromExtImage);
assertTrue(mockServer.getOpenShiftMockServer().getRequestCount() > 8);
collector.assertEventsRecordedInOrder("build-config-check", "new-build-config", "pushed");
assertEquals("{\"apiVersion\":\"build.openshift.io/v1\",\"kind\":\"BuildConfig\",\"metadata\":{\"name\":\"myapp-docker\"},\"spec\":{\"output\":{\"to\":{\"kind\":\"ImageStreamTag\",\"name\":\"myapp:latest\"}},\"source\":{\"type\":\"Binary\"},\"strategy\":{\"dockerStrategy\":{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"app:1.2-1\",\"namespace\":\"my-project\"},\"noCache\":true},\"type\":\"Docker\"}}}", collector.getBodies().get(1));
collector.assertEventsNotRecorded("patch-build-config");
}
Aggregations