Skip to content

Commit

Permalink
add logging for tear down and move jib build into one test
Browse files Browse the repository at this point in the history
  • Loading branch information
mpeddada1 committed Jun 18, 2024
1 parent ec31463 commit c32a132
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -423,21 +423,32 @@ public void testDistroless_ociManifest()
throws IOException, InterruptedException, ExecutionException, RegistryException,
CacheDirectoryCreationException, InvalidImageReferenceException {
System.out.println("testDistroless_ociManifest()");
System.out.println(Runtime.getRuntime().availableProcessors());

Jib.from("gcr.io/distroless/base@" + KNOWN_OCI_INDEX_SHA)
.setPlatforms(
ImmutableSet.of(new Platform("arm64", "linux"), new Platform("amd64", "linux")))
// Pushing to registry causes next test to hang.
.containerize(
Containerizer.to(
DockerDaemonImage.named(dockerHost + ":6000/jib-distroless:multi-platform"))
RegistryImage.named(dockerHost + ":6000/jib-distroless:multi-platform"))
.setAllowInsecureRegistries(true));

// V22ManifestListTemplate manifestList =
// (V22ManifestListTemplate)
// distrolessRegistryClient.pullManifest("multi-platform").getManifest();
// Assert.assertEquals(2, manifestList.getManifests().size());
// ManifestDescriptorTemplate.Platform platform1 =
// manifestList.getManifests().get(0).getPlatform();
String toImage = dockerHost + ":5000/docker-daemon-mismatched-arch";
Jib.from(
RegistryImage.named(
"busybox@sha256:eb427d855f82782c110b48b9a398556c629ce4951ae252c6f6751a136e194668"))
.containerize(Containerizer.to(DockerDaemonImage.named(toImage)));
System.out.println("post-build");

V22ManifestListTemplate manifestList =
(V22ManifestListTemplate)
distrolessRegistryClient.pullManifest("multi-platform").getManifest();
Assert.assertEquals(2, manifestList.getManifests().size());
ManifestDescriptorTemplate.Platform platform1 =
manifestList.getManifests().get(0).getPlatform();
System.out.println(platform1.getArchitecture());

// ManifestDescriptorTemplate.Platform platform2 =
// manifestList.getManifests().get(1).getPlatform();
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ protected void before() throws IOException, InterruptedException {

@Override
protected void after() {
System.out.println("tear down");
stop();
}

Expand Down
2 changes: 1 addition & 1 deletion kokoro/presubmit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ docker kill $(docker ps --all --quiet | grep -v "$CONTAINER_ID") || true
cd github/jib

# we only run integration tests on jib-core for presubmit
./gradlew clean build :jib-core:integrationTest --info --stacktrace
./gradlew clean build :jib-core:integrationTest --tests "com.google.cloud.tools.jib.api.JibIntegrationTest.testDistroless_ociManifest" --info --stacktrace

0 comments on commit c32a132

Please sign in to comment.