我需要在 Jenkins 中设置构建配置,以便每当触发构建时,我都会从 Gitlab 获取最新的脚本并将它们复制到目标系统并在目标上运行该脚本。
我找不到任何将 Gitlab 集成到 Jenkins 的相关信息。有我可以使用的特定插件吗?
我使用的是 Jenkins 版本 2.158
执行您要查找的操作的分步过程:
- Add the location of the Script from GitLAB. (E.g.)
- 在目标机器上运行脚本。
构建作业时,您将在作业工作区的根目录 (./) 中获取代码。在目标计算机上复制并运行脚本可以通过远程脚本执行来完成。以下是我们在远程计算机上运行脚本的情况
- Windows (jenkins) 到 windows - 使用执行程序 http://technet.microsoft.com/en-ca/sysinternals/bb897553.aspx
- Windows (Jenkins) 到 Linux - 使用执行程序 https://superuser.com/a/1340922/590517这是命令行腻子
- Linux (Jenkins) 到 linux - 使用SCP https://linuxize.com/post/how-to-use-scp-command-to-securely-transfer-files/ and SSH https://www.cnet.com/news/ssh-tip-send-commands-remotely/
- Linux 到 Windows - 使用适用于 Windows 的 https://github.com/ansible/ansible-examples/blob/master/windows/run-powershell.yml.
E.g,.
$ scp script.sh [email protected] /cdn-cgi/l/email-protection:/remote/directory
$ ssh -t [email protected] /cdn-cgi/l/email-protection /remote/directory/script.sh
一切顺利。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)