简体   繁体   English

如何配置 Jenkins,从本地运行代码到从机?

[英]How to configure Jenkins, running code from Local to slave machine?

I have a project in Java and I also used Gradle and TestNG .我在Java有一个项目,我还使用了 GradleTestNG It works perfectly without jenkins.它在没有 jenkins 的情况下完美运行。

After that I configured Jenkins and now I can run the code with Gradle command in Jenkins on my Local .之后,我配置了 Jenkins ,现在我可以在我的Local上的 Jenkins 中使用 Gradle 命令运行代码。

Then I tried to run the code on Slave machine.然后我尝试在从机上运行代码。 I can see the Slave machine in Jenkins nodes.我可以在 Jenkins 节点中看到从机。 I also configured Gradle and Java to run on Slave machine.我还配置了 GradleJava在从机上运行。 I have to mention that I don't use Version Control in this project.不得不提的是,我在这个项目中没有使用版本控制。

When I start the job in Jenkins to run on Slave machine, it starts the job but the problem is, it cannot find for example the gradle.build , as it's located in my Local machine and not in Slave machine.当我在 Jenkins 中开始工作以在从属机器上运行时,它会开始工作,但问题是,它找不到例如gradle.build ,因为它位于我的本地机器中而不是从属机器中。

The question is, should I use Version Control ?问题是,我应该使用版本控制吗? is it going to solve the problem?它会解决问题吗? or should I use Copy Artifact Plugin ?还是我应该使用Copy Artifact Plugin

Complementary Question: If I make a local git for my network on the same machine that runs Jenkins, it is going to be a problem?补充问题:如果我在运行 Jenkins 的同一台机器上为我的网络制作本地 git,这会是个问题吗?

Thanks for your help:)谢谢你的帮助:)

Slave machine need your file gradle.build , so either place it there manually by SFTP.从机需要您的文件gradle.build ,所以要么通过 SFTP 手动将其放置在那里。 If your gradle.build going to change regularly then its prefer to use version control like git by which jenkins will fetch the latest files.如果您的gradle.build会定期更改,那么它更喜欢使用 git 之类的版本控制,通过 jenkins 将获取最新文件。

Again its not mandatory but recommended to use version control like git to prevent from unnecessary errors同样它不是强制性的,但建议使用 git 之类的版本控制来防止不必要的错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM