This is a bit more complex but will make the jenkins pipeline a bit more robust than "Just run the script and see if it breaks".