in plugins/docker/component-image/src/main/java/co/elastic/gradle/dockercomponent/PushManifestListTask.java [80:119]
public void pushManifestList() throws IOException {
final Set<String> templates = getArchitectureTags().get().values().stream()
.map(each -> {
String template = each;
for (Architecture value : Architecture.values()) {
template = template.replace(value.dockerName(), "ARCH");
}
return template;
})
.collect(Collectors.toSet());
if (templates.isEmpty()) {
throw new GradleException("Can't push manifest list, no input tags are present");
}
if (templates.size() > 1) {
throw new GradleException("Can't derive template from manifest list: " + templates);
}
final Random random = new Random();
final String output = RetryUtils.retry(() -> pushManifestList(templates))
.maxAttempt(6)
.exponentialBackoff(random.nextInt(5) * 1000, 30000)
.onRetryError(error -> getLogger().warn("Error while pushing manifest. Retrying", error))
.execute();
if (output.startsWith("Digest: sha256:")) {
Files.writeString(
RegularFileUtils.toPath(getDigestFile()),
output.substring(8, 79)
);
getLogger().lifecycle("Pushed manifest list to {}", getTag().get());
} else {
if (output.isEmpty()) {
throw new GradleException("manifest-tool succeeded but generated no output. " +
"Check the task output for additional details.");
} else {
throw new GradleException("manifest-tool succeeded but generated unexpected output: `" + output +
"`. Check the task output for additional details.");
}
}
}