Run batch scripts on a remote server (windows) from jenkins

后端 未结 3 2042
自闭症患者
自闭症患者 2020-12-13 09:58

I\'ve got a continuous integration server (Jenkins ) which builds my code (checks for compilation errors) and runs tests and then deploys the files to a remote server (not a

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-13 10:38

    If Jenkins on Windows, remote on *nix, use plink.exe (which is essentially command line PuTTy)

    If Jenkins on Windows, remote on Window, use psexec.exe

    If Jenkins on *nix, remote on *nix, use ssh

    If Jenkins on *nix, remote on Windows, (update 2015-01) Ansible http://docs.ansible.com/intro_windows.html has support for calling Windows commands, eg powershell, from a unix/linux machine, https://github.com/ansible/ansible-examples/blob/master/windows/run-powershell.yml

    Tell me what OSes are involved (both on Jenkins and remote), and I will flash this out further.

    Edit:
    The download page for psexec.exe lists all command line options. You will want something along the lines of:

    psexec \\remotecomputername -u remoteusername -p remotepassword cmd /c
    Replace with actual commands as you would execute them from command prompt.

    Note that psexec first needs to install a service, and required elevated command prompt/admin remote credentials to do so.
    Also, you need to run psexec -accepteula once to accept the EULA prompt.

提交回复
热议问题