简体   繁体   English

詹金斯和github

[英]Jenkins and github

I have a jenkins server with the github plugin to trigger every time a change is made to the repo. 我有一个带有github插件的jenkins服务器,每次对存储库进行更改时都会触发。 I have the private key and the public key loaded into the github repo. 我将私钥和公钥加载到github存储库中。 The job is configured as: Repository URL git@github.com:xxx/repo.git 作业配置为:存储库URL git@github.com:xxx / repo.git

I didn't enter the URL in the top part of the job. 我没有在工作的顶部输入URL。 One of the tasks I have Jenkins do is: cd /var/www/html/ && git pull origin master But whenever I make a change to the repo it is not being triggered and I don't know why. 我让詹金斯(Jenkins)执行的任务之一是:cd / var / www / html / && git pull origin master但是,每当我对存储库进行更改时,它都不会被触发,而且我也不知道为什么。

When I run the build manually I get: [Unit_Test] $ /bin/sh -xe /tmp/hudson1951363618156731736.sh + cd /var/www/html/ + git pull origin master ERROR: Repository not found. 当我手动运行构建时,我得到:[Unit_Test] $ / bin / sh -xe /tmp/hudson1951363618156731736.sh + cd / var / www / html / + git pull origin master错误:找不到存储库。 fatal: Could not read from remote repository. 致命:无法从远程存储库读取。

Please make sure you have the correct access rights and the repository exists. 请确保您具有正确的访问权限,并且存储库存在。 Build step 'Execute shell' marked build as failure Email was triggered for: Failure - Any Sending email for trigger: Failure - Any Sending email to: xx@xx.com Finished: FAILURE 构建步骤“执行外壳”将构建标记为失败触发了以下电子邮件:失败-任何发送触发器电子邮件:失败-任何发送电子邮件至:xx@xx.com已完成:失败

Don't just use Jenkins as a shell script executor: 不要仅仅将Jenkins用作shell脚本执行器:

  • Use the Git plugin and configure it correctly. 使用Git插件并正确配置。 With this you should be able to pull code 有了这个,您应该能够提取代码
  • Use the GitHub plugin and check the Build when a change is pushed to GitHub and add the hook to your repo on GitHub so Jenkins gets notified whenever a change is pushed 使用GitHub插件并Build when a change is pushed to GitHub检查Build when a change is pushed to GitHub并将钩子添加Build when a change is pushed to GitHub的存储库中,以便每当推送更改时Jenkins都会收到通知
  • Under the point Pre Steps add Execute shell and prepare the environment for the actual build Pre Steps添加Execute shell并为实际构建准备环境

必须添加带有* * * * *的轮询才能使其正常工作。

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

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