Next up is the C# web application. We have already done most of the work; now set up SSH.
Fixing our Jenkinsfile so that it copies our archived files automatically should not be a problem. We can do this again using SSH. First, we need to make Jenkins the owner of the webshop-net folder:
sudo chown -R jenkins:jenkins /var/www/webshop-net
Again, this means that your root user loses privileges, and if you want to copy using WinSCP, you should use the jenkins user.
sh 'rm -rf /var/www/webshop-net/*'sh 'scp -r prod/* jenkins@ciserver:/var/www/webshop-net'
The complete code for the Archive Artifacts and Deployment steps looks as follows: