[FIX JENKINS-14538] Improve builds dir input validation