We consider a Riemannian submersion from a 3-manifold $\mathbb{E}$ to a surface $M$, both connected and orientable, whose fibers are the integral curves of a Killing vector field without zeros, not necessarily unitary. We solve the Jenkins-Serrin problem for the minimal surface equation in $\mathbb{E}$ over a relatively compact open domain $\Omega\subset M$ with prescribed finite or infinite values on some arcs of the boundary under the only assumption that the same value $+\infty$ or $-\infty$ cannot be prescribed on two adjacent components of $\partial\Omega$ forming a convex angle. The domain $\Omega$ can have reentrant corners as well as closed curves in its boundary. We show that the solution exists if and only if some generalized Jenkins-Serrin conditions (in terms of a conformal metric in $M$) are fulfilled. We develop further the theory of divergence lines to study the convergence of a sequence of minimal graphs. We also provide maximum principles that guarantee the uniqueness of the solution. Finally, we obtain new examples of minimal surfaces in $\mathbb{R}^3$ and in other homogeneous $3$-manifolds.