I have two Windows boxes. One is Jenkins build server. Second one is deployment box.
I have installed SSH and created a user on the deployment Windows box. I can ssh to it from my Ubuntu workstation and run commands I need to run.
But I need to do this automatically from Jenkins. How to do it? Basically I need to make this automatic:
ssh richard@myserver
... enter password ...
cd C:/puppet && git pull
"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin/puppet.bat" apply C:/puppet/manifests/site.pp
That’s it. Is there some way to do this from a batch file and just execute the *.bat file from Jenkins?
The publish over ssh plugin allows you to run remote commands.
In Manage Jenkins > Configure System > Publish over SSH you need to configure the remote machine you want to deploy to. Click on Add and configure the connection to the server.
In the Job itself add a Build Step Send files or execute commands over SSH. Select from the drop down the SSH server you want to connect to. In the Exec command you can add all commands you want to have executed on the remote machine.