Posts

Showing posts with the label sshpass

Passing the PASSWORD credentials variable from Jenkins to sshpass in a script

Passing the PASSWORD credentials variable from Jenkins to sshpass in a script I've setup some global credentials in jenkins, username password type. I've now got to scp a file over to a target server inside my pipeline. For arguments sake, lets say my password variable is secretpassword. Does anyone know how to get the password to work properly with sshpass? Here's the gist of what I'm trying to do sh ''' sshpass -p'${PASSWORD}' scp ${WORKSPACE}/target/citest-1.0-SNAPSHOT.jar root@target_service:/ ''' Whatever I try I can't seem to get the syntax right for passing the password to sshpass If I do the following, it works fine sh ''' sshpass -p 'secretpassword' scp ${WORKSPACE}/target/citest-1.0-SNAPSHOT.jar root@target_service:/ ''' So I'm obviously just messing up how to get the PASSWORD env variable to spit out properly into the single quotes. I seem to have tried a few thousand options so far, doe...