In this paper, an optimization-based constrained iterative learning control (ILC) with an iteratively tunable feedback controller is proposed for building temperature control systems. To guarantee good control performance in the presence of both repetitive and non-repetitive disturbances, the ILC input and the feedback controller are optimized simultaneously in each iteration. Considering constraints from the input saturation, the ILC convergence requirement and the closed-loop stability, the controller design is formulated as a convex optimization problem. The influence of disturbance uncertainties is also incorporated into the optimization problem in the form of chance constraints. To reduce the complexity of the problem, special techniques such as relaxation and projection on convex sets are introduced to make the algorithm more efficient. The effectiveness of the proposed algorithm is verified by simulations conducted on a four-room testbed system.