Skip to content

Commit f4760a0

Browse files
authored
Bugfix - NPE is thrown if the image is not found in Artifactory (#474)
1 parent 3755e41 commit f4760a0

File tree

1 file changed

+5
-1
lines changed
  • build-info-extractor-docker/src/main/java/org/jfrog/build/extractor/docker/extractor

1 file changed

+5
-1
lines changed

Diff for: build-info-extractor-docker/src/main/java/org/jfrog/build/extractor/docker/extractor/DockerPush.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ public Build execute() {
9696
Module module = image.generateBuildInfoModule(logger, DockerUtils.CommandType.Push);
9797
if (module.getArtifacts() == null || module.getArtifacts().size() == 0) {
9898
logger.warn("Could not find docker image: " + imageTag + " in Artifactory.");
99+
} else {
100+
setImageLayersProps(image.getLayers(), artifactProperties, buildInfoClientBuilder);
99101
}
100-
setImageLayersProps(image.getLayers(), artifactProperties, buildInfoClientBuilder);
101102
Build build = new Build();
102103
modulesList.add(module);
103104
build.setModules(modulesList);
@@ -113,6 +114,9 @@ public Build execute() {
113114
* Update each layer's properties with artifactProperties.
114115
*/
115116
private void setImageLayersProps(DockerLayers layers, ArrayListMultimap<String, String> artifactProperties, ArtifactoryBuildInfoClientBuilder buildInfoClientBuilder) throws IOException {
117+
if (layers == null){
118+
return;
119+
}
116120
String artifactsPropsStr = buildMatrixParamsString(artifactProperties, false);
117121
try (ArtifactoryBuildInfoClient buildInfoClient = buildInfoClientBuilder.build()) {
118122
for (DockerLayer layer : layers.getLayers()) {

0 commit comments

Comments
 (0)