Search in sources :

Example 1 with Registry

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()));
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) JReleaserModel(org.jreleaser.model.JReleaserModel) GitService(org.jreleaser.model.GitService) Registry(org.jreleaser.model.Registry)

Example 2 with Registry

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);
    }
}
Also used : Registry(org.jreleaser.model.Registry)

Aggregations

Registry (org.jreleaser.model.Registry)2 LinkedHashSet (java.util.LinkedHashSet)1 GitService (org.jreleaser.model.GitService)1 JReleaserModel (org.jreleaser.model.JReleaserModel)1