Jenkins - how to deploy folder/file from Jenkins Linux agent to the Windows server?

Viewed 386

After the build is finished I am getting as result built folder with files. I need to copy them to remote windows server. I tried to use "Publish Over FTP" Plugin but it seems that "This plugin is up for adoption". So based on the corporate policy this cannot be installed. https://plugins.jenkins.io/publish-over-ftp/ I also tried to use WinRMClient but I am having issue to run that Plugin because I run powershell in Docker Alpine and it cannot run powershell script. I described that issue here: Jenkins - cannot run WinRMClient Plugin with Powershell command

I am running out of options. Can you please suggest me solution how I could copy the folder or file to remote windows server using some Plugin or some other method? THANK YOU!!!

My build job is being run on Linux agent (alpine docker image). I suppose this is relevant.

Thanks a lot for your help!

1 Answers

I have used mounted folder to share files between Linux Jenkins master and Windows storage server. These are the commands executed on the Linux machine (Ubuntu in my case).

sudo apt-get install cifs-utils
mkdir ~/windows-share-migration-on-linux
sudo mount.cifs //myIP/myWindowsSharedFolder/ ~/windows-share-migration-on-linux -o user=myusername,domain=mydomain,vers=3.0,uid=112,gid=1000

You can use samba as alternative:

yum install samba-client samba-common  -y
mount -t cifs -o username=user //IP/myshare /mnt/share

If you want the mount to survive a reboot you can change /etc/fstab.

References:
https://www.redhat.com/sysadmin/samba-windows-linux
Article that contains the cifs-utils commands above. I have written it myself for the purpose of Jenkins master migration.

Related