fix JENKINS-18214

split upgrade into smaller methods for readability
don't override privatekey variable with private key content then use it as path