use of org.jreleaser.model.Registry in project jreleaser by jreleaser.
the class DockerValidator method validateRegistries.
private static void validateRegistries(JReleaserContext context, DockerConfiguration self, DockerConfiguration other, Errors errors, String element) {
JReleaserModel model = context.getModel();
Set<Registry> registries = new LinkedHashSet<>();
registries.addAll(self.getRegistries());
registries.addAll(other.getRegistries());
self.setRegistries(registries);
if (registries.isEmpty()) {
context.getLogger().warn(RB.$("validation_docker_no_registries", element));
return;
}
for (Registry registry : registries) {
GitService service = model.getRelease().getGitService();
String serverName = registry.getServerName();
registry.setUsername(checkProperty(context, "DOCKER_" + Env.toVar(serverName) + "_USERNAME", "registry." + Env.toVar(serverName) + ".username", registry.getUsername(), service.getResolvedUsername()));
if (isBlank(registry.getRepositoryName())) {
registry.setRepositoryName(service.getOwner());
}
if (isBlank(registry.getUsername())) {
errors.configuration(RB.$("validation_must_not_be_blank", element + ".registry." + serverName + ".username"));
}
registry.setPassword(checkProperty(context, "DOCKER_" + Env.toVar(serverName) + "_PASSWORD", "registry." + Env.toVar(serverName) + ".password", registry.getPassword(), errors, context.isDryrun()));
}
}
use of org.jreleaser.model.Registry in project jreleaser by jreleaser.
the class DockerPackagerProcessor method publishDocker.
protected void publishDocker(Distribution distribution, Map<String, Object> props, DockerConfiguration docker) throws PackagerProcessingException {
for (Registry registry : docker.getRegistries()) {
login(registry);
for (String imageName : docker.getImageNames()) {
publish(registry, imageName, props);
}
logout(registry);
}
}
Aggregations