I'm pretty new to jenkins at the moment so i am trying to find my way around the possibilities Jenkins got. I'd would appreciate it if anyone can help me out with a specific situation explained in dummy language :)
Currently i am trying to find a way to automate a file transfer(a small job part of what i actually want) from my windows 7 environment to a'n linux server directory with the usage of Jenkins. I've read some possibilities about the usage of a SCP Plugin. Is there anyone that can lend me a hand an tell me how i can achieve this? Or at least give me a push in the right direction.
To make things a bit narrower: I am using windows batch commands in Jenkins to execute a VBscript file (A excel file which generates test data and extracts that as a .csv file). With again the usage of the windows batch command i can pick up that file and place it in a random location on my windows 7 environment. easily done. However, what i actually want, is that i can pick up that extracted .csv file and place it in a Linux server directory. An application we got installed on our Linux environment will continuesly poll for on a specified directory and process a file that is placed there. So long story short. I want to transfer a .csv file from my windows enviroment to already active Linux enviroment. And that with the usage of Jenkins to continuesly automate this proces.
Thanks in advance
There might indeed be a Jenkins plugin that could help with this. However, my approach would be to install an SCP client on the Windows machine, then create a Jenkins build that uses the SCP client to perform the file transfer.
The steps might resemble something like this:
If your Windows machine is your Jenkins master, just move on to the next step - but if your Jenkins master is another machine, first connect the Windows node to the master, if you haven't already done that.
On the Windows machine, install Git for Windows (which also provides scp, bash, and other useful commands):
During the Git install, when prompted, make sure to select the option to put all of the Unix utils into your PATH, so Jenkins can invoke the scp command.
If you try this and encounter problems afterward, there are many other approaches do doing this - but this approach is the easiest IMO, and you'll probably be able to make use of the Git package's utils in many other situations.
If you end up needing it, a list of alternative command-line ssh/scp clients for Windows is available at: http://www.openssh.com/windows.html (I recommend putty/pscp if you can't use the Git installer's scp for some reason.)
Execute Windows batch command
step.In the script editor, add your scp command:
scp path/to/your/file user@your-remote-host:remote/path/goes/here
Note that if the command doesn't return successfully, Jenkins will notice, and set the build status to failed.