I am trying to SSH into an app running on Cloud Foundry as explained in the official documentation https://docs.cloudfoundry.org/devguide/deploy-apps/ssh-apps.html. I would like to do this via a Jenkins pipeline. Below the Jenkins file
pipeline {
agent any
environment {
CF_ORGANIZATION = "organization"
CF_SPACE = "test"
}
stage('login to my app') {
steps {
sh "cf login -a <Api end point> -u ${CF_USER} -p ${CF_PASS}"
sh "cf target -o ${CF_ORGANIZATION} -s ${CF_SPACE}"
sh "cf ssh myapp"
sh "touch testfile.txt"
}
}
}
The cf login and cf target work, but the cf ssh myapp doesn't go through. I don't have a failure message but if I try do to something on the remote machine (such as write a file via touch testfile.txt) it doesn't do anything. Do you know if this is the right approach or the cf cli doesn't work in this case?