before_code
stringlengths
30
149k
reviewer_comment
stringlengths
16
20.6k
after_code
stringlengths
30
163k
diff_context
stringlengths
0
22.4k
file_path
stringlengths
6
155
comment_line
int64
0
26
language
stringclasses
19 values
quality_score
float64
0.07
1
comment_type
stringclasses
9 values
comment_length
int64
16
20.6k
before_lines
int64
2
4.61k
after_lines
int64
2
4.4k
is_negative
bool
2 classes
pr_title
stringlengths
7
140
pr_number
int64
18
61.2k
repo_name
stringclasses
29 values
repo_stars
int64
321
56k
repo_language
stringclasses
14 values
reviewer_username
stringclasses
378 values
author_username
stringclasses
739 values
user
stringlengths
361
200k
assistant
stringlengths
16
20.6k
system
stringclasses
1 value
} } return extraDirectories; } MavenProject project = Preconditions.checkNotNull(jibPluginConfiguration.getProject()); return Collections.singletonList( new ExtraDirectoryParameters( project.getBasedir().toPath().resolve("src").resolve("main").resolve("jib").toFile()...
Can be brief in this short local context. ```suggestion Optional<String> file = permission.getFile(); Optional<String> mode = permission.getMode(); ```
} } return extraDirectories; } MavenProject project = Preconditions.checkNotNull(jibPluginConfiguration.getProject()); return Collections.singletonList( new ExtraDirectoryParameters( project.getBasedir().toPath().resolve("src").resolve("main").resolve("jib").toFile()...
@@ -140,12 +140,14 @@ static void finishUpdateChecker( // Order is important, so use a LinkedHashMap Map<String, FilePermissions> permissionsMap = new LinkedHashMap<>(); for (PermissionConfiguration permission : permissionList) { - if (!permission.getFile().isPresent() || !permission.getMode().isPre...
jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/MojoCommon.java
26
Java
0.714
security
167
51
51
false
create obj and call Optional#isPresent() before access. fix sonar bug.
3,370
GoogleContainerTools/jib
11,032
Java
chanseokoh
zhumin8
Review this pull request change. Language: Java File: jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/MojoCommon.java PR Title: create obj and call Optional#isPresent() before access. fix sonar bug. BEFORE CODE: } } return extraDirectories; } MavenProject project = Preco...
Can be brief in this short local context. ```suggestion Optional<String> file = permission.getFile(); Optional<String> mode = permission.getMode(); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
* * @param dockerDaemonImage the {@link DockerDaemonImage} that defines target Docker daemon * @return a new {@link Containerizer} */ public static Containerizer to(DockerDaemonImage dockerDaemonImage) { ImageConfiguration imageConfiguration = ImageConfiguration.builder(dockerDaemonImage.getIm...
```suggestion Optional<ImageReference> imageReference = tarImage.getImageReference(); ```
* * @param dockerDaemonImage the {@link DockerDaemonImage} that defines target Docker daemon * @return a new {@link Containerizer} */ public static Containerizer to(DockerDaemonImage dockerDaemonImage) { ImageConfiguration imageConfiguration = ImageConfiguration.builder(dockerDaemonImage.getIm...
@@ -110,14 +110,15 @@ public static Containerizer to(DockerDaemonImage dockerDaemonImage) { * @return a new {@link Containerizer} */ public static Containerizer to(TarImage tarImage) { - if (!tarImage.getImageReference().isPresent()) { + Optional<ImageReference> tarImageReference = tarImage.getImageRef...
jib-core/src/main/java/com/google/cloud/tools/jib/api/Containerizer.java
26
Java
0.571
suggestion
95
51
51
false
create obj and call Optional#isPresent() before access. fix sonar bug.
3,370
GoogleContainerTools/jib
11,032
Java
chanseokoh
zhumin8
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/api/Containerizer.java PR Title: create obj and call Optional#isPresent() before access. fix sonar bug. BEFORE CODE: * * @param dockerDaemonImage the {@link DockerDaemonImage} that defines target Docker dae...
```suggestion Optional<ImageReference> imageReference = tarImage.getImageReference(); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
/** * Generates a {@link JibContainerBuilder} from contents of a jar file. * * @param processor jar processor * @param jarOptions jar cli options * @param commonCliOptions common cli options * @param commonContainerConfigCliOptions common command line options shared between jar and war * com...
```suggestion Optional<String> imageReference = commonContainerConfigCliOptions.getFrom(); ```
/** * Generates a {@link JibContainerBuilder} from contents of a jar file. * * @param processor jar processor * @param jarOptions jar cli options * @param commonCliOptions common cli options * @param commonContainerConfigCliOptions common command line options shared between jar and war * com...
@@ -56,13 +57,11 @@ public static JibContainerBuilder toJibContainerBuilder( // Use AdoptOpenJDK image as the default base image. JibContainerBuilder containerBuilder; - if (commonContainerConfigCliOptions.getFrom().isPresent()) { + Optional<String> baseImageRef = commonContainerConfigCliOptions.getFr...
jib-cli/src/main/java/com/google/cloud/tools/jib/cli/jar/JarFiles.java
26
Java
0.714
suggestion
100
51
51
false
create obj and call Optional#isPresent() before access. fix sonar bug.
3,370
GoogleContainerTools/jib
11,032
Java
chanseokoh
zhumin8
Review this pull request change. Language: Java File: jib-cli/src/main/java/com/google/cloud/tools/jib/cli/jar/JarFiles.java PR Title: create obj and call Optional#isPresent() before access. fix sonar bug. BEFORE CODE: /** * Generates a {@link JibContainerBuilder} from contents of a jar file. * * @param...
```suggestion Optional<String> imageReference = commonContainerConfigCliOptions.getFrom(); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if (!Files.isReadable(buildFile)) { logger.log( LogEvent.Level.ERROR, "The Build File YAML either does not exist or cannot be opened for reading: " + buildFile); return 1; } if (!Files.isRegularFile(buildFile)) { logger.log(LogEvent.Level...
I think we should interrupt only when catching `InterruptedException`, not for all exceptions.
if (!Files.isReadable(buildFile)) { logger.log( LogEvent.Level.ERROR, "The Build File YAML either does not exist or cannot be opened for reading: " + buildFile); return 1; } if (!Files.isRegularFile(buildFile)) { logger.log(LogEvent.Level...
@@ -144,6 +144,7 @@ public Integer call() { JibCli.writeImageJson(commonCliOptions.getImageJsonPath(), jibContainer); } catch (Exception ex) { JibCli.logTerminatingException(logger, ex, commonCliOptions.isStacktrace()); + Thread.currentThread().interrupt();
jib-cli/src/main/java/com/google/cloud/tools/jib/cli/Build.java
26
Java
0.571
suggestion
94
35
38
false
Re-interrupt threads when InterruptedException is caught
3,378
GoogleContainerTools/jib
11,032
Java
chanseokoh
mpeddada1
Review this pull request change. Language: Java File: jib-cli/src/main/java/com/google/cloud/tools/jib/cli/Build.java PR Title: Re-interrupt threads when InterruptedException is caught BEFORE CODE: if (!Files.isReadable(buildFile)) { logger.log( LogEvent.Level.ERROR, "The Build...
I think we should interrupt only when catching `InterruptedException`, not for all exceptions.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
return 1; } if (Files.isDirectory(warFile)) { logger.log( LogEvent.Level.ERROR, "The file path provided is for a directory. Please provide a path to a WAR: " + warFile); return 1; } Path warFileParentDir = Verify.verifyNotNull(warF...
Probably, instead of enumerating all these, you can catch `InterruptedException` first and then catch `Exception` later. But this works too. (Need to confirm if this works as intended.)
+ warFile); return 1; } Path warFileParentDir = Verify.verifyNotNull(warFile.toAbsolutePath().getParent()); CacheDirectories cacheDirectories = CacheDirectories.from(commonCliOptions, warFileParentDir); ArtifactProcessor processor = ArtifactProcessors.fromWar( ...
@@ -117,9 +123,18 @@ public Integer call() { JibContainer jibContainer = containerBuilder.containerize(containerizer); JibCli.writeImageJson(commonCliOptions.getImageJsonPath(), jibContainer); - } catch (Exception ex) { + } catch (IOException
jib-cli/src/main/java/com/google/cloud/tools/jib/cli/War.java
26
Java
0.714
suggestion
185
51
46
false
Re-interrupt threads when InterruptedException is caught
3,378
GoogleContainerTools/jib
11,032
Java
chanseokoh
mpeddada1
Review this pull request change. Language: Java File: jib-cli/src/main/java/com/google/cloud/tools/jib/cli/War.java PR Title: Re-interrupt threads when InterruptedException is caught BEFORE CODE: return 1; } if (Files.isDirectory(warFile)) { logger.log( LogEvent.Level.ERROR, ...
Probably, instead of enumerating all these, you can catch `InterruptedException` first and then catch `Exception` later. But this works too. (Need to confirm if this works as intended.)
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Assert.assertEquals(2, layers.size()); Assert.assertEquals( DescriptorDigest.fromDigest( "sha256:5bd451067f9ab05e97cda8476c82f86d9b69c2dffb60a8ad2fe3723942544ab3"), layers.get(0).getBlobDescriptor().getDigest()); Assert.assertEquals( DescriptorDigest.fromDigest( ...
This is an interesting discovery and approach! But maybe let's stick with directly calling `assert` statements to follow the guidelines on having dedicated `arrange`, `act` and `assert` blocks in tests?
Assert.assertEquals(2, layers.size()); Assert.assertEquals( DescriptorDigest.fromDigest( "sha256:5bd451067f9ab05e97cda8476c82f86d9b69c2dffb60a8ad2fe3723942544ab3"), layers.get(0).getBlobDescriptor().getDigest()); Assert.assertEquals( DescriptorDigest.fromDigest( ...
@@ -85,7 +85,7 @@ public void testToImage_oci() testToImage_buildable("core/json/ocimanifest.json", OciManifestTemplate.class); } - @Test + @Test(expected = Test.None.class /* no exception expected */)
jib-core/src/test/java/com/google/cloud/tools/jib/image/json/JsonToImageTranslatorTest.java
26
Java
0.571
question
203
51
51
false
fixes several sonar code-smell for no assertion in test.
3,379
GoogleContainerTools/jib
11,032
Java
mpeddada1
zhumin8
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/image/json/JsonToImageTranslatorTest.java PR Title: fixes several sonar code-smell for no assertion in test. BEFORE CODE: Assert.assertEquals(2, layers.size()); Assert.assertEquals( DescriptorDige...
This is an interesting discovery and approach! But maybe let's stick with directly calling `assert` statements to follow the guidelines on having dedicated `arrange`, `act` and `assert` blocks in tests?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
try { SkaffoldSyncMapTemplate.from(FAIL_TEST_JSON_BAD_PROPERTY_NAME); Assert.fail(); } catch (UnrecognizedPropertyException ex) { Assert.assertTrue(ex.getMessage().contains("Unrecognized field \"jean-luc\"")); } } @Test public void testFrom_missingField() throws IOException { tr...
```suggestion SkaffoldSyncMapTemplate templateNoGenerated = SkaffoldSyncMapTemplate.from(TEST_JSON_NO_GENERATED); Assert.assertTrue(templateEmptyGenerated.getGenerated().isEmpty()); Assert.assertTrue(templateNoGenerated.getGenerated().isEmpty()); ```
try { SkaffoldSyncMapTemplate.from(FAIL_TEST_JSON_BAD_PROPERTY_NAME); Assert.fail(); } catch (UnrecognizedPropertyException ex) { Assert.assertTrue(ex.getMessage().contains("Unrecognized field \"jean-luc\"")); } } @Test public void testFrom_missingField() throws IOException { tr...
@@ -101,8 +101,12 @@ public void testFrom_missingField() throws IOException { @Test public void testFrom_validEmpty() throws Exception { - SkaffoldSyncMapTemplate.from(TEST_JSON_EMPTY_GENERATED); - SkaffoldSyncMapTemplate.from(TEST_JSON_NO_GENERATED); + SkaffoldSyncMapTemplate templateEmptyGenerated = ...
jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/SkaffoldSyncMapTemplateTest.java
26
Java
0.786
suggestion
275
51
51
false
fixes several sonar code-smell for no assertion in test.
3,379
GoogleContainerTools/jib
11,032
Java
mpeddada1
zhumin8
Review this pull request change. Language: Java File: jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/SkaffoldSyncMapTemplateTest.java PR Title: fixes several sonar code-smell for no assertion in test. BEFORE CODE: try { SkaffoldSyncMapTemplate.from(FAIL_TEST_JSON_BAD_PROPERTY_N...
```suggestion SkaffoldSyncMapTemplate templateNoGenerated = SkaffoldSyncMapTemplate.from(TEST_JSON_NO_GENERATED); Assert.assertTrue(templateEmptyGenerated.getGenerated().isEmpty()); Assert.assertTrue(templateNoGenerated.getGenerated().isEmpty()); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
SkaffoldSyncMapTemplate.from(FAIL_TEST_JSON_BAD_PROPERTY_NAME); Assert.fail(); } catch (UnrecognizedPropertyException ex) { Assert.assertTrue(ex.getMessage().contains("Unrecognized field \"jean-luc\"")); } } @Test public void testFrom_missingField() throws IOException { try { ...
We can remove this comment now
SkaffoldSyncMapTemplate.from(FAIL_TEST_JSON_BAD_PROPERTY_NAME); Assert.fail(); } catch (UnrecognizedPropertyException ex) { Assert.assertTrue(ex.getMessage().contains("Unrecognized field \"jean-luc\"")); } } @Test public void testFrom_missingField() throws IOException { try { ...
@@ -101,8 +101,12 @@ public void testFrom_missingField() throws IOException { @Test public void testFrom_validEmpty() throws Exception { - SkaffoldSyncMapTemplate.from(TEST_JSON_EMPTY_GENERATED); - SkaffoldSyncMapTemplate.from(TEST_JSON_NO_GENERATED); + SkaffoldSyncMapTemplate templateEmptyGenerated = ...
jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/SkaffoldSyncMapTemplateTest.java
26
Java
0.143
refactor
30
51
51
false
fixes several sonar code-smell for no assertion in test.
3,379
GoogleContainerTools/jib
11,032
Java
mpeddada1
zhumin8
Review this pull request change. Language: Java File: jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/SkaffoldSyncMapTemplateTest.java PR Title: fixes several sonar code-smell for no assertion in test. BEFORE CODE: SkaffoldSyncMapTemplate.from(FAIL_TEST_JSON_BAD_PROPERTY_NAME); ...
We can remove this comment now
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
return Optional.of(call(httpMethod, toHttp(url), request, getHttpTransport(true))); case INSECURE_HTTPS: return Optional.of(call(httpMethod, url, request, getHttpTransport(false))); default: return Optional.empty(); // No history found. Should go for normal execution path. } } ...
Can lines 331-343 be in a helper?
case HTTP: return Optional.of(call(httpMethod, toHttp(url), request, getHttpTransport(true))); case INSECURE_HTTPS: return Optional.of(call(httpMethod, url, request, getHttpTransport(false))); default: return Optional.empty(); // No history found. Should go for normal execution...
@@ -338,16 +332,13 @@ private Response call(String httpMethod, URL url, Request request, HttpTransport @Override public boolean handleIOException(HttpRequest request, boolean supportsRetry) throws IOException {
jib-core/src/main/java/com/google/cloud/tools/jib/http/FailoverHttpClient.java
26
Java
0.071
refactor
33
51
51
false
CHANGELOG and cleanups after the HTTP retry external PR contribution
3,390
GoogleContainerTools/jib
11,032
Java
mpeddada1
chanseokoh
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/http/FailoverHttpClient.java PR Title: CHANGELOG and cleanups after the HTTP retry external PR contribution BEFORE CODE: return Optional.of(call(httpMethod, toHttp(url), request, getHttpTransport(true)));...
Can lines 331-343 be in a helper?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
private static final String BOOT_INF = "BOOT-INF"; /** * Constructor for {@link SpringBootExplodedProcessor}. * * @param jarPath path to jar file * @param targetExplodedJarRoot path to exploded-jar root * @param jarJavaVersion jar java version */ public SpringBootExplodedProcessor( Path j...
```suggestion ZipEntry layerIndex = jarFile.getEntry(BOOT_INF + "/layers.idx"); ```
private final Path targetExplodedJarRoot; private final Integer jarJavaVersion; /** * Constructor for {@link SpringBootExplodedProcessor}. * * @param jarPath path to jar file * @param targetExplodedJarRoot path to exploded-jar root * @param jarJavaVersion jar java version */ public SpringBoot...
@@ -69,7 +70,7 @@ public SpringBootExplodedProcessor( try (JarFile jarFile = new JarFile(jarPath.toFile())) { ZipUtil.unzip(jarPath, targetExplodedJarRoot, true); - ZipEntry layerIndex = jarFile.getEntry("BOOT-INF/layers.idx"); + ZipEntry layerIndex = jarFile.getEntry(BOOT_INF + "/" + "layers.id...
jib-cli/src/main/java/com/google/cloud/tools/jib/cli/jar/SpringBootExplodedProcessor.java
26
Java
0.571
suggestion
91
51
51
false
Define constants instead of using String literals
3,402
GoogleContainerTools/jib
11,032
Java
chanseokoh
mpeddada1
Review this pull request change. Language: Java File: jib-cli/src/main/java/com/google/cloud/tools/jib/cli/jar/SpringBootExplodedProcessor.java PR Title: Define constants instead of using String literals BEFORE CODE: private static final String BOOT_INF = "BOOT-INF"; /** * Constructor for {@link SpringBootE...
```suggestion ZipEntry layerIndex = jarFile.getEntry(BOOT_INF + "/layers.idx"); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language gover...
This Javadoc looks strange to me. Which error prone warnings is this addressing?
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language gover...
@@ -29,8 +29,8 @@ * <pre>{@code * image: gcr.io/example/baseimage * platforms: - * - see {@link PlatformSpec} - * - see {@link PlatformSpec} + * - see }{@link PlatformSpec}{@code + * - see }{@link PlatformSpec}{@code
jib-cli/src/main/java/com/google/cloud/tools/jib/cli/buildfile/BaseImageSpec.java
26
Java
0.357
question
80
51
51
false
Eliminate ErrorProne warnings
3,410
GoogleContainerTools/jib
11,032
Java
suztomo
rainyShine
Review this pull request change. Language: Java File: jib-cli/src/main/java/com/google/cloud/tools/jib/cli/buildfile/BaseImageSpec.java PR Title: Eliminate ErrorProne warnings BEFORE CODE: * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software *...
This Javadoc looks strange to me. Which error prone warnings is this addressing?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
/** Builds a {@link ConsoleLogger}. */ public class ConsoleLoggerBuilder { /** * Alias for function that takes a map from {@link Level} to a log message {@link Consumer} and * creates a {@link ConsoleLogger}. */ @VisibleForTesting @FunctionalInterface interface ConsoleLoggerFactory extends Funct...
This sounds a bit weird. Just `messageConsumerMap`?
/** Builds a {@link ConsoleLogger}. */ public class ConsoleLoggerBuilder { /** * Alias for function that takes a map from {@link Level} to a log message {@link Consumer} and * creates a {@link ConsoleLogger}. */ @VisibleForTesting @FunctionalInterface interface ConsoleLoggerFactory extends Funct...
@@ -47,9 +47,9 @@ public static ConsoleLoggerBuilder rich( SingleThreadedExecutor singleThreadedExecutor, boolean enableTwoCursorUpJump) { return new ConsoleLoggerBuilder( - messageConsumers -> + levelMessageConsumerMap ->
jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/logging/ConsoleLoggerBuilder.java
26
Java
0.357
question
51
51
51
false
Field name changes to fix sonar issues
3,412
GoogleContainerTools/jib
11,032
Java
chanseokoh
zhumin8
Review this pull request change. Language: Java File: jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/logging/ConsoleLoggerBuilder.java PR Title: Field name changes to fix sonar issues BEFORE CODE: /** Builds a {@link ConsoleLogger}. */ public class ConsoleLoggerBuilder { /** * Alia...
This sounds a bit weird. Just `messageConsumerMap`?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} return Optional.empty(); } } private Optional<ImagesAndRegistryClient> getImagesAndRegistryClient( EventHandlers eventHandlers, String mirror, ProgressEventDispatcher progressDispatcher2, RegistryClient registryClient) throws IOException, RegistryException, LayerCoun...
```suggestion private List<Image> pullPublicImages( EventHandlers eventHandlers, RegistryClient registryClient, ProgressEventDispatcher progressDispatcher) throws IOException, RegistryException, LayerCountMismatchException, BadContainerConfigurationFormatException { try { ...
} return Optional.empty(); } } private List<Image> pullPublicImages( EventHandlers eventHandlers, RegistryClient registryClient, ProgressEventDispatcher progressDispatcher) throws IOException, RegistryException, LayerCountMismatchException, BadContainerConfiguratio...
@@ -261,6 +248,28 @@ public ImagesAndRegistryClient call() } } + private Optional<ImagesAndRegistryClient> getImagesAndRegistryClient( + EventHandlers eventHandlers, + String mirror, + ProgressEventDispatcher progressDispatcher2, + RegistryClient registryClient) + throws IOException,...
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStep.java
26
Java
0.929
security
730
51
51
false
extract nested try block into method.
3,417
GoogleContainerTools/jib
11,032
Java
chanseokoh
zhumin8
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStep.java PR Title: extract nested try block into method. BEFORE CODE: } return Optional.empty(); } } private Optional<ImagesAndRegistryClient> getImagesAndRegistry...
```suggestion private List<Image> pullPublicImages( EventHandlers eventHandlers, RegistryClient registryClient, ProgressEventDispatcher progressDispatcher) throws IOException, RegistryException, LayerCountMismatchException, BadContainerConfigurationFormatException { try { ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
throws LayerCountMismatchException, BadContainerConfigurationFormatException { EventHandlers eventHandlers = buildContext.getEventHandlers(); Collection<Map.Entry<String, String>> mirrorEntries = buildContext.getRegistryMirrors().entries(); try (ProgressEventDispatcher progressDispatcher1 = ...
```suggestion List<Image> images = pullPublicImages(eventHandlers, registryClient, progressDispatcher2); eventHandlers.dispatch(LogEvent.info("pulled manifest from mirror " + mirror)); return Optional.of(new ImagesAndRegistryClient(images, registryClient)); ```
throws LayerCountMismatchException, BadContainerConfigurationFormatException { EventHandlers eventHandlers = buildContext.getEventHandlers(); Collection<Map.Entry<String, String>> mirrorEntries = buildContext.getRegistryMirrors().entries(); try (ProgressEventDispatcher progressDispatcher1 = ...
@@ -234,21 +234,8 @@ public ImagesAndRegistryClient call() // First, try with no credentials. This works with public GCR images. RegistryClient registryClient = buildContext.newBaseImageRegistryClientFactory(mirror).newRegistryClient(); - try { - List<Image> imag...
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStep.java
26
Java
0.929
suggestion
295
51
51
false
extract nested try block into method.
3,417
GoogleContainerTools/jib
11,032
Java
chanseokoh
zhumin8
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStep.java PR Title: extract nested try block into method. BEFORE CODE: throws LayerCountMismatchException, BadContainerConfigurationFormatException { EventHandlers eventHandle...
```suggestion List<Image> images = pullPublicImages(eventHandlers, registryClient, progressDispatcher2); eventHandlers.dispatch(LogEvent.info("pulled manifest from mirror " + mirror)); return Optional.of(new ImagesAndRegistryClient(images, registryClient)); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
AbsoluteUnixPath absoluteUnixPath2 = AbsoluteUnixPath.get("/absolute/path/"); AbsoluteUnixPath absoluteUnixPath3 = AbsoluteUnixPath.get("/another/path"); Assert.assertEquals(absoluteUnixPath1, absoluteUnixPath2); Assert.assertNotEquals(absoluteUnixPath1, absoluteUnixPath3); } @Test public void te...
How about we replace the use of the try-catch here with the following?: ``` IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> absoluteUnixPath.resolve(path)); assertThat(exception).hasMessageThat().isEqualTo("Cannot resolve against absolute Path: " + path, ex.getMessage()); ```
AbsoluteUnixPath absoluteUnixPath2 = AbsoluteUnixPath.get("/absolute/path/"); AbsoluteUnixPath absoluteUnixPath3 = AbsoluteUnixPath.get("/another/path"); Assert.assertEquals(absoluteUnixPath1, absoluteUnixPath2); Assert.assertNotEquals(absoluteUnixPath1, absoluteUnixPath3); } @Test public void te...
@@ -75,13 +76,14 @@ public void testResolve_relativeUnixPath() { @Test public void testResolve_Path_notRelative() { + AbsoluteUnixPath absoluteUnixPath = AbsoluteUnixPath.get("/"); + Path path = Paths.get("/not/relative"); try { - AbsoluteUnixPath.get("/").resolve(Paths.get("/not/relative")); + ...
jib-build-plan/src/test/java/com/google/cloud/tools/jib/api/buildplan/AbsoluteUnixPathTest.java
26
Java
1
question
320
51
47
false
fix to keep only one method invocation in try/catch testing for exception
3,423
GoogleContainerTools/jib
11,032
Java
mpeddada1
zhumin8
Review this pull request change. Language: Java File: jib-build-plan/src/test/java/com/google/cloud/tools/jib/api/buildplan/AbsoluteUnixPathTest.java PR Title: fix to keep only one method invocation in try/catch testing for exception BEFORE CODE: AbsoluteUnixPath absoluteUnixPath2 = AbsoluteUnixPath.get("/abso...
How about we replace the use of the try-catch here with the following?: ``` IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> absoluteUnixPath.resolve(path)); assertThat(exception).hasMessageThat().isEqualTo("Cannot resolve against absolute Path: " + path, ex.getMessage()); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
private static HttpTransport getInsecureHttpTransport() { try { HttpClientBuilder httpClientBuilder = ApacheHttpTransport.newDefaultHttpClientBuilder() .setSSLSocketFactory(null) // creates new factory with the SSLContext given below .setSSLContext(SslUtils.trustAllSSL...
This is now like a global and ultimate turn-off switch (only there for making some tests work).
private static HttpTransport getInsecureHttpTransport() { try { HttpClientBuilder httpClientBuilder = ApacheHttpTransport.newDefaultHttpClientBuilder() .setSSLSocketFactory(null) // creates new factory with the SSLContext given below .setSSLContext(SslUtils.trustAllSSL...
@@ -128,12 +128,12 @@ private static HttpTransport getInsecureHttpTransport() { private final Consumer<LogEvent> logger; private final Supplier<HttpTransport> secureHttpTransportFactory; private final Supplier<HttpTransport> insecureHttpTransportFactory; - private final boolean retryOnIoException; privat...
jib-core/src/main/java/com/google/cloud/tools/jib/http/FailoverHttpClient.java
26
Java
0.214
suggestion
95
51
51
false
Network retry on IO errors only after insecure failover is finalized
3,424
GoogleContainerTools/jib
11,032
Java
chanseokoh
chanseokoh
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/http/FailoverHttpClient.java PR Title: Network retry on IO errors only after insecure failover is finalized BEFORE CODE: private static HttpTransport getInsecureHttpTransport() { try { HttpClientBuil...
This is now like a global and ultimate turn-off switch (only there for making some tests work).
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} try { logInsecureHttpsFailover(url); Response response = call(httpMethod, url, request, getHttpTransport(false), false); failoverHistory.put(url.getHost() + ":" + url.getPort(), Failover.INSECURE_HTTPS); return response; } catch (SSLException ignored) { // This is u...
Terminal plain-HTTP call. Retrying can be safely enabled.
} try { logInsecureHttpsFailover(url); Response response = call(httpMethod, url, request, getHttpTransport(false), false); failoverHistory.put(url.getHost() + ":" + url.getPort(), Failover.INSECURE_HTTPS); return response; } catch (SSLException ignored) { // This is u...
@@ -293,7 +293,7 @@ public Response call(String httpMethod, URL url, Request request) throws IOExcep // port 443) and we could not connect to 443. It's worth trying port 80. if (enableHttpAndInsecureFailover && isHttpsProtocol(url) && url.getPort() == -1) { logHttpFailover(url); - ...
jib-core/src/main/java/com/google/cloud/tools/jib/http/FailoverHttpClient.java
26
Java
0.214
suggestion
57
51
51
false
Network retry on IO errors only after insecure failover is finalized
3,424
GoogleContainerTools/jib
11,032
Java
chanseokoh
chanseokoh
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/http/FailoverHttpClient.java PR Title: Network retry on IO errors only after insecure failover is finalized BEFORE CODE: } try { logInsecureHttpsFailover(url); Response response = cal...
Terminal plain-HTTP call. Retrying can be safely enabled.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
// It is observed that Open/Oracle JDKs sometimes throw SocketTimeoutException but other times // ConnectException for connection timeout. (Could be a JDK bug.) Note SocketTimeoutException // does not extend ConnectException (or vice versa), and we want to be consistent to error out // on timeou...
If in the history, then the protocol is already fixed for the server. (That is, we've gone through failover before and the result is cached.) These are terminal calls, so enable retrying.
// It is observed that Open/Oracle JDKs sometimes throw SocketTimeoutException but other times // ConnectException for connection timeout. (Could be a JDK bug.) Note SocketTimeoutException // does not extend ConnectException (or vice versa), and we want to be consistent to error out // on timeou...
@@ -307,15 +307,20 @@ public Response call(String httpMethod, URL url, Request request) throws IOExcep Preconditions.checkArgument(isHttpsProtocol(url)); switch (failoverHistory.getOrDefault(url.getHost() + ":" + url.getPort(), Failover.NONE)) { case HTTP: - return Optional.of(call(httpMethod, t...
jib-core/src/main/java/com/google/cloud/tools/jib/http/FailoverHttpClient.java
26
Java
0.357
bug
187
51
51
false
Network retry on IO errors only after insecure failover is finalized
3,424
GoogleContainerTools/jib
11,032
Java
chanseokoh
chanseokoh
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/http/FailoverHttpClient.java PR Title: Network retry on IO errors only after insecure failover is finalized BEFORE CODE: // It is observed that Open/Oracle JDKs sometimes throw SocketTimeoutException but ot...
If in the history, then the protocol is already fixed for the server. (That is, we've gone through failover before and the result is cached.) These are terminal calls, so enable retrying.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@Mock private Consumer<LogEvent> logger; private final Request request = new Request.Builder().build(); @Test public void testGet() throws IOException, InterruptedException, GeneralSecurityException, URISyntaxException { FailoverHttpClient insecureHttpClient = new FailoverHttpClient(true /*...
This one particularly needs turning off retrying. (The test still works without turning off, but it takes a lot of time before retrying finally gives up.)
@Mock private Consumer<LogEvent> logger; private final Request request = new Request.Builder().build(); @Test public void testGet() throws IOException, InterruptedException, GeneralSecurityException, URISyntaxException { FailoverHttpClient insecureHttpClient = new FailoverHttpClient(true /*...
@@ -70,7 +70,7 @@ public void testGet() public void testSecureConnectionOnInsecureHttpsServer() throws IOException, InterruptedException, GeneralSecurityException, URISyntaxException { FailoverHttpClient secureHttpClient = - new FailoverHttpClient(false /*secure*/, false, logger, false); + ...
jib-core/src/test/java/com/google/cloud/tools/jib/http/WithServerFailoverHttpClientTest.java
26
Java
0.357
suggestion
154
51
51
false
Network retry on IO errors only after insecure failover is finalized
3,424
GoogleContainerTools/jib
11,032
Java
chanseokoh
chanseokoh
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/http/WithServerFailoverHttpClientTest.java PR Title: Network retry on IO errors only after insecure failover is finalized BEFORE CODE: @Mock private Consumer<LogEvent> logger; private final Request request ...
This one particularly needs turning off retrying. (The test still works without turning off, but it takes a lot of time before retrying finally gives up.)
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
platformTag); } private Builder() {} } /** * Constructs a builder for a {@link ContainerConfiguration}. * * @return the builder */ public static Builder builder() { return new Builder(); } private final ImmutableSet<Platform> platforms; private final Instant creationTime...
As you mentioned in the issue, this would be better suited in [`BuildContext`](https://github.com/GoogleContainerTools/jib/blob/0392bdae1933f6e245dc47d5e07f57cb65d90399/jib-core/src/main/java/com/google/cloud/tools/jib/configuration/BuildContext.java#L57) than ContainerConfiguration. We also implement the additional ta...
private final Instant creationTime; @Nullable private final ImmutableList<String> entrypoint; @Nullable private final ImmutableList<String> programArguments; @Nullable private final ImmutableMap<String, String> environmentMap; @Nullable private final ImmutableSet<Port> exposedPorts; @Nullable private final ...
@@ -334,6 +350,7 @@ public static Builder builder() { @Nullable private final ImmutableMap<String, String> labels; @Nullable private final String user; @Nullable private final AbsoluteUnixPath workingDirectory; + @Nullable private final boolean platformTag;
jib-core/src/main/java/com/google/cloud/tools/jib/configuration/ContainerConfiguration.java
26
Java
0.643
suggestion
338
51
51
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
mpeddada1
taer
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/configuration/ContainerConfiguration.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: platformTag); } private Builder() {} } ...
As you mentioned in the issue, this would be better suited in [`BuildContext`](https://github.com/GoogleContainerTools/jib/blob/0392bdae1933f6e245dc47d5e07f57cb65d90399/jib-core/src/main/java/com/google/cloud/tools/jib/configuration/BuildContext.java#L57) than ContainerConfiguration. We also implement the additional ta...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
// Gets the image manifest to push. BuildableManifestTemplate manifestTemplate = new ImageToJsonTranslator(builtImage) .getManifestTemplate( buildContext.getTargetFormat(), containerConfigurationDigestAndSize); DescriptorDigest manifestDigest = Digests.comput...
```suggestion private static Set<String> getChildTags(Image builtImage, Set<String> tags, DescriptorDigest manifestDigest, boolean platformTagFeatureEnabled) { ```
if (JibSystemProperties.skipExistingImages() && manifestAlreadyExists) { eventHandlers.dispatch(LogEvent.info("Skipping pushing manifest; already exists.")); return ImmutableList.of(); } return imageQualifiers.stream() .map( qualifier -> new P...
@@ -95,6 +96,15 @@ } } + private static Set<String> getChildTags(Image builtImage, Set<String> tags, DescriptorDigest manifestDigest, boolean newTagFeatureEnabled) {
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PushImageStep.java
26
Java
0.714
suggestion
167
51
51
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
mpeddada1
taer
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PushImageStep.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: // Gets the image manifest to push. BuildableManifestTempl...
```suggestion private static Set<String> getChildTags(Image builtImage, Set<String> tags, DescriptorDigest manifestDigest, boolean platformTagFeatureEnabled) { ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
buildContext.getTargetFormat(), containerConfigurationDigestAndSize); DescriptorDigest manifestDigest = Digests.computeJsonDigest(manifestTemplate); Set<String> imageQualifiers = singlePlatform ? tags : getChildTags(builtImage, tags, manifestDigest, buildContext.getContainerConfiguration...
We can remove this else statement and return `Collections.singleton(manifestDigest.toString())` after the if-statement.
return imageQualifiers.stream() .map( qualifier -> new PushImageStep( buildContext, progressDispatcher.newChildProducer(), registryClient, manifestTemplate, qual...
@@ -95,6 +96,15 @@ } } + private static Set<String> getChildTags(Image builtImage, Set<String> tags, DescriptorDigest manifestDigest, boolean newTagFeatureEnabled) { + if (newTagFeatureEnabled) { + String architecture = builtImage.getArchitecture(); + return tags.stream().map(tag -> tag + "-" + ...
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PushImageStep.java
26
Java
0.571
refactor
120
51
51
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
mpeddada1
taer
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PushImageStep.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: buildContext.getTargetFormat(), containerConfigurati...
We can remove this else statement and return `Collections.singleton(manifestDigest.toString())` after the if-statement.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
return exposedPorts; } @Nullable public ImmutableSet<AbsoluteUnixPath> getVolumes() { return volumes; } @Nullable public String getUser() { return user; } @Nullable public ImmutableMap<String, String> getLabels() { return labels; } @Nullable public AbsoluteUnixPath getWorking...
```suggestion public boolean isPlatformTagEnabled() { return platformTag; } ```
} @Nullable public AbsoluteUnixPath getWorkingDirectory() { return workingDirectory; } @Override @VisibleForTesting public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof ContainerConfiguration)) { return false; } ContainerCon...
@@ -406,6 +422,10 @@ public AbsoluteUnixPath getWorkingDirectory() { return workingDirectory; } + public boolean isPlatformTag() { + return platformTag; + }
jib-core/src/main/java/com/google/cloud/tools/jib/configuration/ContainerConfiguration.java
26
Java
0.571
suggestion
91
51
44
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
mpeddada1
taer
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/configuration/ContainerConfiguration.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: return exposedPorts; } @Nullable public ImmutableS...
```suggestion public boolean isPlatformTagEnabled() { return platformTag; } ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@Test public void testMakeList_multiPlatform_enabled() throws IOException, RegistryException { Image asd = Image.builder(V22ManifestTemplate.class).setArchitecture("wasm").build(); Mockito.when(containerConfig.isPlatformTag()).thenReturn(true); ImmutableList<PushImageStep> pushImageStepList = ...
Let's test these out explicitly. So instead of using a for loop, let's add assertions for `pushImageStepList.get(0)` and `pushImageStepList.get(1)`.
@Test public void testMakeList_multiPlatform_platformTags() throws IOException, RegistryException { Image image = Image.builder(V22ManifestTemplate.class).setArchitecture("wasm").build(); when(buildContext.getEnablePlatformTags()).thenReturn(true); List<PushImageStep> pushImageStepList = Push...
@@ -89,6 +97,68 @@ public void testMakeListForManifestList() throws IOException, RegistryException } } + @Test + public void testMakeList_multiPlatform_enabled() throws IOException, RegistryException { + Image asd = Image.builder(V22ManifestTemplate.class).setArchitecture("wasm").build(); + + Mockito....
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PushImageStepTest.java
26
Java
0.571
suggestion
149
51
51
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
mpeddada1
taer
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PushImageStepTest.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: @Test public void testMakeList_multiPlatform_enabled() throws ...
Let's test these out explicitly. So instead of using a for loop, let's add assertions for `pushImageStepList.get(0)` and `pushImageStepList.get(1)`.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
public void testMakeList_multiPlatform_disabled() throws IOException, RegistryException { Image asd = Image.builder(V22ManifestTemplate.class).setArchitecture("wasm").build(); Mockito.when(containerConfig.isPlatformTag()).thenReturn(false); ImmutableList<PushImageStep> pushImageStepList = PushIma...
We can remove the for loop here and just test for `pushImageStepList.get(0)`.
PushImageStep.makeList( buildContext, progressDispatcherFactory, registryClient, new BlobDescriptor(mockDescriptorDigest), image, false); ArgumentCaptor<String> tagCatcher = ArgumentCaptor.forClass(String.class); when(registryClien...
@@ -89,6 +97,68 @@ public void testMakeListForManifestList() throws IOException, RegistryException } } + @Test + public void testMakeList_multiPlatform_enabled() throws IOException, RegistryException { + Image asd = Image.builder(V22ManifestTemplate.class).setArchitecture("wasm").build(); + + Mockito....
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PushImageStepTest.java
26
Java
0.429
suggestion
77
51
39
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
mpeddada1
taer
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PushImageStepTest.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: public void testMakeList_multiPlatform_disabled() throws IOExcep...
We can remove the for loop here and just test for `pushImageStepList.get(0)`.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Mockito.when(containerConfig.isPlatformTag()).thenReturn(false); ImmutableList<PushImageStep> pushImageStepList = PushImageStep.makeList( buildContext, progressDispatcherFactory, registryClient, new BlobDescriptor(mockDescriptorDigest), asd, ...
```suggestion assertThat(tagCatcher.getAllValues()).containsExactly("sha256:0dd75658cf52608fbd72eb95ff5fc5946966258c3676b35d336bfcc7ac5006f1"); ```
progressDispatcherFactory, registryClient, new BlobDescriptor(mockDescriptorDigest), image, false); ArgumentCaptor<String> tagCatcher = ArgumentCaptor.forClass(String.class); when(registryClient.pushManifest(any(), tagCatcher.capture())).thenReturn(nu...
@@ -89,6 +97,68 @@ public void testMakeListForManifestList() throws IOException, RegistryException } } + @Test + public void testMakeList_multiPlatform_enabled() throws IOException, RegistryException { + Image asd = Image.builder(V22ManifestTemplate.class).setArchitecture("wasm").build(); + + Mockito....
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PushImageStepTest.java
26
Java
0.714
suggestion
151
50
37
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
mpeddada1
taer
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PushImageStepTest.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: Mockito.when(containerConfig.isPlatformTag()).thenReturn(false...
```suggestion assertThat(tagCatcher.getAllValues()).containsExactly("sha256:0dd75658cf52608fbd72eb95ff5fc5946966258c3676b35d336bfcc7ac5006f1"); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Mockito.when(containerConfig.isPlatformTag()).thenReturn(true); ImmutableList<PushImageStep> pushImageStepList = PushImageStep.makeList( buildContext, progressDispatcherFactory, registryClient, new BlobDescriptor(mockDescriptorDigest), asd, ...
```suggestion assertThat(tagCatcher.getAllValues()).containsExactly("tag1-wasm", "tag2-wasm") ``` We also need to add `import static com.google.common.truth.Truth.assertThat;` to the import statements.
Image image = Image.builder(V22ManifestTemplate.class).setArchitecture("wasm").build(); when(buildContext.getEnablePlatformTags()).thenReturn(true); List<PushImageStep> pushImageStepList = PushImageStep.makeList( buildContext, progressDispatcherFactory, registry...
@@ -89,6 +97,68 @@ public void testMakeListForManifestList() throws IOException, RegistryException } } + @Test + public void testMakeList_multiPlatform_enabled() throws IOException, RegistryException { + Image asd = Image.builder(V22ManifestTemplate.class).setArchitecture("wasm").build(); + + Mockito....
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PushImageStepTest.java
26
Java
0.786
suggestion
208
51
51
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
mpeddada1
taer
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PushImageStepTest.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: Mockito.when(containerConfig.isPlatformTag()).thenReturn(true...
```suggestion assertThat(tagCatcher.getAllValues()).containsExactly("tag1-wasm", "tag2-wasm") ``` We also need to add `import static com.google.common.truth.Truth.assertThat;` to the import statements.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@Nullable private ExecutorService executorService; private boolean alwaysCacheBaseImage = false; private ImmutableListMultimap<String, String> registryMirrors = ImmutableListMultimap.of(); private boolean enablePlatformTags = false; private Builder() {} /** * Sets the base image configura...
```suggestion public Builder setEnablePlatformTags(boolean enablePlatformTags) { this.enablePlatformTags = enablePlatformTags; return this; } ```
@Nullable private ExecutorService executorService; private boolean alwaysCacheBaseImage = false; private ImmutableListMultimap<String, String> registryMirrors = ImmutableListMultimap.of(); private boolean enablePlatformTags = false; private Builder() {} /** * Sets the base image configura...
@@ -97,6 +98,15 @@ public Builder setBaseImageConfiguration(ImageConfiguration imageConfiguration) return this; } + /** + * Enables/Disables the platform tags. + * + * @return this + */ + public void setEnablePlatformTags(boolean enablePlatformTags) { + this.enablePlatformTags =...
jib-core/src/main/java/com/google/cloud/tools/jib/configuration/BuildContext.java
26
Java
0.714
suggestion
170
51
51
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
chanseokoh
taer
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/configuration/BuildContext.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: @Nullable private ExecutorService executorService; private bool...
```suggestion public Builder setEnablePlatformTags(boolean enablePlatformTags) { this.enablePlatformTags = enablePlatformTags; return this; } ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
private boolean offline = false; private ImmutableList<FileEntriesLayer> layerConfigurations = ImmutableList.of(); private Class<? extends BuildableManifestTemplate> targetFormat = DEFAULT_TARGET_FORMAT; private String toolName = DEFAULT_TOOL_NAME; @Nullable private String toolVersion; private E...
Sets whether to automatically add architecture suffix to tags for platform-specific images when building multi-platform images. For example, when building amd64 and arm64 images for a given tag, the final tags will be `<tag>-amd64` and `<tag>-arm64`.
private boolean offline = false; private ImmutableList<FileEntriesLayer> layerConfigurations = ImmutableList.of(); private Class<? extends BuildableManifestTemplate> targetFormat = DEFAULT_TARGET_FORMAT; private String toolName = DEFAULT_TOOL_NAME; @Nullable private String toolVersion; private E...
@@ -97,6 +98,15 @@ public Builder setBaseImageConfiguration(ImageConfiguration imageConfiguration) return this; } + /** + * Enables/Disables the platform tags.
jib-core/src/main/java/com/google/cloud/tools/jib/configuration/BuildContext.java
26
Java
0.571
suggestion
250
51
51
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
chanseokoh
taer
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/configuration/BuildContext.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: private boolean offline = false; private ImmutableList<FileEntr...
Sets whether to automatically add architecture suffix to tags for platform-specific images when building multi-platform images. For example, when building amd64 and arm64 images for a given tag, the final tags will be `<tag>-amd64` and `<tag>-arm64`.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
this.targetImageConfiguration = targetImageConfiguration; this.additionalTargetImageTags = additionalTargetImageTags; this.containerConfiguration = containerConfiguration; this.baseImageLayersCache = baseImageLayersCache; this.applicationLayersCache = applicationLayersCache; this.targetFormat = ...
Can we add an assertion for this in BuildContextTest#testBuilder? https://github.com/GoogleContainerTools/jib/blob/0392bdae1933f6e245dc47d5e07f57cb65d90399/jib-core/src/test/java/com/google/cloud/tools/jib/configuration/BuildContextTest.java#L73
boolean alwaysCacheBaseImage, ImmutableListMultimap<String, String> registryMirrors, boolean enablePlatformTags) { this.baseImageConfiguration = baseImageConfiguration; this.targetImageConfiguration = targetImageConfiguration; this.additionalTargetImageTags = additionalTargetImageTags; ...
@@ -423,12 +436,17 @@ private BuildContext( this.shutDownExecutorService = shutDownExecutorService; this.alwaysCacheBaseImage = alwaysCacheBaseImage; this.registryMirrors = registryMirrors; + this.enablePlatformTags = enablePlatformTags; } public ImageConfiguration getBaseImageConfiguration() ...
jib-core/src/main/java/com/google/cloud/tools/jib/configuration/BuildContext.java
26
Java
0.429
question
245
51
51
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
mpeddada1
taer
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/configuration/BuildContext.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: this.targetImageConfiguration = targetImageConfiguration; this....
Can we add an assertion for this in BuildContextTest#testBuilder? https://github.com/GoogleContainerTools/jib/blob/0392bdae1933f6e245dc47d5e07f57cb65d90399/jib-core/src/test/java/com/google/cloud/tools/jib/configuration/BuildContextTest.java#L73
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Set<String> tags = buildContext.getAllTargetImageTags(); int numPushers = singlePlatform ? tags.size() : 1; EventHandlers eventHandlers = buildContext.getEventHandlers(); try (TimerEventDispatcher ignored = new TimerEventDispatcher(eventHandlers, "Preparing manifest pushers"); Progr...
Maybe we can put the entire `singlePlatform ? tags : ...` logic into `getChildTags()`. And not sure I like the word "child." Maybe just `getImageQualifiers()`. And actually I think it's better to move this computation to line 61 so that it looks like ```diff Set<String> tags = buildContext.getAllTargetImageTa...
BuildableManifestTemplate manifestTemplate = new ImageToJsonTranslator(builtImage) .getManifestTemplate( buildContext.getTargetFormat(), containerConfigurationDigestAndSize); DescriptorDigest manifestDigest = Digests.computeJsonDigest(manifestTemplate); Set<String> imageQ...
@@ -79,7 +80,10 @@ DescriptorDigest manifestDigest = Digests.computeJsonDigest(manifestTemplate); Set<String> imageQualifiers = - singlePlatform ? tags : Collections.singleton(manifestDigest.toString()); + singlePlatform + ? tags + : getChildTags(builtImage, t...
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PushImageStep.java
26
Java
0.857
refactor
659
51
51
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
chanseokoh
taer
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PushImageStep.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: Set<String> tags = buildContext.getAllTargetImageTags(); int n...
Maybe we can put the entire `singlePlatform ? tags : ...` logic into `getChildTags()`. And not sure I like the word "child." Maybe just `getImageQualifiers()`. And actually I think it's better to move this computation to line 61 so that it looks like ```diff Set<String> tags = buildContext.getAllTargetImageTa...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
boolean enablePlatformTags) { this.baseImageConfiguration = baseImageConfiguration; this.targetImageConfiguration = targetImageConfiguration; this.additionalTargetImageTags = additionalTargetImageTags; this.containerConfiguration = containerConfiguration; this.baseImageLayersCache = baseImageL...
```suggestion public boolean getEnablePlatformTags() { ```
ExecutorService executorService, boolean shutDownExecutorService, boolean alwaysCacheBaseImage, ImmutableListMultimap<String, String> registryMirrors, boolean enablePlatformTags) { this.baseImageConfiguration = baseImageConfiguration; this.targetImageConfiguration = targetImageConf...
@@ -423,12 +436,17 @@ private BuildContext( this.shutDownExecutorService = shutDownExecutorService; this.alwaysCacheBaseImage = alwaysCacheBaseImage; this.registryMirrors = registryMirrors; + this.enablePlatformTags = enablePlatformTags; } public ImageConfiguration getBaseImageConfiguration() ...
jib-core/src/main/java/com/google/cloud/tools/jib/configuration/BuildContext.java
26
Java
0.571
suggestion
62
51
51
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
chanseokoh
taer
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/configuration/BuildContext.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: boolean enablePlatformTags) { this.baseImageConfiguration = b...
```suggestion public boolean getEnablePlatformTags() { ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
manifest.setSize(100); manifest.setDigest("sha256:1f25787aab4669d252bdae09a72b9c345d2a7b8c64c8dbfba4c82af4834dbccc"); manifestList.addManifest(manifest); } @Test public void testMakeListForManifestList() throws IOException, RegistryException { ImmutableList<PushImageStep> pushImageStepList = ...
```suggestion Image image = Image.builder(V22ManifestTemplate.class).setArchitecture("wasm").build(); ``` or some name that reads better.
ManifestDescriptorTemplate manifest = new ManifestDescriptorTemplate(); manifest.setSize(100); manifest.setDigest("sha256:1f25787aab4669d252bdae09a72b9c345d2a7b8c64c8dbfba4c82af4834dbccc"); manifestList.addManifest(manifest); } @Test public void testMakeListForManifestList() throws IOException, ...
@@ -89,6 +98,54 @@ public void testMakeListForManifestList() throws IOException, RegistryException } } + @Test + public void testMakeList_multiPlatform_enabled() throws IOException, RegistryException { + Image asd = Image.builder(V22ManifestTemplate.class).setArchitecture("wasm").build();
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PushImageStepTest.java
26
Java
0.786
suggestion
144
51
51
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
chanseokoh
taer
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PushImageStepTest.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: manifest.setSize(100); manifest.setDigest("sha256:1f25787a...
```suggestion Image image = Image.builder(V22ManifestTemplate.class).setArchitecture("wasm").build(); ``` or some name that reads better.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
buildResult.getImageDigest().toString()); Assert.assertEquals( "sha256:64303e82b8a80ef20475dc7f807b81f172cacce1a59191927f3a7ea5222f38ae", buildResult.getImageId().toString()); } } @Test public void testMakeList_multiPlatform_enabled() throws IOException, RegistryException ...
`assertThat(pushImageStepList).hasSize(2)` or something like that.
assertThat(buildResult.getImageDigest().toString()) .isEqualTo("sha256:64303e82b8a80ef20475dc7f807b81f172cacce1a59191927f3a7ea5222f38ae"); assertThat(buildResult.getImageId().toString()) .isEqualTo("sha256:64303e82b8a80ef20475dc7f807b81f172cacce1a59191927f3a7ea5222f38ae"); } } @...
@@ -89,6 +98,54 @@ public void testMakeListForManifestList() throws IOException, RegistryException } } + @Test + public void testMakeList_multiPlatform_enabled() throws IOException, RegistryException { + Image asd = Image.builder(V22ManifestTemplate.class).setArchitecture("wasm").build(); + + Mockito....
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PushImageStepTest.java
26
Java
0.357
suggestion
66
51
51
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
chanseokoh
taer
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PushImageStepTest.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: buildResult.getImageDigest().toString()); Assert.a...
`assertThat(pushImageStepList).hasSize(2)` or something like that.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Assert.assertEquals( "sha256:64303e82b8a80ef20475dc7f807b81f172cacce1a59191927f3a7ea5222f38ae", buildResult.getImageDigest().toString()); Assert.assertEquals( "sha256:64303e82b8a80ef20475dc7f807b81f172cacce1a59191927f3a7ea5222f38ae", buildResult.getImageId().toString(...
Let's do static importing for these: ```suggestion when(registryClient.pushManifest(any(), tagCatcher.capture())).thenReturn(null); ```
for (PushImageStep pushImageStep : pushImageStepList) { BuildResult buildResult = pushImageStep.call(); assertThat(buildResult.getImageDigest().toString()) .isEqualTo("sha256:64303e82b8a80ef20475dc7f807b81f172cacce1a59191927f3a7ea5222f38ae"); assertThat(buildResult.getImageId().toString(...
@@ -89,6 +98,54 @@ public void testMakeListForManifestList() throws IOException, RegistryException } } + @Test + public void testMakeList_multiPlatform_enabled() throws IOException, RegistryException { + Image asd = Image.builder(V22ManifestTemplate.class).setArchitecture("wasm").build(); + + Mockito....
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PushImageStepTest.java
26
Java
0.857
suggestion
142
51
51
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
chanseokoh
taer
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PushImageStepTest.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: Assert.assertEquals( "sha256:64303e82b8a80ef20475d...
Let's do static importing for these: ```suggestion when(registryClient.pushManifest(any(), tagCatcher.capture())).thenReturn(null); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Set<String> imageQualifiers = singlePlatform ? tags : getChildTags(builtImage, tags, manifestDigest, buildContext.isEnablePlatformTags()); return imageQualifiers.stream() .map( qualifier -> new PushImageStep( ...
```suggestion boolean enablePlatformTags) { ```
qualifier -> new PushImageStep( buildContext, progressDispatcher.newChildProducer(), registryClient, manifestTemplate, qualifier, manifestDigest, ...
@@ -95,6 +99,18 @@ } } + private static Set<String> getChildTags( + Image builtImage, + Set<String> tags, + DescriptorDigest manifestDigest, + boolean newTagFeatureEnabled) {
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PushImageStep.java
26
Java
0.571
suggestion
55
51
51
false
Build option to add architecture suffix to tags when publishing multi-platform images
3,523
GoogleContainerTools/jib
11,032
Java
chanseokoh
taer
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PushImageStep.java PR Title: Build option to add architecture suffix to tags when publishing multi-platform images BEFORE CODE: Set<String> imageQualifiers = singlePlatform ...
```suggestion boolean enablePlatformTags) { ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} /** Configuration for {@code platform} parameter. */ public static class PlatformParameters implements PlatformConfiguration { @Nullable @Parameter private String os; @Nullable @Parameter private String architecture; @Override public Optional<String> getOsName() { return Optional.ofNull...
We use NullAway. The null check is unnecessary. And I don't like allowing whitespace and using `.trim()`. Let's just say `[^/ ]+/[^/ ]+`. And then, I think we can make this simpler: ```java Matcher matcher = Pattern.compile("([^/ ]+)/([^/ ]+)").matcher(osArchitecture); if (!matcher.matches()) { ...
} } /** Configuration for {@code platform} parameter. */ public static class PlatformParameters implements PlatformConfiguration { private static PlatformParameters of(String osArchitecture) { Matcher matcher = Pattern.compile("([^/ ]+)/([^/ ]+)").matcher(osArchitecture); if (!matcher.matche...
@@ -146,6 +147,16 @@ public PermissionConfiguration() {} public Optional<String> getArchitectureName() { return Optional.ofNullable(architecture); } + + private static PlatformParameters ofString(String osArchitecture) { + if (osArchitecture == null || !osArchitecture.matches("[^/]+/[^/]+")) { ...
jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/JibPluginConfiguration.java
26
Java
1
refactor
807
51
51
false
Expose jib.from.platforms as property.
3,526
GoogleContainerTools/jib
11,032
Java
chanseokoh
ls-urs-keller
Review this pull request change. Language: Java File: jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/JibPluginConfiguration.java PR Title: Expose jib.from.platforms as property. BEFORE CODE: } /** Configuration for {@code platform} parameter. */ public static class PlatformParameters impleme...
We use NullAway. The null check is unnecessary. And I don't like allowing whitespace and using `.trim()`. Let's just say `[^/ ]+/[^/ ]+`. And then, I think we can make this simpler: ```java Matcher matcher = Pattern.compile("([^/ ]+)/([^/ ]+)").matcher(osArchitecture); if (!matcher.matches()) { ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
protected Set<JibMavenPluginExtension<?>> getInjectedPluginExtensions() { return injectedPluginExtensions; } protected MavenSession getSession() { return Preconditions.checkNotNull(session); } protected MavenProject getProject() { return Preconditions.checkNotNull(project); } protected void...
For consistency, let's use `ConfigurationPropertyValidator.parseListProperty(property).map(...)...`.
@Inject private Set<JibMavenPluginExtension<?>> injectedPluginExtensions = Collections.emptySet(); protected Set<JibMavenPluginExtension<?>> getInjectedPluginExtensions() { return injectedPluginExtensions; } protected MavenSession getSession() { return Preconditions.checkNotNull(session); } prote...
@@ -354,6 +362,12 @@ protected void checkJibVersion() throws MojoExecutionException { * @return the specified platforms */ List<PlatformParameters> getPlatforms() { + String property = getProperty(PropertyNames.FROM_PLATFORMS); + if (property != null) { + return Stream.of(property.split(","))
jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/JibPluginConfiguration.java
26
Java
0.571
suggestion
100
51
51
false
Expose jib.from.platforms as property.
3,526
GoogleContainerTools/jib
11,032
Java
chanseokoh
ls-urs-keller
Review this pull request change. Language: Java File: jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/JibPluginConfiguration.java PR Title: Expose jib.from.platforms as property. BEFORE CODE: protected Set<JibMavenPluginExtension<?>> getInjectedPluginExtensions() { return injectedPluginExtensi...
For consistency, let's use `ConfigurationPropertyValidator.parseListProperty(property).map(...)...`.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} catch (InvalidCreationTimeException ex) { throw new GradleException( "container.creationTime should be an ISO 8601 date-time (see " + "DateTimeFormatter.ISO_DATE_TIME) or a special keyword (\"EPOCH\", " + "\"USE_CURRENT_TIMESTAMP\"): " + ex.getInvalidCreat...
How about this? ```suggestion "extraDirectories.paths contain \"from\" directory that doesn't exist locally: " + ex.getPathValue(), ex); ```
} catch (InvalidCreationTimeException ex) { throw new GradleException( "container.creationTime should be an ISO 8601 date-time (see " + "DateTimeFormatter.ISO_DATE_TIME) or a special keyword (\"EPOCH\", " + "\"USE_CURRENT_TIMESTAMP\"): " + ex.getInvalidCreat...
@@ -180,6 +181,9 @@ public void buildDocker() throw new GradleException( HelpfulSuggestions.forInvalidImageReference(ex.getInvalidReference()), ex); + } catch (ExtraDirectoryNotFoundException ex) { + throw new GradleException( + "extraDirectories.paths contain path that is not found...
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildDockerTask.java
26
Java
0.714
question
155
40
42
false
Throw exception if extraDirectories config contains invalid path
3,550
GoogleContainerTools/jib
11,032
Java
chanseokoh
tommysitu
Review this pull request change. Language: Java File: jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildDockerTask.java PR Title: Throw exception if extraDirectories config contains invalid path BEFORE CODE: } catch (InvalidCreationTimeException ex) { throw new GradleException( ...
How about this? ```suggestion "extraDirectories.paths contain \"from\" directory that doesn't exist locally: " + ex.getPathValue(), ex); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
.comparingElementsUsing(EXTRACTION_PATH_OF) .containsExactly( "/target/dir/a", "/target/dir/a/b", "/target/dir/a/b/bar", "/target/dir/c", "/target/dir/c/cat", "/target/dir/foo"); Optional<FileEntry> fooEntry = extraFile...
nit: ```suggestion Exception exception = assertThrows(ExtraDirectoryNotFoundException.class, this::processCommonConfiguration); ```
assertThat(extraFiles) .comparingElementsUsing(EXTRACTION_PATH_OF) .containsExactly( "/target/dir/a", "/target/dir/a/b", "/target/dir/a/b/bar", "/target/dir/c", "/target/dir/c/cat", "/target/dir/foo"); Optional<FileEntry> f...
@@ -259,13 +260,23 @@ public void testPluginConfigurationProcessor_extraDirectory() assertThat(fooEntry.get().getPermissions().toOctalString()).isEqualTo("123"); } + @Test + public void testPluginConfigurationProcessor__errorOnExtraDirectoryPathNotFound() throws URISyntaxException, NumberFormatException { +...
jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessorTest.java
26
Java
0.857
suggestion
138
51
51
false
Throw exception if extraDirectories config contains invalid path
3,550
GoogleContainerTools/jib
11,032
Java
chanseokoh
tommysitu
Review this pull request change. Language: Java File: jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessorTest.java PR Title: Throw exception if extraDirectories config contains invalid path BEFORE CODE: .comparingElementsUsing(EXTRACTION_PATH_OF) ....
nit: ```suggestion Exception exception = assertThrows(ExtraDirectoryNotFoundException.class, this::processCommonConfiguration); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
* the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the sp...
```suggestion public String getPath() { ```
* the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the sp...
@@ -0,0 +1,34 @@ +/* + * Copyright 2018 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/ExtraDirectoryNotFoundException.java
26
Java
0.429
suggestion
47
30
28
false
Throw exception if extraDirectories config contains invalid path
3,550
GoogleContainerTools/jib
11,032
Java
chanseokoh
tommysitu
Review this pull request change. Language: Java File: jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/ExtraDirectoryNotFoundException.java PR Title: Throw exception if extraDirectories config contains invalid path BEFORE CODE: * the License at * * http://www.apache.org/licenses/LI...
```suggestion public String getPath() { ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import javax.annotation.Nullable; /** * Configures and provides {@code JibBuildRunner} for the image building tasks based on raw plugin * configuration values and project properties. */ public class PluginConfigurationProcessor { // Known "generated" dependencies -- these require that the underlying system run a...
Not that this isn't going to work on Windows, but we just prefer this form: ```suggestion private static final Path DEFAULT_JIB_DIR = Paths.get("src").resolve("main").resolve("jib"); ```
import javax.annotation.Nullable; /** * Configures and provides {@code JibBuildRunner} for the image building tasks based on raw plugin * configuration values and project properties. */ public class PluginConfigurationProcessor { // Known "generated" dependencies -- these require that the underlying system run a...
@@ -92,6 +92,7 @@ private static final String JIB_CLASSPATH_FILE = "jib-classpath-file"; private static final String JIB_MAIN_CLASS_FILE = "jib-main-class-file"; + private static final String DEFAULT_JIB_DIR = "src/main/jib";
jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessor.java
26
Java
0.786
suggestion
193
51
51
false
Throw exception if extraDirectories config contains invalid path
3,550
GoogleContainerTools/jib
11,032
Java
chanseokoh
tommysitu
Review this pull request change. Language: Java File: jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessor.java PR Title: Throw exception if extraDirectories config contains invalid path BEFORE CODE: import javax.annotation.Nullable; /** * Configures and provides...
Not that this isn't going to work on Windows, but we just prefer this form: ```suggestion private static final Path DEFAULT_JIB_DIR = Paths.get("src").resolve("main").resolve("jib"); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
.setPlatforms(getPlatformsSet(rawConfiguration)) .setEntrypoint(computeEntrypoint(rawConfiguration, projectProperties, jibContainerBuilder)) .setProgramArguments(rawConfiguration.getProgramArguments().orElse(null)) .setEnvironment(rawConfiguration.getEnvironment()) .setExposedPor...
nit: unnecessary ```suggestion ```
.setAppRoot(getAppRootChecked(rawConfiguration, projectProperties)) .setModificationTimeProvider(modificationTimeProvider); JibContainerBuilder jibContainerBuilder = projectProperties.createJibContainerBuilder( javaContainerBuilder, getContainerizingModeChecke...
@@ -446,6 +447,9 @@ static JibContainerBuilder processCommonConfiguration( extraDirectory.getExcludesList(), rawConfiguration.getExtraDirectoryPermissions(), modificationTimeProvider)); + } else if (!from.endsWith(DEFAULT_JIB_DIR)){ + // Throw exception if ...
jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessor.java
26
Java
0.429
suggestion
36
51
51
false
Throw exception if extraDirectories config contains invalid path
3,550
GoogleContainerTools/jib
11,032
Java
chanseokoh
tommysitu
Review this pull request change. Language: Java File: jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessor.java PR Title: Throw exception if extraDirectories config contains invalid path BEFORE CODE: .setPlatforms(getPlatformsSet(rawConfiguration)) ...
nit: unnecessary ```suggestion ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} /** * Writes a file only when needed (when the file does not exist or the existing file has a * different content). It reads the entire bytes into a {@code String} for content comparison, so * care should be taken when using this method for a huge file. * * @param file target file to write * @p...
```suggestion * {@code "jetty"} for WAR projects, or {@code "eclipse-temurin:{8|11|17}-jre"} for non-WAR. ```
} /** * Writes a file only when needed (when the file does not exist or the existing file has a * different content). It reads the entire bytes into a {@code String} for content comparison, so * care should be taken when using this method for a huge file. * * @param file target file to write * @p...
@@ -739,8 +739,7 @@ static void writeFileConservatively(Path file, String content) throws IOExceptio /** * Gets the suitable value for the base image. If the raw base image parameter is null, returns - * {@code "jetty"} for WAR projects, or {@code "eclipse-temurin:{8|11}-jre"} or {@code - * "azul/zulu-open...
jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessor.java
26
Java
0.714
suggestion
114
51
51
false
Use Eclipse Temurin for Java 17
3,552
GoogleContainerTools/jib
11,032
Java
mpeddada1
chanseokoh
Review this pull request change. Language: Java File: jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessor.java PR Title: Use Eclipse Temurin for Java 17 BEFORE CODE: } /** * Writes a file only when needed (when the file does not exist or the existing file ...
```suggestion * {@code "jetty"} for WAR projects, or {@code "eclipse-temurin:{8|11|17}-jre"} for non-WAR. ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
container -> { container.setJvmFlags(Arrays.asList("jvmFlag1", "jvmFlag2")); container.setEnvironment(ImmutableMap.of("var1", "value1", "var2", "value2")); container.setEntrypoint(Arrays.asList("foo", "bar", "baz")); container.setExtraClasspath(Arrays.asList("/d1", "/d2",...
Let's move this line up to line 202. We want all the setup code to be in one place.
container -> { container.setJvmFlags(Arrays.asList("jvmFlag1", "jvmFlag2")); container.setEnvironment(ImmutableMap.of("var1", "value1", "var2", "value2")); container.setEntrypoint(Arrays.asList("foo", "bar", "baz")); container.setExtraClasspath(Arrays.asList("/d1", "/d2",...
@@ -212,6 +212,8 @@ public void testContainer() { assertThat(container.getArgs()).containsExactly("arg1", "arg2", "arg3").inOrder(); assertThat(container.getPorts()).containsExactly("1000", "2000-2010", "3000").inOrder(); assertThat(container.getFormat()).isSameInstanceAs(ImageFormat.OCI); + container...
jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibExtensionTest.java
26
Java
0.286
refactor
84
51
51
false
fix format config on buildSrc kts srcipt
3,593
GoogleContainerTools/jib
11,032
Java
mpeddada1
BiLuoHen
Review this pull request change. Language: Java File: jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibExtensionTest.java PR Title: fix format config on buildSrc kts srcipt BEFORE CODE: container -> { container.setJvmFlags(Arrays.asList("jvmFlag1", "jvmFlag2")); conta...
Let's move this line up to line 202. We want all the setup code to be in one place.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
#!/bin/bash set -o errexit set -o xtrace gcloud components install docker-credential-gcr # Docker service does not run by default in Big Sur but can be started with the following commands. if [ "${KOKORO_JOB_CLUSTER}" = "MACOS_EXTERNAL" ]; then docker-machine ls docker-machine start default docker-machine ssh defaul...
In the end, this should probably be ```suggestion docker-machine ssh default "echo '{ \"insecure-registries\":[\"$DOCKER_IP:5000\"] }' | sudo tee /etc/docker/daemon.json " ``` and come after the `export DOCKER_IP` below. Also, 5000 is the usual port for a local registry, but I remember we also use 6000. I wonder...
#!/bin/bash set -o errexit set -o xtrace gcloud components install docker-credential-gcr # Docker service does not run by default in Big Sur but can be started with the following commands. if [ "${KOKORO_JOB_CLUSTER}" = "MACOS_EXTERNAL" ]; then source github/jib/kokoro/docker_setup.sh fi # Stops any left-over conta...
@@ -5,21 +5,27 @@ set -o xtrace gcloud components install docker-credential-gcr +# Docker service does not run by default in Big Sur but can be started with the following commands. +if [ "${KOKORO_JOB_CLUSTER}" = "MACOS_EXTERNAL" ]; then +docker-machine ls +docker-machine start default +docker-machine ssh default ...
kokoro/presubmit.sh
12
Shell
0.857
suggestion
385
33
21
false
Set up docker machine with VirtualBox for migration to big-sur
3,598
GoogleContainerTools/jib
11,032
Java
chanseokoh
mpeddada1
Review this pull request change. Language: Shell File: kokoro/presubmit.sh PR Title: Set up docker machine with VirtualBox for migration to big-sur BEFORE CODE: #!/bin/bash set -o errexit set -o xtrace gcloud components install docker-credential-gcr # Docker service does not run by default in Big Sur but can be ...
In the end, this should probably be ```suggestion docker-machine ssh default "echo '{ \"insecure-registries\":[\"$DOCKER_IP:5000\"] }' | sudo tee /etc/docker/daemon.json " ``` and come after the `export DOCKER_IP` below. Also, 5000 is the usual port for a local registry, but I remember we also use 6000. I wonder...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Lists.newArrayList( "docker", "run", "--rm", "-d", "-p", port + ":5000", "--name", containerName); if (username != null && password != null) { // Equivalent of "$ htpasswd -nbB username password". // https://httpd.apache.org/docs/2.4/misc/password_encryptions.html // BCrypt gen...
I guess this change shouldn't be necessary?
Lists.newArrayList( "docker", "run", "--rm", "-d", "-p", port + ":5000", "--name", containerName); if (username != null && password != null) { // Equivalent of "$ htpasswd -nbB username password". // https://httpd.apache.org/docs/2.4/misc/password_encryptions.html // BCrypt gen...
@@ -91,7 +93,7 @@ public void start() throws IOException, InterruptedException { "-e", "REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd")); } - dockerTokens.add("registry:2"); + dockerTokens.add("registry.ipv6.docker.com/library/registry:2");
jib-core/src/integration-test/java/com/google/cloud/tools/jib/registry/LocalRegistry.java
26
Java
0.143
question
43
51
51
false
Set up docker machine with VirtualBox for migration to big-sur
3,598
GoogleContainerTools/jib
11,032
Java
chanseokoh
mpeddada1
Review this pull request change. Language: Java File: jib-core/src/integration-test/java/com/google/cloud/tools/jib/registry/LocalRegistry.java PR Title: Set up docker machine with VirtualBox for migration to big-sur BEFORE CODE: Lists.newArrayList( "docker", "run", "--rm", "-d", "-p", port + ":...
I guess this change shouldn't be necessary?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
public void testErrorLogging_directoryGiven() { StringWriter stringWriter = new StringWriter(); CommandLine jibCli = new CommandLine(new JibCli()).setErr(new PrintWriter(stringWriter)); Path jarFile = Paths.get("/"); Integer exitCode = jibCli.execute("jar", "--target", "docker://jib-cli-image...
Hmm... I have a doubt. Since it's directly pushing to a Docker daemon, I think the name shouldn't matter. Also, `docker run` isn't supposed to make a network connection, since the image should already exist in the daemon cache. But I'm not sure what's going on.
public void testErrorLogging_directoryGiven() { StringWriter stringWriter = new StringWriter(); CommandLine jibCli = new CommandLine(new JibCli()).setErr(new PrintWriter(stringWriter)); Path jarFile = Paths.get("/"); Integer exitCode = jibCli.execute("jar", "--target", "docker://jib-cli-image...
@@ -87,16 +89,29 @@ public void testStandardJar_explodedMode_toDocker() Path jarPath = Paths.get(Resources.getResource("jarTest/standard/jarWithCp.jar").toURI()); Integer exitCode = new CommandLine(new JibCli()) - .execute("jar", "--target", "docker://exploded-jar", jarPath.toString()); - ...
jib-cli/src/integration-test/java/com/google/cloud/tools/jib/cli/JarCommandTest.java
26
Java
0.643
performance
261
51
51
false
Set up docker machine with VirtualBox for migration to big-sur
3,598
GoogleContainerTools/jib
11,032
Java
chanseokoh
mpeddada1
Review this pull request change. Language: Java File: jib-cli/src/integration-test/java/com/google/cloud/tools/jib/cli/JarCommandTest.java PR Title: Set up docker machine with VirtualBox for migration to big-sur BEFORE CODE: public void testErrorLogging_directoryGiven() { StringWriter stringWriter = new Strin...
Hmm... I have a doubt. Since it's directly pushing to a Docker daemon, I think the name shouldn't matter. Also, `docker run` isn't supposed to make a network connection, since the image should already exist in the daemon cache. But I'm not sure what's going on.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
docker-machine ssh default "echo '{ \"insecure-registries\":[\"$DOCKER_IP:5000\", \"$DOCKER_IP:8080\"] }' | sudo tee /etc/docker/daemon.json " docker-machine ssh default "echo 'DOCKER_OPTS=\"--config-file=/etc/docker/daemon.json\"' | sudo tee -a /var/lib/boot2docker/profile " docker-machine ssh default "sudo /etc/init....
We probably don't mean to just run `jib-cli` here? AFAIK presubmit is `jib-core` only, but continuous should be everything.
#!/bin/bash set -o errexit set -o xtrace gcloud components install docker-credential-gcr # Docker service does not run by default in Big Sur but can be started with the following commands. if [ "${KOKORO_JOB_CLUSTER}" = "MACOS_EXTERNAL" ]; then source github/jib/kokoro/docker_setup.sh fi # docker-credential-gcr use...
@@ -16,17 +34,6 @@ docker kill $(docker ps --all --quiet) || true # Sets the integration testing project. export JIB_INTEGRATION_TESTING_PROJECT=jib-integration-testing -# Restarting Docker for Mac to get around the certificate expiration issue: -# b/112707824 -# https://github.com/GoogleContainerTools/jib/issues/7...
kokoro/continuous.sh
26
Shell
0.571
suggestion
124
27
27
false
Set up docker machine with VirtualBox for migration to big-sur
3,598
GoogleContainerTools/jib
11,032
Java
elefeint
mpeddada1
Review this pull request change. Language: Shell File: kokoro/continuous.sh PR Title: Set up docker machine with VirtualBox for migration to big-sur BEFORE CODE: docker-machine ssh default "echo '{ \"insecure-registries\":[\"$DOCKER_IP:5000\", \"$DOCKER_IP:8080\"] }' | sudo tee /etc/docker/daemon.json " docker-mach...
We probably don't mean to just run `jib-cli` here? AFAIK presubmit is `jib-core` only, but continuous should be everything.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
#!/bin/bash set -o errexit set -o xtrace gcloud components install docker-credential-gcr # Docker service does not run by default in Big Sur but can be started with the following commands. if [ "${KOKORO_JOB_CLUSTER}" = "MACOS_EXTERNAL" ]; then docker-machine ls docker-machine start default export DOCKER_IP="$(docke...
Optional: might want to extract all this into a helper shell script. Or let's do it whenever we have to change anything about it, since it shows up twice.
#!/bin/bash set -o errexit set -o xtrace gcloud components install docker-credential-gcr # Docker service does not run by default in Big Sur but can be started with the following commands. if [ "${KOKORO_JOB_CLUSTER}" = "MACOS_EXTERNAL" ]; then source github/jib/kokoro/docker_setup.sh fi # Stops any left-over conta...
@@ -5,21 +5,28 @@ set -o xtrace gcloud components install docker-credential-gcr +# Docker service does not run by default in Big Sur but can be started with the following commands. +if [ "${KOKORO_JOB_CLUSTER}" = "MACOS_EXTERNAL" ]; then +docker-machine ls +docker-machine start default +export DOCKER_IP="$(docker-...
kokoro/presubmit.sh
19
Shell
0.429
refactor
154
34
21
false
Set up docker machine with VirtualBox for migration to big-sur
3,598
GoogleContainerTools/jib
11,032
Java
elefeint
mpeddada1
Review this pull request change. Language: Shell File: kokoro/presubmit.sh PR Title: Set up docker machine with VirtualBox for migration to big-sur BEFORE CODE: #!/bin/bash set -o errexit set -o xtrace gcloud components install docker-credential-gcr # Docker service does not run by default in Big Sur but can be ...
Optional: might want to extract all this into a helper shell script. Or let's do it whenever we have to change anything about it, since it shows up twice.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
buildImage( ImageReference.scratch(), Containerizer.to(RegistryImage.named("localhost:5000/testimagerepo:new_testtag")), Collections.emptyList()); // Test that the pull request throws an exception, indicating that the new tag was not pushed. try { localRegistry...
How about the following? ```suggestion // Test that the first image was pushed while the second one was skipped Assert.assertTrue(image1.isImagePushed()); Assert.assertFalse(image2.isImagePushed()); ```
buildImage( ImageReference.scratch(), Containerizer.to(RegistryImage.named("localhost:5000/testimagerepo:new_testtag")), Collections.emptyList()); // Test that the pull request throws an exception, indicating that the new tag was not pushed. try { localRegistry...
@@ -270,6 +270,11 @@ public void testSteps_forBuildToDockerRegistry_skipExistingDigest() // Test that both images have the same properties. Assert.assertEquals(image1.getDigest(), image2.getDigest()); Assert.assertEquals(image1.getImageId(), image2.getImageId()); + + // Test that the first image was p...
jib-core/src/integration-test/java/com/google/cloud/tools/jib/api/ContainerizerIntegrationTest.java
26
Java
0.786
question
221
51
51
false
Add imagePushed field to jib-image.json
3,641
GoogleContainerTools/jib
11,032
Java
mpeddada1
wwadge
Review this pull request change. Language: Java File: jib-core/src/integration-test/java/com/google/cloud/tools/jib/api/ContainerizerIntegrationTest.java PR Title: Add imagePushed field to jib-image.json BEFORE CODE: buildImage( ImageReference.scratch(), Containerizer.to(RegistryImag...
How about the following? ```suggestion // Test that the first image was pushed while the second one was skipped Assert.assertTrue(image1.isImagePushed()); Assert.assertFalse(image2.isImagePushed()); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
this.imagePushed = imagePushed; } static JibContainer from(BuildContext buildContext, BuildResult buildResult) { ImageReference targetImage = buildContext.getTargetImageConfiguration().getImage(); DescriptorDigest imageDigest = buildResult.getImageDigest(); DescriptorDigest imageId = buildResult.ge...
Let's use a primitive type here.
this.imagePushed = imagePushed; } static JibContainer from(BuildContext buildContext, BuildResult buildResult) { ImageReference targetImage = buildContext.getTargetImageConfiguration().getImage(); DescriptorDigest imageDigest = buildResult.getImageDigest(); DescriptorDigest imageId = buildResult.ge...
@@ -59,6 +62,15 @@ public ImageReference getTargetImage() { return targetImage; } + /** + * Returns true if we pushed this image all the way to a registry. + * + * @return true if pushed. + */ + public Boolean isImagePushed() {
jib-core/src/main/java/com/google/cloud/tools/jib/api/JibContainer.java
26
Java
0.286
suggestion
33
51
51
false
Add imagePushed field to jib-image.json
3,641
GoogleContainerTools/jib
11,032
Java
mpeddada1
wwadge
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/api/JibContainer.java PR Title: Add imagePushed field to jib-image.json BEFORE CODE: this.imagePushed = imagePushed; } static JibContainer from(BuildContext buildContext, BuildResult buildResult) { I...
Let's use a primitive type here.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
ProgressEventDispatcher.Factory progressDispatcherFactory) { return executorService.submit( () -> { realizeFutures( Verify.verifyNotNull(results.baseImagesAndLayerPushResults.get().get(baseImage))); Future<BlobDescriptor> containerConfigPushResult = res...
Could we try putting ` !(JibSystemProperties.skipExistingImages() && results.manifestCheckResult.get().isPresent())` in a variable?
ProgressEventDispatcher.Factory progressDispatcherFactory) { return executorService.submit( () -> { realizeFutures( Verify.verifyNotNull(results.baseImagesAndLayerPushResults.get().get(baseImage))); Future<BlobDescriptor> containerConfigPushResult = res...
@@ -576,7 +576,9 @@ private Future<BuildResult> pushImage( return manifestPushResults.isEmpty() ? new BuildResult( results.manifestCheckResult.get().get().getDigest(), - Verify.verifyNotNull(containerConfigPushResult).get().getDigest()) + Ve...
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/StepsRunner.java
26
Java
0.571
question
131
51
51
false
Add imagePushed field to jib-image.json
3,641
GoogleContainerTools/jib
11,032
Java
mpeddada1
wwadge
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/StepsRunner.java PR Title: Add imagePushed field to jib-image.json BEFORE CODE: ProgressEventDispatcher.Factory progressDispatcherFactory) { return executorService.submit( () -> { ...
Could we try putting ` !(JibSystemProperties.skipExistingImages() && results.manifestCheckResult.get().isPresent())` in a variable?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
private Set<String> tags1; private Set<String> tags2; @Before public void setUp() throws DigestException, InvalidImageReferenceException { targetImage1 = ImageReference.parse("gcr.io/project/image:tag"); targetImage2 = ImageReference.parse("gcr.io/project/image:tag2"); digest1 = DescriptorD...
```suggestion Assert.assertTrue(container.isImagePushed()); ```
@Rule public TemporaryFolder temporaryDirectory = new TemporaryFolder(); private ImageReference targetImage1; private ImageReference targetImage2; private DescriptorDigest digest1; private DescriptorDigest digest2; private Set<String> tags1; private Set<String> tags2; @Before public void setUp() thr...
@@ -53,54 +53,55 @@ public void setUp() throws DigestException, InvalidImageReferenceException { @Test public void testCreation() { - JibContainer container = new JibContainer(targetImage1, digest1, digest2, tags1); + JibContainer container = new JibContainer(targetImage1, digest1, digest2, tags1, true); ...
jib-core/src/test/java/com/google/cloud/tools/jib/api/JibContainerTest.java
26
Java
0.571
suggestion
69
51
51
false
Add imagePushed field to jib-image.json
3,641
GoogleContainerTools/jib
11,032
Java
mpeddada1
wwadge
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/api/JibContainerTest.java PR Title: Add imagePushed field to jib-image.json BEFORE CODE: private Set<String> tags1; private Set<String> tags2; @Before public void setUp() throws DigestException, InvalidI...
```suggestion Assert.assertTrue(container.isImagePushed()); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
* * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language go...
how about we use `boolean` instead of `Boolean` here?
* * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language go...
@@ -29,25 +29,28 @@ public class JibContainer { private final DescriptorDigest imageDigest; private final DescriptorDigest imageId; private final Set<String> tags; + private final Boolean imagePushed;
jib-core/src/main/java/com/google/cloud/tools/jib/api/JibContainer.java
26
Java
0.429
question
53
51
51
false
Add imagePushed field to jib-image.json
3,641
GoogleContainerTools/jib
11,032
Java
mpeddada1
wwadge
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/api/JibContainer.java PR Title: Add imagePushed field to jib-image.json BEFORE CODE: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software...
how about we use `boolean` instead of `Boolean` here?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@Test public void testBuildImage_writesImageJson() throws Exception { final ImageReference targetImageReference = ImageReference.parse("gcr.io/distroless/java:11"); final String imageId = "sha256:61bb3ec31a47cb730eb58a38bbfa813761a51dca69d10e39c24c3d00a7b2c7a9"; final String digest = "sha256:3f1...
Looks like we're missing a mockito setup above. How about we add this in line 246: `Mockito.when(mockJibContainer.isImagePushed()).thenReturn(true);`
@Test public void testBuildImage_writesImageJson() throws Exception { final ImageReference targetImageReference = ImageReference.parse("gcr.io/distroless/java:11"); final String imageId = "sha256:61bb3ec31a47cb730eb58a38bbfa813761a51dca69d10e39c24c3d00a7b2c7a9"; final String digest = "sha256:3f1...
@@ -250,5 +250,6 @@ public void testBuildImage_writesImageJson() throws Exception { Assert.assertEquals(imageId, metadataOutput.getImageId()); Assert.assertEquals(digest, metadataOutput.getImageDigest()); Assert.assertEquals(tags, ImmutableSet.copyOf(metadataOutput.getTags())); + Assert.assertTrue(met...
jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/JibBuildRunnerTest.java
26
Java
0.5
suggestion
149
28
29
false
Add imagePushed field to jib-image.json
3,641
GoogleContainerTools/jib
11,032
Java
mpeddada1
wwadge
Review this pull request change. Language: Java File: jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/JibBuildRunnerTest.java PR Title: Add imagePushed field to jib-image.json BEFORE CODE: @Test public void testBuildImage_writesImageJson() throws Exception { final ImageReference t...
Looks like we're missing a mockito setup above. How about we add this in line 246: `Mockito.when(mockJibContainer.isImagePushed()).thenReturn(true);`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import org.junit.ClassRule; import org.junit.Test; /** Integration tests for building WAR images. */ public class WarProjectIntegrationTest { @ClassRule public static final TestProject servlet25Project = new TestProject("war_servlet25"); @Nullable private String containerName; @After public void tearDown() ...
Is this an intentional change?
import org.junit.ClassRule; import org.junit.Test; /** Integration tests for building WAR images. */ public class WarProjectIntegrationTest { @ClassRule public static final TestProject servlet25Project = new TestProject("war_servlet25"); @Nullable private String containerName; @After public void tearDown() ...
@@ -49,6 +49,7 @@ public void testBuild_jettyServlet25() throws IOException, InterruptedException, @Test public void testBuild_tomcatServlet25() throws IOException, InterruptedException, DigestException { + // jkljlk
jib-gradle-plugin/src/integration-test/java/com/google/cloud/tools/jib/gradle/WarProjectIntegrationTest.java
26
Java
0.143
question
30
42
41
false
remaining javax.servlet instances
3,664
GoogleContainerTools/jib
11,032
Java
mpeddada1
elefeint
Review this pull request change. Language: Java File: jib-gradle-plugin/src/integration-test/java/com/google/cloud/tools/jib/gradle/WarProjectIntegrationTest.java PR Title: remaining javax.servlet instances BEFORE CODE: import org.junit.ClassRule; import org.junit.Test; /** Integration tests for building WAR image...
Is this an intentional change?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
* href="https://docs.docker.com/engine/reference/commandline/save/">https://docs.docker.com/engine/reference/commandline/save</a> * @param imageReference the image to save * @param outputPath the destination path to save the output tarball * @param writtenByteCountListener callback to call when bytes ar...
Do you think that different implementations will return image details in the same JSON format? This class was not part of the public API previously, and with the tie-in to Jackson parsing implementation, it may be better to keep it as an implementation detail. Would it make sense to have a common abstraction here for ...
/* * Copyright 2022 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
@@ -0,0 +1,124 @@ +/* + * Copyright 2022 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by...
jib-core/src/main/java/com/google/cloud/tools/jib/api/DockerClient.java
26
Java
0.643
refactor
488
51
73
false
Create `DockerClient` interface
3,703
GoogleContainerTools/jib
11,032
Java
elefeint
eddumelendez
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/api/DockerClient.java PR Title: Create `DockerClient` interface BEFORE CODE: * href="https://docs.docker.com/engine/reference/commandline/save/">https://docs.docker.com/engine/reference/commandline/save</a...
Do you think that different implementations will return image details in the same JSON format? This class was not part of the public API previously, and with the tie-in to Jackson parsing implementation, it may be better to keep it as an implementation detail. Would it make sense to have a common abstraction here for ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
.setCredentialRetrievers(registryImage.getCredentialRetrievers()) .build(); Function<BuildContext, StepsRunner> stepsRunnerFactory = buildContext -> StepsRunner.begin(buildContext).registryPushSteps(); return new Containerizer( DESCRIPTION_FOR_DOCKER_REGISTRY, imageConf...
@eddumelendez could you please make it possible to pass an instance of `DockerClient` explicitly? (e.g. similar to `setExecutorService`, or maybe as an `to(DockerClient, DockerDaemonImage)` overload)
.setCredentialRetrievers(registryImage.getCredentialRetrievers()) .build(); Function<BuildContext, StepsRunner> stepsRunnerFactory = buildContext -> StepsRunner.begin(buildContext).registryPushSteps(); return new Containerizer( DESCRIPTION_FOR_DOCKER_REGISTRY, imageConf...
@@ -94,8 +95,11 @@ public static Containerizer to(DockerDaemonImage dockerDaemonImage) { ImageConfiguration.builder(dockerDaemonImage.getImageReference()).build(); DockerClient dockerClient = - new DockerClient( - dockerDaemonImage.getDockerExecutable(), dockerDaemonImage.getDockerEnvi...
jib-core/src/main/java/com/google/cloud/tools/jib/api/Containerizer.java
26
Java
0.571
suggestion
199
51
51
false
Create `DockerClient` interface
3,703
GoogleContainerTools/jib
11,032
Java
bsideup
eddumelendez
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/api/Containerizer.java PR Title: Create `DockerClient` interface BEFORE CODE: .setCredentialRetrievers(registryImage.getCredentialRetrievers()) .build(); Function<BuildContext, StepsR...
@eddumelendez could you please make it possible to pass an instance of `DockerClient` explicitly? (e.g. similar to `setExecutorService`, or maybe as an `to(DockerClient, DockerDaemonImage)` overload)
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
private final ContainerConfiguration.Builder containerConfigurationBuilder = ContainerConfiguration.builder(); private final BuildContext.Builder buildContextBuilder; private ImageConfiguration baseImageConfiguration; // TODO(chanseok): remove and use containerBuildPlanBuilder instead. private List<Fil...
This could use an option to pass the client explicitly
private final ContainerConfiguration.Builder containerConfigurationBuilder = ContainerConfiguration.builder(); private final BuildContext.Builder buildContextBuilder; private ImageConfiguration baseImageConfiguration; // TODO(chanseok): remove and use containerBuildPlanBuilder instead. private List<Fil...
@@ -100,7 +101,10 @@ private static String capitalizeFirstLetter(String string) { this( ImageConfiguration.builder(baseImage.getImageReference()) .setDockerClient( - new DockerClient(baseImage.getDockerExecutable(), baseImage.getDockerEnvironment())) + DockerClie...
jib-core/src/main/java/com/google/cloud/tools/jib/api/JibContainerBuilder.java
26
Java
0.286
suggestion
54
51
51
false
Create `DockerClient` interface
3,703
GoogleContainerTools/jib
11,032
Java
bsideup
eddumelendez
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/api/JibContainerBuilder.java PR Title: Create `DockerClient` interface BEFORE CODE: private final ContainerConfiguration.Builder containerConfigurationBuilder = ContainerConfiguration.builder(); private...
This could use an option to pass the client explicitly
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
* * @param registryImage the {@link RegistryImage} that defines target container registry and * credentials * @return a new {@link Containerizer} */ public static Containerizer to(RegistryImage registryImage) { ImageConfiguration imageConfiguration = ImageConfiguration.builder(registryI...
I think `to(DockerDaemonImage)` should delegate to `to(DockerClient, DockerDaemonImage)` - WDYT @eddumelendez?
* * @param registryImage the {@link RegistryImage} that defines target container registry and * credentials * @return a new {@link Containerizer} */ public static Containerizer to(RegistryImage registryImage) { ImageConfiguration imageConfiguration = ImageConfiguration.builder(registryI...
@@ -94,8 +95,11 @@ public static Containerizer to(DockerDaemonImage dockerDaemonImage) { ImageConfiguration.builder(dockerDaemonImage.getImageReference()).build(); DockerClient dockerClient =
jib-core/src/main/java/com/google/cloud/tools/jib/api/Containerizer.java
26
Java
0.571
question
110
51
51
false
Create `DockerClient` interface
3,703
GoogleContainerTools/jib
11,032
Java
bsideup
eddumelendez
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/api/Containerizer.java PR Title: Create `DockerClient` interface BEFORE CODE: * * @param registryImage the {@link RegistryImage} that defines target container registry and * credentials * @return ...
I think `to(DockerDaemonImage)` should delegate to `to(DockerClient, DockerDaemonImage)` - WDYT @eddumelendez?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@Mock private ContainerConfiguration containerConfig; @Before public void setUp() { Mockito.when(buildContext.getBaseImageConfiguration()) .thenReturn(ImageConfiguration.builder(ImageReference.scratch()).build()); Mockito.when(buildContext.getContainerConfiguration()).thenReturn(containerConfig);...
How about we do the following here and in the tests below: ``` Exception exception = assertThrows(PlatformNotFoundInBaseImageException.class, () -> PlatformChecker.checkManifestPlatform(buildContext, containerConfigJson)) assertThat(exception).hasMessageThat().isEqualTo( "the configured platform (configured arch/c...
@Mock private BuildContext buildContext; @Mock private ContainerConfiguration containerConfig; @Before public void setUp() { Mockito.when(buildContext.getBaseImageConfiguration()) .thenReturn(ImageConfiguration.builder(ImageReference.scratch()).build()); Mockito.when(buildContext.getContainerC...
@@ -58,39 +56,42 @@ public void testCheckManifestPlatform_mismatch() { ContainerConfigurationTemplate containerConfigJson = new ContainerConfigurationTemplate(); containerConfigJson.setArchitecture("actual arch"); containerConfigJson.setOs("actual OS"); - - PlatformChecker.checkManifestPlatform(buildC...
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PlatformCheckerTest.java
26
Java
1
suggestion
580
51
51
false
fix: error when base image doesn't support target platforms
3,707
GoogleContainerTools/jib
11,032
Java
mpeddada1
gsquared94
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PlatformCheckerTest.java PR Title: fix: error when base image doesn't support target platforms BEFORE CODE: @Mock private ContainerConfiguration containerConfig; @Before public void setUp() {...
How about we do the following here and in the tests below: ``` Exception exception = assertThrows(PlatformNotFoundInBaseImageException.class, () -> PlatformChecker.checkManifestPlatform(buildContext, containerConfigJson)) assertThat(exception).hasMessageThat().isEqualTo( "the configured platform (configured arch/c...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@Mock private BuildContext buildContext; @Mock private ContainerConfiguration containerConfig; @Before public void setUp() { Mockito.when(buildContext.getBaseImageConfiguration()) .thenReturn(ImageConfiguration.builder(ImageReference.scratch()).build()); Mockito.when(buildContext.getContainerCo...
Perhaps we can use Truth here to assert on the message? Same below. `import static com.google.common.truth.Truth.assertThat` and `assertThat().hasMessageThat().isEqualTo()`
@Mock private BuildContext buildContext; @Mock private ContainerConfiguration containerConfig; @Before public void setUp() { Mockito.when(buildContext.getBaseImageConfiguration()) .thenReturn(ImageConfiguration.builder(ImageReference.scratch()).build()); Mockito.when(buildContext.getContainerCo...
@@ -58,39 +58,41 @@ public void testCheckManifestPlatform_mismatch() { ContainerConfigurationTemplate containerConfigJson = new ContainerConfigurationTemplate(); containerConfigJson.setArchitecture("actual arch"); containerConfigJson.setOs("actual OS"); - - PlatformChecker.checkManifestPlatform(buildC...
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PlatformCheckerTest.java
26
Java
0.571
suggestion
176
51
51
false
fix: error when base image doesn't support target platforms
3,707
GoogleContainerTools/jib
11,032
Java
mpeddada1
gsquared94
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PlatformCheckerTest.java PR Title: fix: error when base image doesn't support target platforms BEFORE CODE: @Mock private BuildContext buildContext; @Mock private ContainerConfiguration containe...
Perhaps we can use Truth here to assert on the message? Same below. `import static com.google.common.truth.Truth.assertThat` and `assertThat().hasMessageThat().isEqualTo()`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
.thenReturn(ImageConfiguration.builder(ImageReference.scratch()).build()); Mockito.when(buildContext.getContainerConfiguration()).thenReturn(containerConfig); } @Test public void testCheckManifestPlatform_mismatch() { Mockito.when(containerConfig.getPlatforms()) .thenReturn(ImmutableSet.o...
Oops sorry I missed this earlier. This test no longer performs an assertion so just invoking the method in the test may not give us many insights into what is expected from the method's behavior. How about we replace this test with the following?: `testCheckManifestPlatform_arm64Linux` where the architecture doesn't ma...
.thenReturn(ImageConfiguration.builder(ImageReference.scratch()).build()); Mockito.when(buildContext.getContainerConfiguration()).thenReturn(containerConfig); } @Test public void testCheckManifestPlatform_mismatch() { Mockito.when(containerConfig.getPlatforms()) .thenReturn(ImmutableSet.o...
@@ -58,39 +58,43 @@ public void testCheckManifestPlatform_mismatch() { ContainerConfigurationTemplate containerConfigJson = new ContainerConfigurationTemplate(); containerConfigJson.setArchitecture("actual arch"); containerConfigJson.setOs("actual OS"); - - PlatformChecker.checkManifestPlatform(buildC...
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PlatformCheckerTest.java
26
Java
0.643
suggestion
487
51
51
false
fix: error when base image doesn't support target platforms
3,707
GoogleContainerTools/jib
11,032
Java
mpeddada1
gsquared94
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PlatformCheckerTest.java PR Title: fix: error when base image doesn't support target platforms BEFORE CODE: .thenReturn(ImageConfiguration.builder(ImageReference.scratch()).build()); Moc...
Oops sorry I missed this earlier. This test no longer performs an assertion so just invoking the method in the test may not give us many insights into what is expected from the method's behavior. How about we replace this test with the following?: `testCheckManifestPlatform_arm64Linux` where the architecture doesn't ma...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Mockito.when(buildContext.getBaseImageConfiguration()) .thenReturn(ImageConfiguration.builder(ImageReference.scratch()).build()); Mockito.when(buildContext.getContainerConfiguration()).thenReturn(containerConfig); } @Test public void testCheckManifestPlatform_mismatch() { Mockito.when(contain...
```suggestion public void testCheckManifestPlatform_noExceptionIfDefaultAmd64Linux() ```
Mockito.when(buildContext.getBaseImageConfiguration()) .thenReturn(ImageConfiguration.builder(ImageReference.scratch()).build()); Mockito.when(buildContext.getContainerConfiguration()).thenReturn(containerConfig); } @Test public void testCheckManifestPlatform_mismatch() { Mockito.when(contain...
@@ -58,39 +58,43 @@ public void testCheckManifestPlatform_mismatch() { ContainerConfigurationTemplate containerConfigJson = new ContainerConfigurationTemplate(); containerConfigJson.setArchitecture("actual arch"); containerConfigJson.setOs("actual OS"); - - PlatformChecker.checkManifestPlatform(buildC...
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PlatformCheckerTest.java
26
Java
0.714
suggestion
92
51
51
false
fix: error when base image doesn't support target platforms
3,707
GoogleContainerTools/jib
11,032
Java
mpeddada1
gsquared94
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PlatformCheckerTest.java PR Title: fix: error when base image doesn't support target platforms BEFORE CODE: Mockito.when(buildContext.getBaseImageConfiguration()) .thenReturn(ImageConfig...
```suggestion public void testCheckManifestPlatform_noExceptionIfDefaultAmd64Linux() ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
public void setUser(String user) { this.user = user; } @Input @Nullable @Optional public String getWorkingDirectory() { if (System.getProperty(PropertyNames.CONTAINER_WORKING_DIRECTORY) != null) { return System.getProperty(PropertyNames.CONTAINER_WORKING_DIRECTORY); } return workingD...
`getOrElse` with the default value of `EPOCH_PLUS_SECOND`, perhaps? Realistically, it should not be null, unless the user sets `null` explicitly, but easier to be safe.
public void setUser(String user) { this.user = user; } @Input @Nullable @Optional public String getWorkingDirectory() { if (System.getProperty(PropertyNames.CONTAINER_WORKING_DIRECTORY) != null) { return System.getProperty(PropertyNames.CONTAINER_WORKING_DIRECTORY); } return workingDi...
@@ -266,11 +270,15 @@ public String getFilesModificationTime() { if (System.getProperty(PropertyNames.CONTAINER_FILES_MODIFICATION_TIME) != null) { return System.getProperty(PropertyNames.CONTAINER_FILES_MODIFICATION_TIME); } - return filesModificationTime; + return filesModificationTime.getOrNul...
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ContainerParameters.java
26
Java
0.714
suggestion
168
51
39
false
Use Gradle Property and Provider for creationTime and filesModificationTime
3,709
GoogleContainerTools/jib
11,032
Java
elefeint
creckord
Review this pull request change. Language: Java File: jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ContainerParameters.java PR Title: Use Gradle Property and Provider for creationTime and filesModificationTime BEFORE CODE: public void setUser(String user) { this.user = user; } @Inpu...
`getOrElse` with the default value of `EPOCH_PLUS_SECOND`, perhaps? Realistically, it should not be null, unless the user sets `null` explicitly, but easier to be safe.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} @Input @Optional public String getFilesModificationTime() { if (System.getProperty(PropertyNames.CONTAINER_FILES_MODIFICATION_TIME) != null) { return System.getProperty(PropertyNames.CONTAINER_FILES_MODIFICATION_TIME); } return filesModificationTime.getOrNull(); } public void setFilesM...
`getOrElse` with the default value of `EPOCH`, perhaps?
/* * Copyright 2018 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
@@ -279,10 +287,14 @@ public String getCreationTime() { if (System.getProperty(PropertyNames.CONTAINER_CREATION_TIME) != null) { return System.getProperty(PropertyNames.CONTAINER_CREATION_TIME); } - return creationTime; + return creationTime.getOrNull();
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ContainerParameters.java
26
Java
0.357
question
55
37
286
false
Use Gradle Property and Provider for creationTime and filesModificationTime
3,709
GoogleContainerTools/jib
11,032
Java
elefeint
creckord
Review this pull request change. Language: Java File: jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ContainerParameters.java PR Title: Use Gradle Property and Provider for creationTime and filesModificationTime BEFORE CODE: } @Input @Optional public String getFilesModificationTime() { ...
`getOrElse` with the default value of `EPOCH`, perhaps?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@Test public void testWriteZstdCompressed() throws IOException { Blob uncompressedLayerBlob = Blobs.from("uncompressedLayerBlob"); Blob compressedLayerBlob = compress(uncompressedLayerBlob, CompressorStreamFactory.ZSTANDARD); CachedLayer cachedLayer = cacheStorageWriter.writeCompressed(compressedLayerB...
The test is about uncompressed layers, but I noticed the verifyCachedLayer actually uses compression for asserts. What is even more strange is that this test seems dependant on the gzip compression settings: it passes with JDK GZIPOutputStream, but not with common-compress GzipCompressorOutputStream.
@Test public void testWriteZstdCompressed() throws IOException { Blob uncompressedLayerBlob = Blobs.from("uncompressedLayerBlob"); Blob compressedLayerBlob = compress(uncompressedLayerBlob, CompressorStreamFactory.ZSTANDARD); CachedLayer cachedLayer = cacheStorageWriter.writeCompressed(compressedLayerB...
@@ -117,7 +150,7 @@ public void testWriteUncompressed() throws IOException { CachedLayer cachedLayer = cacheStorageWriter.writeUncompressed(uncompressedLayerBlob, selector); - verifyCachedLayer(cachedLayer, uncompressedLayerBlob); + verifyCachedLayer(cachedLayer, uncompressedLayerBlob, compress(uncompres...
jib-core/src/test/java/com/google/cloud/tools/jib/cache/CacheStorageWriterTest.java
26
Java
0.5
performance
302
51
51
false
Support base image layer compressed with zstd
3,717
GoogleContainerTools/jib
11,032
Java
rquinio
rquinio
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/cache/CacheStorageWriterTest.java PR Title: Support base image layer compressed with zstd BEFORE CODE: @Test public void testWriteZstdCompressed() throws IOException { Blob uncompressedLayerBlob = Blobs.f...
The test is about uncompressed layers, but I noticed the verifyCachedLayer actually uses compression for asserts. What is even more strange is that this test seems dependant on the gzip compression settings: it passes with JDK GZIPOutputStream, but not with common-compress GzipCompressorOutputStream.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
// Convert Provider<Object> to Provider<List<ExtraDirectoryParameters>> this.paths.set( paths.map( obj -> project.files(paths).getFiles().stream() .map(file -> new ExtraDirectoryParameters(objects, project, file.toPath(), "/")) .collect...
Does this check even matter? There is no harm in setting permissions to an equivalent object.
/** * Helper method to convert {@code Object} to {@code List<ExtraDirectoryParameters>} in {@code * setFrom}. */ @Nonnull private List<ExtraDirectoryParameters> convertToExtraDirectoryParametersList(Object obj) { return project.files(obj).getFiles().stream() .map(file -> new ExtraDirectoryPa...
@@ -106,15 +125,15 @@ public void setPaths(Object paths) { * @return the permissions map from path on container to file permissions */ @Input - public Map<String, String> getPermissions() { + public MapProperty<String, String> getPermissions() { String property = System.getProperty(PropertyNames.EXTRA...
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoriesParameters.java
26
Java
0.214
security
93
30
33
false
Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters
3,737
GoogleContainerTools/jib
11,032
Java
elefeint
emmileaf
Review this pull request change. Language: Java File: jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoriesParameters.java PR Title: Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters BEFORE CODE: // Convert Provider<Object> to Provider<Li...
Does this check even matter? There is no harm in setting permissions to an equivalent object.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"/")); } return paths.get(); } /** * Sets paths. {@code paths} can be any suitable object describing file paths convertible by * {@link Project#files} (such as {@link File}, {@code List<File>}, or {@code List<String>}). * * @param paths paths to set. */ public void setPaths(O...
Let's make this comment part of the method's javadoc.
project.getProjectDir().toPath().resolve("src").resolve("main").resolve("jib"), "/")); } return paths.get(); } /** * Sets paths. {@code paths} can be any suitable object describing file paths convertible by * {@link Project#files} (such as {@link File}, {@code List<File>},...
@@ -98,6 +101,22 @@ public void setPaths(Object paths) { .collect(Collectors.toList())); } + /** + * Sets paths, for lazy evaluation where {@code paths} is a {@link Provider} of a suitable object. + * + * @param paths provider of paths to set + * @see #setPaths(Object) + */ + public void s...
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoriesParameters.java
26
Java
0.214
suggestion
54
51
51
false
Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters
3,737
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoriesParameters.java PR Title: Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters BEFORE CODE: "/")); } return paths.ge...
Let's make this comment part of the method's javadoc.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
/** * Sets paths. {@code paths} can be any suitable object describing file paths convertible by * {@link Project#files} (such as {@link File}, {@code List<File>}, or {@code List<String>}). * * @param paths paths to set. */ public void setPaths(Object paths) { this.paths.set( project.files...
nit: would it be possible to have this be part of a helper method? In terms of readability, it could help the reader of the code avoid parsing through an additional level of logic in this method.
/** * Sets paths. {@code paths} can be any suitable object describing file paths convertible by * {@link Project#files} (such as {@link File}, {@code List<File>}, or {@code List<String>}). * * @param paths paths to set. */ public void setPaths(Object paths) { this.paths.set(convertToExtraDirecto...
@@ -98,6 +101,22 @@ public void setPaths(Object paths) { .collect(Collectors.toList())); } + /** + * Sets paths, for lazy evaluation where {@code paths} is a {@link Provider} of a suitable object. + * + * @param paths provider of paths to set + * @see #setPaths(Object) + */ + public void s...
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoriesParameters.java
26
Java
0.429
refactor
196
50
51
false
Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters
3,737
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoriesParameters.java PR Title: Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters BEFORE CODE: /** * Sets paths. {@code paths} can be an...
nit: would it be possible to have this be part of a helper method? In terms of readability, it could help the reader of the code avoid parsing through an additional level of logic in this method.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
objects, project, project.getProjectDir().toPath().resolve("src").resolve("main").resolve("jib"), "/")); } return paths.get(); } /** * Sets paths. {@code paths} can be any suitable object describing file paths convertible by * {@link Project#fil...
Ah I could be oversimplifying this in my mind but the Provider API should allow us to avoid setters all together. Similar to what is being done in https://github.com/GoogleContainerTools/jib/pull/3242, would it be possible to just modify the getter to return a `Property` and remove the setters?
new ExtraDirectoryParameters( objects, project, project.getProjectDir().toPath().resolve("src").resolve("main").resolve("jib"), "/")); } return paths.get(); } /** * Sets paths. {@code paths} can be any suitable object describing file path...
@@ -98,6 +101,22 @@ public void setPaths(Object paths) { .collect(Collectors.toList())); } + /** + * Sets paths, for lazy evaluation where {@code paths} is a {@link Provider} of a suitable object. + * + * @param paths provider of paths to set + * @see #setPaths(Object) + */ + public void s...
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoriesParameters.java
26
Java
0.643
refactor
296
51
51
false
Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters
3,737
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoriesParameters.java PR Title: Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters BEFORE CODE: objects, project, ...
Ah I could be oversimplifying this in my mind but the Provider API should allow us to avoid setters all together. Similar to what is being done in https://github.com/GoogleContainerTools/jib/pull/3242, would it be possible to just modify the getter to return a `Property` and remove the setters?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
.isEqualTo("/non/default/target"); } @Test public void testExtraDirectories_fileForPaths() { testJibExtension.extraDirectories( extraDirectories -> extraDirectories.setPaths(Paths.get("test/path").toFile())); assertThat(testJibExtension.getExtraDirectories().getPaths()).hasSize(1); as...
How about we name this: ```suggestion public void testExtraDirectories_lazyEvaluation_StringListForPaths() { ```
.isEqualTo("/non/default/target"); } @Test public void testExtraDirectories_fileForPaths() { testJibExtension.extraDirectories( extraDirectories -> extraDirectories.setPaths(Paths.get("test/path").toFile())); assertThat(testJibExtension.getExtraDirectories().getPaths()).hasSize(1); as...
@@ -309,6 +330,23 @@ public void testExtraDirectories_stringListForPaths() { .isEqualTo(fakeProject.getProjectDir().toPath().resolve("another/path")); } + @Test + public void testExtraDirectories_lazyStringListForPaths() {
jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibExtensionTest.java
26
Java
0.714
suggestion
119
51
51
false
Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters
3,737
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibExtensionTest.java PR Title: Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters BEFORE CODE: .isEqualTo("/non/default/target"); } @Test ...
How about we name this: ```suggestion public void testExtraDirectories_lazyEvaluation_StringListForPaths() { ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
public void testConfigurationName() { assertThat(testJibExtension.getConfigurationName().get()).isEqualTo("runtimeClasspath"); } @Test public void testExtraDirectories_default() { assertThat(testJibExtension.getExtraDirectories().getPaths()).hasSize(1); assertThat(testJibExtension.getExtraDirectori...
```suggestion public void testExtraDirectories_lazyEvaluation_setFromInto() { ```
public void testConfigurationName() { assertThat(testJibExtension.getConfigurationName().get()).isEqualTo("runtimeClasspath"); } @Test public void testExtraDirectories_default() { assertThat(testJibExtension.getExtraDirectories().getPaths()).hasSize(1); assertThat(testJibExtension.getExtraDirectori...
@@ -241,23 +243,42 @@ public void testExtraDirectories_default() { assertThat(testJibExtension.getExtraDirectories().getPaths()).hasSize(1); assertThat(testJibExtension.getExtraDirectories().getPaths().get(0).getFrom()) .isEqualTo(fakeProject.getProjectDir().toPath().resolve("src/main/jib")); - as...
jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibExtensionTest.java
26
Java
0.571
suggestion
85
51
51
false
Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters
3,737
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibExtensionTest.java PR Title: Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters BEFORE CODE: public void testConfigurationName() { assertThat(t...
```suggestion public void testExtraDirectories_lazyEvaluation_setFromInto() { ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
.contains( "Containerizing application to updated-image, updated-image:updated-tag, updated-image:tag2"); } @Test public void testLazyEvalForLabels() { BuildResult showLabels = testProject.build("showlabels", "-Djib.console=plain"); assertThat(showLabels.getOutput()) .contains...
How about we do this instead? ```suggestion assertThat(checkExtraDirectories.getOutput()).contains("extraDirectories (from): [/updated-custom-into-dir]"); ```
.contains( "Containerizing application to updated-image, updated-image:updated-tag, updated-image:tag2"); } @Test public void testLazyEvalForLabels() { BuildResult showLabels = testProject.build("showlabels", "-Djib.console=plain"); assertThat(showLabels.getOutput()) .contains...
@@ -368,6 +368,28 @@ public void testLazyEvalForLabels() { "labels contain values [firstkey:updated-first-label, secondKey:updated-second-label]"); } + @Test + public void testLazyEvalForExtraDirectories() { + BuildResult checkExtraDirectories = + testProject.build("check-extra-directories...
jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibPluginTest.java
26
Java
0.786
question
165
42
51
false
Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters
3,737
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibPluginTest.java PR Title: Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters BEFORE CODE: .contains( "Containerizing application ...
How about we do this instead? ```suggestion assertThat(checkExtraDirectories.getOutput()).contains("extraDirectories (from): [/updated-custom-into-dir]"); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
() -> testProject.build(JibPlugin.BUILD_IMAGE_TASK_NAME, "-Djib.console=plain")); String output = exception.getBuildResult().getOutput(); assertThat(output) .contains( "Containerizing application to updated-image, updated-image:updated-tag, updated-image:tag2"); } @Test p...
super nit: ```suggestion public void testLazyEvalForExtraDirectories_individualPaths() { ```
() -> testProject.build(JibPlugin.BUILD_IMAGE_TASK_NAME, "-Djib.console=plain")); String output = exception.getBuildResult().getOutput(); assertThat(output) .contains( "Containerizing application to updated-image, updated-image:updated-tag, updated-image:tag2"); } @Test p...
@@ -368,6 +368,28 @@ public void testLazyEvalForLabels() { "labels contain values [firstkey:updated-first-label, secondKey:updated-second-label]"); } + @Test + public void testLazyEvalForExtraDirectories() { + BuildResult checkExtraDirectories = + testProject.build("check-extra-directories...
jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibPluginTest.java
26
Java
0.571
suggestion
97
46
51
false
Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters
3,737
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibPluginTest.java PR Title: Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters BEFORE CODE: () -> testProject.build(JibPlugin.BUILD_IMAGE_T...
super nit: ```suggestion public void testLazyEvalForExtraDirectories_individualPaths() { ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
/** * Sets paths. {@code paths} can be any suitable object describing file paths convertible by * {@link Project#files} (such as {@link File}, {@code List<File>}, or {@code List<String>}). * * @param paths paths to set. */ public void setPaths(Object paths) { this.paths.set(transformObjectToParam...
Since the parameter of this method already gives us an indication of what we are converting, how about we do the following? ```suggestion private List<ExtraDirectoryParameters> convertToExtraDirectoryParametersList(Object obj) { ```
/** * Sets paths. {@code paths} can be any suitable object describing file paths convertible by * {@link Project#files} (such as {@link File}, {@code List<File>}, or {@code List<String>}). * * @param paths paths to set. */ public void setPaths(Object paths) { this.paths.set(convertToExtraDirector...
@@ -92,10 +96,28 @@ public List<ExtraDirectoryParameters> getPaths() { * @param paths paths to set. */ public void setPaths(Object paths) { - this.paths.set( - project.files(paths).getFiles().stream() - .map(file -> new ExtraDirectoryParameters(objects, project, file.toPath(), "/")) - ...
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoriesParameters.java
26
Java
0.786
suggestion
239
51
51
false
Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters
3,737
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoriesParameters.java PR Title: Use Gradle Property and Provider to enable lazy evaluation for jib.extraDirectories parameters BEFORE CODE: /** * Sets paths. {@code paths} can be an...
Since the parameter of this method already gives us an indication of what we are converting, how about we do the following? ```suggestion private List<ExtraDirectoryParameters> convertToExtraDirectoryParametersList(Object obj) { ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
/** * Return a list of diff ids of the layers in the image. * * @return a list of diff ids * @throws DigestException if a digest is invalid */ @Override public List<DescriptorDigest> getDiffIds() throws DigestException { List<DescriptorDigest> processedDiffIds = new ArrayList...
Some background of this change: Checking for existence of the default docker command when it is on PATH has been a little tricky. There can be several places where docker could be installed on a system and this also differs from OS to OS. For checking whether the path passed through `jib.dockerClient.executable` is ins...
* Return a list of diff ids of the layers in the image. * * @return a list of diff ids * @throws DigestException if a digest is invalid */ @Override public List<DescriptorDigest> getDiffIds() throws DigestException { List<DescriptorDigest> processedDiffIds = new ArrayList<>(rootFs...
@@ -103,30 +105,27 @@ public List<DescriptorDigest> getDiffIds() throws DigestException { public static final Path DEFAULT_DOCKER_CLIENT = Paths.get("docker"); /** - * Checks if Docker is installed on the user's system and accessible by running the default {@code - * docker} command. + * Checks if Docker ...
jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java
26
Java
0.643
suggestion
382
51
51
false
Check if file exists when executable path is passed in through jib dockerClient.executable
3,744
GoogleContainerTools/jib
11,032
Java
mpeddada1
mpeddada1
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java PR Title: Check if file exists when executable path is passed in through jib dockerClient.executable BEFORE CODE: /** * Return a list of diff ids of the layers in the image. ...
Some background of this change: Checking for existence of the default docker command when it is on PATH has been a little tricky. There can be several places where docker could be installed on a system and this also differs from OS to OS. For checking whether the path passed through `jib.dockerClient.executable` is ins...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
throw new CacheCorruptedException(metadataCacheDirectory, "Schema 2 manifests corrupted"); } if (metadata.getManifestList() != null && manifestsAndConfigs.stream().anyMatch(entry -> entry.getManifestDigest() == null)) { throw new CacheCorruptedException(metadataCacheDirectory, "Sch...
Minor suggestion here. I think generally, methods that return booleans are named as verb phrases like "isFoo". ```suggestion public boolean areAllLayersCached(ManifestTemplate manifest) { ```
throw new CacheCorruptedException(metadataCacheDirectory, "Schema 2 manifests corrupted"); } if (metadata.getManifestList() != null && manifestsAndConfigs.stream().anyMatch(entry -> entry.getManifestDigest() == null)) { throw new CacheCorruptedException(metadataCacheDirectory, "Sch...
@@ -81,6 +81,38 @@ static void verifyImageMetadata(ImageMetadataTemplate metadata, Path metadataCac this.cacheStorageFiles = cacheStorageFiles; } + /** + * Returns {@code true} if all image layers described in a manifest have a corresponding file + * entry in the cache. + * + * @param manifest the im...
jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageReader.java
26
Java
0.714
performance
199
51
51
false
Check for existence of layers in cache before returning cached base image
3,767
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageReader.java PR Title: Check for existence of layers in cache before returning cached base image BEFORE CODE: throw new CacheCorruptedException(metadataCacheDirectory, "Schema 2 manifests...
Minor suggestion here. I think generally, methods that return booleans are named as verb phrases like "isFoo". ```suggestion public boolean areAllLayersCached(ManifestTemplate manifest) { ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
throw new CacheCorruptedException(metadataCacheDirectory, "Schema 2 manifests corrupted"); } if (metadata.getManifestList() != null && manifestsAndConfigs.stream().anyMatch(entry -> entry.getManifestDigest() == null)) { throw new CacheCorruptedException(metadataCacheDirectory, "Sch...
Would it possible to move this method directly to PullBaseImageStep? Since that is the only class where this is used and it could help us avoid having to go through an extra layer of classes to reach this method. Or does this method require any variables that are specific to `CacheStorageReader`?
throw new CacheCorruptedException(metadataCacheDirectory, "Schema 2 manifests corrupted"); } if (metadata.getManifestList() != null && manifestsAndConfigs.stream().anyMatch(entry -> entry.getManifestDigest() == null)) { throw new CacheCorruptedException(metadataCacheDirectory, "Sch...
@@ -81,6 +81,38 @@ static void verifyImageMetadata(ImageMetadataTemplate metadata, Path metadataCac this.cacheStorageFiles = cacheStorageFiles; } + /** + * Returns {@code true} if all image layers described in a manifest have a corresponding file + * entry in the cache. + * + * @param manifest the im...
jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageReader.java
26
Java
0.643
performance
297
51
51
false
Check for existence of layers in cache before returning cached base image
3,767
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageReader.java PR Title: Check for existence of layers in cache before returning cached base image BEFORE CODE: throw new CacheCorruptedException(metadataCacheDirectory, "Schema 2 manifests...
Would it possible to move this method directly to PullBaseImageStep? Since that is the only class where this is used and it could help us avoid having to go through an extra layer of classes to reach this method. Or does this method require any variables that are specific to `CacheStorageReader`?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
CacheStorageReader(CacheStorageFiles cacheStorageFiles) { this.cacheStorageFiles = cacheStorageFiles; } /** * Returns {@code true} if all image layers described in a manifest have a corresponding file * entry in the cache. * * @param manifest the image manifest * @return a boolean */ bool...
I wonder if this would break current behavior for those doing multi-platform image building? For context https://github.com/GoogleContainerTools/jib/pull/2730, we also do caching for manifest lists in addition to single manifests.
CacheStorageReader(CacheStorageFiles cacheStorageFiles) { this.cacheStorageFiles = cacheStorageFiles; } /** * Returns {@code true} if all image layers described in a manifest have a corresponding file * entry in the cache. * * @param manifest the image manifest * @return a boolean */ bool...
@@ -81,6 +81,38 @@ static void verifyImageMetadata(ImageMetadataTemplate metadata, Path metadataCac this.cacheStorageFiles = cacheStorageFiles; } + /** + * Returns {@code true} if all image layers described in a manifest have a corresponding file + * entry in the cache. + * + * @param manifest the im...
jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageReader.java
26
Java
0.429
suggestion
230
51
51
false
Check for existence of layers in cache before returning cached base image
3,767
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageReader.java PR Title: Check for existence of layers in cache before returning cached base image BEFORE CODE: CacheStorageReader(CacheStorageFiles cacheStorageFiles) { this.cacheStorageFile...
I wonder if this would break current behavior for those doing multi-platform image building? For context https://github.com/GoogleContainerTools/jib/pull/2730, we also do caching for manifest lists in addition to single manifests.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
* @throws UnlistedPlatformInManifestListException if a cached manifest list has no manifests * matching the configured platform */ @VisibleForTesting List<Image> getCachedBaseImages() throws IOException, CacheCorruptedException, BadContainerConfigurationFormatException, LayerCountMismat...
How about we move the `Verify.verifyNotNull` condition to `allLayersCached`?
* @throws UnlistedPlatformInManifestListException if a cached manifest list has no manifests * matching the configured platform */ @VisibleForTesting List<Image> getCachedBaseImages() throws IOException, CacheCorruptedException, BadContainerConfigurationFormatException, LayerCountMismat...
@@ -457,6 +457,12 @@ List<Image> getCachedBaseImages() if (manifestList == null) { Verify.verify(manifestsAndConfigs.size() == 1); ManifestTemplate manifest = manifestsAndConfigs.get(0).getManifest(); + + // Verify all layers described in manifest are present in cache + if (!baseImageLayers...
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStep.java
26
Java
0.571
performance
76
51
51
false
Check for existence of layers in cache before returning cached base image
3,767
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStep.java PR Title: Check for existence of layers in cache before returning cached base image BEFORE CODE: * @throws UnlistedPlatformInManifestListException if a cached manifest list...
How about we move the `Verify.verifyNotNull` condition to `allLayersCached`?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
return Collections.singletonList( JsonToImageTranslator.toImage( (BuildableManifestTemplate) Verify.verifyNotNull(manifest), containerConfig)); } // Manifest list cached. Identify matching platforms and check if all of them are cached. ImmutableList.Builder<Image> images = Im...
Is it possible to combine `!manifestAndConfigFound.isPresent()` and `areAllLayersCached` with an `&&`?
manifestsAndConfigs.stream() .filter(entry -> manifestDigest.equals(entry.getManifestDigest())) .findFirst(); if (!manifestAndConfigFound.isPresent()) { return Collections.emptyList(); } Optional<Image> cachedImage = getBaseImageIfAllLayersCached...
@@ -486,6 +492,11 @@ List<Image> getCachedBaseImages() } ManifestTemplate manifest = Verify.verifyNotNull(manifestAndConfigFound.get().getManifest()); + // Verify all layers described in manifest are present in cache + if (!baseImageLayersCache.allLayersCached(manifest)) { + return Coll...
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStep.java
26
Java
0.5
performance
104
35
51
false
Check for existence of layers in cache before returning cached base image
3,767
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStep.java PR Title: Check for existence of layers in cache before returning cached base image BEFORE CODE: return Collections.singletonList( JsonToImageTranslator.toIma...
Is it possible to combine `!manifestAndConfigFound.isPresent()` and `areAllLayersCached` with an `&&`?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
public void testGetCachedBaseImages_emptyCache() throws InvalidImageReferenceException, IOException, CacheCorruptedException, UnlistedPlatformInManifestListException, PlatformNotFoundInBaseImageException, BadContainerConfigurationFormatException, LayerCountMismatchException { ImageRefere...
```suggestion Mockito.when(cache.retrieveMetadata(imageReference)).thenReturn(Optional.of(imageMetadata)); ```
@Test public void testGetCachedBaseImages_emptyCache() throws InvalidImageReferenceException, IOException, CacheCorruptedException, UnlistedPlatformInManifestListException, PlatformNotFoundInBaseImageException, BadContainerConfigurationFormatException, LayerCountMismatchException { Ima...
@@ -297,6 +300,25 @@ public void testGetCachedBaseImages_emptyCache() Assert.assertEquals(Arrays.asList(), pullBaseImageStep.getCachedBaseImages()); } + @Test + public void testGetCachedBaseImages_cachedWithoutAllLayers() + throws InvalidImageReferenceException, CacheCorruptedException, IOException, + ...
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStepTest.java
26
Java
0.714
performance
112
51
51
false
Check for existence of layers in cache before returning cached base image
3,767
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStepTest.java PR Title: Check for existence of layers in cache before returning cached base image BEFORE CODE: public void testGetCachedBaseImages_emptyCache() throws InvalidIma...
```suggestion Mockito.when(cache.retrieveMetadata(imageReference)).thenReturn(Optional.of(imageMetadata)); ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
ImageReference imageReference = ImageReference.parse("cat"); Mockito.when(buildContext.getBaseImageConfiguration()) .thenReturn(ImageConfiguration.builder(imageReference).build()); Mockito.when(cache.retrieveMetadata(imageReference)).thenReturn(Optional.empty()); Assert.assertEquals(Arrays.asLi...
Let's use `Truth` for newer assertions. It's a little easier to read since the expected is always on the right side and provides better error messaging. We'll have to add the following import statement: ``` import static com.google.common.truth.Truth.assertThat; ```
BadContainerConfigurationFormatException, LayerCountMismatchException { ImageReference imageReference = ImageReference.parse("cat"); Mockito.when(buildContext.getBaseImageConfiguration()) .thenReturn(ImageConfiguration.builder(imageReference).build()); Mockito.when(cache.retrieveMetadata(i...
@@ -297,6 +300,25 @@ public void testGetCachedBaseImages_emptyCache() Assert.assertEquals(Arrays.asList(), pullBaseImageStep.getCachedBaseImages()); } + @Test + public void testGetCachedBaseImages_cachedWithoutAllLayers() + throws InvalidImageReferenceException, CacheCorruptedException, IOException, + ...
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStepTest.java
26
Java
1
suggestion
269
51
51
false
Check for existence of layers in cache before returning cached base image
3,767
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStepTest.java PR Title: Check for existence of layers in cache before returning cached base image BEFORE CODE: ImageReference imageReference = ImageReference.parse("cat"); Mocki...
Let's use `Truth` for newer assertions. It's a little easier to read since the expected is always on the right side and provides better error messaging. We'll have to add the following import statement: ``` import static com.google.common.truth.Truth.assertThat; ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
OciIndexTemplate manifestList = JsonTemplateMapper.readJson(manifestListJson, OciIndexTemplate.class); String manifestDigest = pullBaseImageStep.lookUpPlatformSpecificImageManifest( manifestList, new Platform("targetArchitecture", "targetOS")); Assert.assertEquals( "sha...
What do you think of this? ```suggestion public void testGetCachedBaseImages_partiallyCached_emptyListReturned() ```
OciIndexTemplate manifestList = JsonTemplateMapper.readJson(manifestListJson, OciIndexTemplate.class); String manifestDigest = pullBaseImageStep.lookUpPlatformSpecificImageManifest( manifestList, new Platform("targetArchitecture", "targetOS")); Assert.assertEquals( "sh...
@@ -297,6 +300,25 @@ public void testGetCachedBaseImages_emptyCache() Assert.assertEquals(Arrays.asList(), pullBaseImageStep.getCachedBaseImages()); } + @Test + public void testGetCachedBaseImages_cachedWithoutAllLayers()
jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStepTest.java
26
Java
0.714
performance
126
51
51
false
Check for existence of layers in cache before returning cached base image
3,767
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStepTest.java PR Title: Check for existence of layers in cache before returning cached base image BEFORE CODE: OciIndexTemplate manifestList = JsonTemplateMapper.readJson(ma...
What do you think of this? ```suggestion public void testGetCachedBaseImages_partiallyCached_emptyListReturned() ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
new ManifestAndConfigTemplate( new OciManifestTemplate(), new ContainerConfigurationTemplate(), "sha256:digest"); ImageMetadataTemplate metadata = new ImageMetadataTemplate(null, Arrays.asList(manifestAndConfig)); CacheStorageReader.verifyImageMetadata(metadata, Paths.get("/cache/dir...
Minor suggestion: If possible, let's format the test into three blocks: arrange, act and assert, with a space between each of these blocks. The `arrange` block will take care of all setup, the `act` block will call the method we're testing and the `assert` block will do all the verification.
public void testVerifyImageMetadata_validOci() throws CacheCorruptedException { ManifestAndConfigTemplate manifestAndConfig = new ManifestAndConfigTemplate( new OciManifestTemplate(), new ContainerConfigurationTemplate(), "sha256:digest"); ImageMetadataTemplate metadata = new Image...
@@ -638,4 +638,52 @@ public void testVerifyImageMetadata_validOciImageIndex() throws CacheCorruptedEx CacheStorageReader.verifyImageMetadata(metadata, Paths.get("/cache/dir")); // should pass without CacheCorruptedException } + + @Test + public void testAllLayersCached_v21SingleManifest() + throws I...
jib-core/src/test/java/com/google/cloud/tools/jib/cache/CacheStorageReaderTest.java
26
Java
0.571
suggestion
293
51
51
false
Check for existence of layers in cache before returning cached base image
3,767
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/cache/CacheStorageReaderTest.java PR Title: Check for existence of layers in cache before returning cached base image BEFORE CODE: new ManifestAndConfigTemplate( new OciManifestTemplate(), new...
Minor suggestion: If possible, let's format the test into three blocks: arrange, act and assert, with a space between each of these blocks. The `arrange` block will take care of all setup, the `act` block will call the method we're testing and the `assert` block will do all the verification.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
// should pass without CacheCorruptedException } @Test public void testVerifyImageMetadata_validOciImageIndex() throws CacheCorruptedException { ManifestAndConfigTemplate manifestAndConfig = new ManifestAndConfigTemplate( new OciManifestTemplate(), new ContainerConfigurationTemplate()...
Same as above, let's use Truth here
new ImageMetadataTemplate(null, Arrays.asList(manifestAndConfig)); CacheStorageReader.verifyImageMetadata(metadata, Paths.get("/cache/dir")); // should pass without CacheCorruptedException } @Test public void testVerifyImageMetadata_validOciImageIndex() throws CacheCorruptedException { Manife...
@@ -638,4 +638,52 @@ public void testVerifyImageMetadata_validOciImageIndex() throws CacheCorruptedEx CacheStorageReader.verifyImageMetadata(metadata, Paths.get("/cache/dir")); // should pass without CacheCorruptedException } + + @Test + public void testAllLayersCached_v21SingleManifest() + throws I...
jib-core/src/test/java/com/google/cloud/tools/jib/cache/CacheStorageReaderTest.java
26
Java
0.143
suggestion
36
51
51
false
Check for existence of layers in cache before returning cached base image
3,767
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-core/src/test/java/com/google/cloud/tools/jib/cache/CacheStorageReaderTest.java PR Title: Check for existence of layers in cache before returning cached base image BEFORE CODE: // should pass without CacheCorruptedException } @Test public void tes...
Same as above, let's use Truth here
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
ContainerConfigurationTemplate containerConfig = Verify.verifyNotNull(manifestsAndConfigs.get(0).getConfig()); PlatformChecker.checkManifestPlatform(buildContext, containerConfig); return Collections.singletonList( JsonToImageTranslator.toImage( (BuildableManifestTe...
(optional) there was quite a bit of code duplication in this method even in the past between the section that deals with general and platform-based manifest processing. Could there be an opportunity for refactoring common logic out into a helper method?
String manifestDigest = lookUpPlatformSpecificImageManifest((V22ManifestListTemplate) manifestList, platform); Optional<ManifestAndConfigTemplate> manifestAndConfigFound = manifestsAndConfigs.stream() .filter(entry -> manifestDigest.equals(entry.getManifestDigest())) ...
@@ -486,6 +492,11 @@ List<Image> getCachedBaseImages() } ManifestTemplate manifest = Verify.verifyNotNull(manifestAndConfigFound.get().getManifest()); + // Verify all layers described in manifest are present in cache
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStep.java
26
Java
0.5
refactor
253
39
51
false
Check for existence of layers in cache before returning cached base image
3,767
GoogleContainerTools/jib
11,032
Java
elefeint
emmileaf
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStep.java PR Title: Check for existence of layers in cache before returning cached base image BEFORE CODE: ContainerConfigurationTemplate containerConfig = Verify.verif...
(optional) there was quite a bit of code duplication in this method even in the past between the section that deals with general and platform-based manifest processing. Could there be an opportunity for refactoring common logic out into a helper method?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
* matching the configured platform */ @VisibleForTesting List<Image> getCachedBaseImages() throws IOException, CacheCorruptedException, BadContainerConfigurationFormatException, LayerCountMismatchException, UnlistedPlatformInManifestListException, PlatformNotFoundInBaseImageExcep...
super nit: we can do away with the `else` here and return `Collections.singletonList(...)` outside the `if`.
* matching the configured platform */ @VisibleForTesting List<Image> getCachedBaseImages() throws IOException, CacheCorruptedException, BadContainerConfigurationFormatException, LayerCountMismatchException, UnlistedPlatformInManifestListException, PlatformNotFoundInBaseImageExcep...
@@ -456,19 +456,13 @@ List<Image> getCachedBaseImages() if (manifestList == null) { Verify.verify(manifestsAndConfigs.size() == 1); - ManifestTemplate manifest = manifestsAndConfigs.get(0).getManifest(); - if (manifest instanceof V21ManifestTemplate) { - return Collections.singletonList( ...
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStep.java
26
Java
0.5
nitpick
109
51
51
false
Check for existence of layers in cache before returning cached base image
3,767
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PullBaseImageStep.java PR Title: Check for existence of layers in cache before returning cached base image BEFORE CODE: * matching the configured platform */ @VisibleForTesting List<Im...
super nit: we can do away with the `else` here and return `Collections.singletonList(...)` outside the `if`.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
#!/bin/bash set -o errexit set -o xtrace gcloud components install docker-credential-gcr # Docker service does not run by default in Big Sur but can be started with the following commands. if [ "${KOKORO_JOB_CLUSTER}" = "MACOS_EXTERNAL" ]; then source github/jib/kokoro/docker_setup.sh fi # Stops any left-over conta...
Adding temporary check to verify the change in the CI. This needs to be removed before merging.
#!/bin/bash set -o errexit set -o xtrace gcloud components install docker-credential-gcr # Docker service does not run by default in Big Sur but can be started with the following commands. if [ "${KOKORO_JOB_CLUSTER}" = "MACOS_EXTERNAL" ]; then source github/jib/kokoro/docker_setup.sh fi # Stops any left-over conta...
@@ -17,4 +17,4 @@ docker kill $(docker ps --all --quiet) || 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-gradle-plugin:integrationTest --info --stacktrace
kokoro/presubmit.sh
20
Shell
0.286
suggestion
95
21
21
false
fix: undo kokoro JAVA_TOOL_OPTIONS workaround
3,827
GoogleContainerTools/jib
11,032
Java
mpeddada1
mpeddada1
Review this pull request change. Language: Shell File: kokoro/presubmit.sh PR Title: fix: undo kokoro JAVA_TOOL_OPTIONS workaround BEFORE CODE: #!/bin/bash set -o errexit set -o xtrace gcloud components install docker-credential-gcr # Docker service does not run by default in Big Sur but can be started with the ...
Adding temporary check to verify the change in the CI. This needs to be removed before merging.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} catch (InterruptedException | IOException ex) { throw new RuntimeException("Could not stop local registry fully: " + containerName, ex); } } /** Gets local registry container IP and associates it to localhost. */ private String getAndMapRegistryContainerIp() { String containerIp; // Get...
@emmileaf Not sure if this will make a difference but I wonder if the result of `docker inspect -f ...` can be calculated in [kokoro/docker_setup.sh](https://github.com/GoogleContainerTools/jib/blob/dc24c0c3b132cd745e89ecc567ea7cf68d9b4066/kokoro/docker_setup.sh#L3-L6) and stored as an environment variable. Similar to ...
* @throws IOException if the pull command fails * @throws InterruptedException if the pull command is interrupted */ public void pull(String from) throws IOException, InterruptedException { login(); new Command("docker", "pull", from).run(); logout(); } /** * Pulls an image and pushes it ...
@@ -119,6 +132,37 @@ public void stop() { } } + /** Gets local registry container IP and associates it to localhost. */ + private String getAndMapRegistryContainerIp() { + String containerIp; + + // Gets local registry container IP + List<String> dockerTokens = + Lists.newArrayList( + ...
jib-core/src/integration-test/java/com/google/cloud/tools/jib/registry/LocalRegistry.java
26
Java
0.571
question
758
51
51
false
ci: test suite and script changes for compatibility with Kokoro ubuntu migration
3,886
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-core/src/integration-test/java/com/google/cloud/tools/jib/registry/LocalRegistry.java PR Title: ci: test suite and script changes for compatibility with Kokoro ubuntu migration BEFORE CODE: } catch (InterruptedException | IOException ex) { throw n...
@emmileaf Not sure if this will make a difference but I wonder if the result of `docker inspect -f ...` can be calculated in [kokoro/docker_setup.sh](https://github.com/GoogleContainerTools/jib/blob/dc24c0c3b132cd745e89ecc567ea7cf68d9b4066/kokoro/docker_setup.sh#L3-L6) and stored as an environment variable. Similar to ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"--from=gcr.io/google-appengine/openjdk:8", jarPath.toString()); assertThat(exitCode).isEqualTo(0); String output = new Command("docker", "run", "--rm", "cli-gcr-base").run(); assertThat(output).isEqualTo("Hello World"); } @Nullable private static String getContent(URL...
The `get` prefix is generally reserved for getters where we have one return statement. Since we have a little bit of logic here, what are your thoughts on this? ```suggestion private String fetchDockerHostForHttpRequest() { ```
/* * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
@@ -331,4 +332,16 @@ private static String getContent(URL url) throws InterruptedException { } return null; } + + private String getDockerHostForHttpRequest() {
jib-cli/src/integration-test/java/com/google/cloud/tools/jib/cli/JarCommandTest.java
26
Java
0.786
suggestion
237
38
319
false
ci: test suite and script changes for compatibility with Kokoro ubuntu migration
3,886
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-cli/src/integration-test/java/com/google/cloud/tools/jib/cli/JarCommandTest.java PR Title: ci: test suite and script changes for compatibility with Kokoro ubuntu migration BEFORE CODE: "--from=gcr.io/google-appengine/openjdk:8", ...
The `get` prefix is generally reserved for getters where we have one return statement. Since we have a little bit of logic here, what are your thoughts on this? ```suggestion private String fetchDockerHostForHttpRequest() { ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"--from=gcr.io/google-appengine/openjdk:8", jarPath.toString()); assertThat(exitCode).isEqualTo(0); String output = new Command("docker", "run", "--rm", "cli-gcr-base").run(); assertThat(output).isEqualTo("Hello World"); } @Nullable private static String getContent(URL...
This method seems like a good candidate for a utility class. https://github.com/GoogleContainerTools/jib/tree/master/jib-plugins-common/src/test/java/com/google/cloud/tools/jib/api looks like a fitting home for this class.
/* * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
@@ -331,4 +332,16 @@ private static String getContent(URL url) throws InterruptedException { } return null; } + + private String getDockerHostForHttpRequest() {
jib-cli/src/integration-test/java/com/google/cloud/tools/jib/cli/JarCommandTest.java
26
Java
0.429
refactor
222
38
319
false
ci: test suite and script changes for compatibility with Kokoro ubuntu migration
3,886
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-cli/src/integration-test/java/com/google/cloud/tools/jib/cli/JarCommandTest.java PR Title: ci: test suite and script changes for compatibility with Kokoro ubuntu migration BEFORE CODE: "--from=gcr.io/google-appengine/openjdk:8", ...
This method seems like a good candidate for a utility class. https://github.com/GoogleContainerTools/jib/tree/master/jib-plugins-common/src/test/java/com/google/cloud/tools/jib/api looks like a fitting home for this class.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
* history of the built image. * * @param imageReference the image reference of the built image * @return the container output * @throws IOException if an I/O exception occurs * @throws InterruptedException if the process was interrupted */ private static String pullAndRunBuiltImage(String imageRe...
minor nit: how about we make `MatcherAssert` static?
/** * Pulls a built image and attempts to run it. Also verifies the container configuration and * history of the built image. * * @param imageReference the image reference of the built image * @return the container output * @throws IOException if an I/O exception occurs * @throws InterruptedExcep...
@@ -266,22 +268,20 @@ private static String pullAndRunBuiltImage(String imageReference) private static void assertDockerInspectParameters(String imageReference) throws IOException, InterruptedException { - String dockerInspect = new Command("docker", "inspect", imageReference).run(); - assertThat(dock...
jib-maven-plugin/src/integration-test/java/com/google/cloud/tools/jib/maven/BuildImageMojoIntegrationTest.java
26
Java
0.357
question
52
51
51
false
test: update integration test assertions for docker inspect output
3,926
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-maven-plugin/src/integration-test/java/com/google/cloud/tools/jib/maven/BuildImageMojoIntegrationTest.java PR Title: test: update integration test assertions for docker inspect output BEFORE CODE: * history of the built image. * * @param imageRefere...
minor nit: how about we make `MatcherAssert` static?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
fileStream.forEach( sourceFile -> layerConfigurationBuilder.addEntry( sourceFile, AbsoluteUnixPath.get(pathInContainer + sourceFile.getFileName()))); return layerConfigurationBuilder.build(); } } private static void assertDockerInspect(String imageReference...
(Not too familiar with Jib or these ITs) If the whitespace changes were causing the mismatch for String, would it make sense (or be possible) to convert this to something like a JsonObject and match JSON contents instead of String comparisons?
fileStream.forEach( sourceFile -> layerConfigurationBuilder.addEntry( sourceFile, AbsoluteUnixPath.get(pathInContainer + sourceFile.getFileName()))); return layerConfigurationBuilder.build(); } } private static void assertDockerInspect(String imageReference...
@@ -115,28 +115,24 @@ private static FileEntriesLayer makeLayerConfiguration( private static void assertDockerInspect(String imageReference) throws IOException, InterruptedException { - String dockerContainerConfig = new Command("docker", "inspect", imageReference).run(); + String dockerInspectExposed...
jib-core/src/integration-test/java/com/google/cloud/tools/jib/api/ContainerizerIntegrationTest.java
26
Java
0.5
question
243
51
51
false
test: update integration test assertions for docker inspect output
3,926
GoogleContainerTools/jib
11,032
Java
lqiu96
emmileaf
Review this pull request change. Language: Java File: jib-core/src/integration-test/java/com/google/cloud/tools/jib/api/ContainerizerIntegrationTest.java PR Title: test: update integration test assertions for docker inspect output BEFORE CODE: fileStream.forEach( sourceFile -> layerCon...
(Not too familiar with Jib or these ITs) If the whitespace changes were causing the mismatch for String, would it make sense (or be possible) to convert this to something like a JsonObject and match JSON contents instead of String comparisons?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@Input @Optional public List<String> getExtraClasspath() { if (System.getProperty(PropertyNames.CONTAINER_EXTRA_CLASSPATH) != null) { return ConfigurationPropertyValidator.parseListProperty( System.getProperty(PropertyNames.CONTAINER_EXTRA_CLASSPATH)); } return extraClasspath; } ...
Because `mainClass` was previously nullable, I wonder if we should keep a `Nullable`-annotated getter for it out of consideration for backward compatibility? (Perhaps something similar to when `from.auth.username` and `from.auth.password` were converted for lazy eval) https://github.com/GoogleContainerTools/jib/bl...
} public void setEnvironment(Map<String, String> environment) { this.environment = environment; } @Input @Optional public List<String> getExtraClasspath() { if (System.getProperty(PropertyNames.CONTAINER_EXTRA_CLASSPATH) != null) { return ConfigurationPropertyValidator.parseListProperty( ...
@@ -135,19 +138,15 @@ public void setExpandClasspathDependencies(boolean expand) { } @Input - @Nullable
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ContainerParameters.java
26
Java
0.786
security
459
51
51
false
Support lazy configuration for `mainClass` and `jvmFlags` properties of `ContainerParameters`
3,936
GoogleContainerTools/jib
11,032
Java
emmileaf
erdi
Review this pull request change. Language: Java File: jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ContainerParameters.java PR Title: Support lazy configuration for `mainClass` and `jvmFlags` properties of `ContainerParameters` BEFORE CODE: @Input @Optional public List<String> getExtraCl...
Because `mainClass` was previously nullable, I wonder if we should keep a `Nullable`-annotated getter for it out of consideration for backward compatibility? (Perhaps something similar to when `from.auth.username` and `from.auth.password` were converted for lazy eval) https://github.com/GoogleContainerTools/jib/bl...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
// Ensures call to image at KNOWN_MANIFEST_LIST_SHA returns a manifest list V22ManifestListTemplate manifestListTargeted = registryClient .pullManifest(KNOWN_MANIFEST_LIST_SHA, V22ManifestListTemplate.class) .getManifest(); Assert.assertEquals(2, manifestListTargeted.getSche...
Alt: instead of `KNOWN_OCI_INDEX_SHA`, this newly added test can keep using the "latest" tag (which keeps it susceptible for breakage but able to detect future changes in this image, as noted in https://github.com/GoogleContainerTools/jib/issues/3963#issuecomment-1481405637).
// Ensures call to image at the specified SHA returns a manifest list V22ManifestListTemplate manifestListTargeted = registryClient .pullManifest(KNOWN_MANIFEST_LIST_SHA, V22ManifestListTemplate.class) .getManifest(); assertThat(manifestListTargeted.getSchemaVersion()).isEqu...
@@ -80,31 +112,41 @@ public void testPull_v22ManifestList() throws IOException, RegistryException { RegistryClient.factory(EventHandlers.NONE, "gcr.io", "distroless/base", httpClient) .newRegistryClient(); - // Ensure ":latest" is a manifest list + // Ensures call to image at KNOWN_MANIFES...
jib-core/src/integration-test/java/com/google/cloud/tools/jib/registry/ManifestPullerIntegrationTest.java
26
Java
0.643
suggestion
276
51
51
false
ci: update integration tests that expect docker manifest format from distroless image
3,965
GoogleContainerTools/jib
11,032
Java
emmileaf
emmileaf
Review this pull request change. Language: Java File: jib-core/src/integration-test/java/com/google/cloud/tools/jib/registry/ManifestPullerIntegrationTest.java PR Title: ci: update integration tests that expect docker manifest format from distroless image BEFORE CODE: // Ensures call to image at KNOWN_MANIFEST...
Alt: instead of `KNOWN_OCI_INDEX_SHA`, this newly added test can keep using the "latest" tag (which keeps it susceptible for breakage but able to detect future changes in this image, as noted in https://github.com/GoogleContainerTools/jib/issues/3963#issuecomment-1481405637).
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@BeforeClass public static void setUp() throws IOException, InterruptedException { localRegistry.pullAndPushToLocal("busybox", "busybox"); } private final FailoverHttpClient httpClient = new FailoverHttpClient(true, false, ignored -> {}); @Test public void testPull_v21() throws IOException, RegistryE...
qq you may have covered this already but why do we need to replace `distroless/java` with `distroless/base`? Is there anything blocking us from using a previous tag from [`gcr.io/distroless/java`](https://pantheon.corp.google.com/gcr/images/distroless/global/java).
@BeforeClass public static void setUp() throws IOException, InterruptedException { localRegistry.pullAndPushToLocal("busybox", "busybox"); } private final FailoverHttpClient httpClient = new FailoverHttpClient(true, false, ignored -> {}); @Test public void testPull_v21() throws IOException, RegistryE...
@@ -65,13 +79,31 @@ public void testPull_v21() throws IOException, RegistryException { @Test public void testPull_v22() throws IOException, RegistryException { RegistryClient registryClient = - RegistryClient.factory(EventHandlers.NONE, "gcr.io", "distroless/java", httpClient) + RegistryClient....
jib-core/src/integration-test/java/com/google/cloud/tools/jib/registry/ManifestPullerIntegrationTest.java
26
Java
0.643
suggestion
266
51
51
false
ci: update integration tests that expect docker manifest format from distroless image
3,965
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-core/src/integration-test/java/com/google/cloud/tools/jib/registry/ManifestPullerIntegrationTest.java PR Title: ci: update integration tests that expect docker manifest format from distroless image BEFORE CODE: @BeforeClass public static void setUp() th...
qq you may have covered this already but why do we need to replace `distroless/java` with `distroless/base`? Is there anything blocking us from using a previous tag from [`gcr.io/distroless/java`](https://pantheon.corp.google.com/gcr/images/distroless/global/java).
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
ManifestTemplate manifestListGeneric = registryClient.pullManifest(KNOWN_MANIFEST_LIST_SHA).getManifest(); Assert.assertEquals(2, manifestListGeneric.getSchemaVersion()); MatcherAssert.assertThat( manifestListGeneric, CoreMatchers.instanceOf(V22ManifestListTemplate.class)); Assert.assert...
nit: Perhaps we can use Truth here?
ManifestTemplate manifestListGeneric = registryClient.pullManifest(KNOWN_MANIFEST_LIST_SHA).getManifest(); assertThat(manifestListGeneric.getSchemaVersion()).isEqualTo(2); assertThat(manifestListGeneric).isInstanceOf(V22ManifestListTemplate.class); assertThat(((V22ManifestListTemplate) manifestL...
@@ -80,31 +112,41 @@ public void testPull_v22ManifestList() throws IOException, RegistryException { RegistryClient.factory(EventHandlers.NONE, "gcr.io", "distroless/base", httpClient) .newRegistryClient(); - // Ensure ":latest" is a manifest list + // Ensures call to image at KNOWN_MANIFES...
jib-core/src/integration-test/java/com/google/cloud/tools/jib/registry/ManifestPullerIntegrationTest.java
26
Java
0.143
question
35
46
44
false
ci: update integration tests that expect docker manifest format from distroless image
3,965
GoogleContainerTools/jib
11,032
Java
mpeddada1
emmileaf
Review this pull request change. Language: Java File: jib-core/src/integration-test/java/com/google/cloud/tools/jib/registry/ManifestPullerIntegrationTest.java PR Title: ci: update integration tests that expect docker manifest format from distroless image BEFORE CODE: ManifestTemplate manifestListGeneric = ...
nit: Perhaps we can use Truth here?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.