Trying to use the Jenkins ssh agent plugin in pipeline to copy war file to tomcat ( both running on Ubuntu 18.04 on Ec2).
Using standard sample code and using key based authentication. Tomcat is up and running.
stage('Deploy to Tomcat'){
sshagent(['Tomcat-cred']) {
sh 'scp -o StrictHostKeyChecking=no target/*.war ubuntu@xxxx:/opt/tomcat/latest/webapps/'
}
}
Get Error: scp: /opt/tomcat/latest/webapps//myweb-0.0.7-SNAPSHOT.war: Permission denied
Had setup the tomcat user with permissions to 'latest' (symlink)
Here are my file permissions:
drwxrwxrwx 7 tomcat tomcat 4096 Sep 16 15:52 webapps.
I tried now with some changes:
scp: /opt/tomcat/latest/webapps/: No such file or directory
scp: /opt/tomcat/apache-tomcat-9.0.26/webapps/: No such file or directory
The directory of course exists:
ubuntu@ip-xxxxx:/opt/tomcat/apache-tomcat-9.0.26$ ls
webapps