use of org.eclipse.jkube.kit.config.image.ImageName 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.image.ImageName 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.image.ImageName 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.image.ImageName in project jkube by eclipse.
the class KubernetesResourceUtil method extractImageUser.
private static String extractImageUser(String image, String groupId) {
ImageName name = new ImageName(image);
String imageUser = name.getUser();
if (imageUser != null) {
return imageUser;
} else {
return groupId;
}
}
use of org.eclipse.jkube.kit.config.image.ImageName in project jkube by eclipse.
the class DockerAccessWithHcClient method saveImage.
@Override
public void saveImage(String image, String filename, ArchiveCompression compression) throws DockerAccessException {
ImageName name = new ImageName(image);
String url = urlBuilder.getImage(name);
try {
delegate.get(url, getImageResponseHandler(filename, compression), HTTP_OK);
} catch (IOException e) {
throw new DockerAccessException(e, "Unable to save '%s' to '%s'", image, filename);
}
}
Aggregations