Further refactor of common code in Jenkins.