I cannot find a concrete answer to that at https://www.oracle.com/technetwork/java/javase/terms/products/index.html and https://www.oracle.com/technetwork/java/javase/terms/license/index.html. The BCL only explicitly allows to “reproduce and use internally the Software complete and unmodified for the sole purpose of running Programs”. Whether providing a commercial service with JDK tools themselves qualifies as that under applicable law is something to ask their legal department.
That said, the BCL does allow redistribution, so if Oracle didn’t C&D them for installing the JDK on the fly, having it in the images shouldn’t make much of a difference since the service is essentially the same. This does make it harder for Oracle to cut the service to Travis if they wish to, so if this is actually a legally grey area, this may make a difference.