简体   繁体   English

Jenkins和Bitbucket集成

[英]Jenkins and Bitbucket integration

I want to setup Jenkins job which will do following task. 我想设置詹金斯工作,它将完成以下任务。

  1. Pull code from Git repositories which resides on Bitbucket. 从驻留在Bitbucket上的Git存储库中提取代码。 I have repository URL and login credentials for the same repository. 我具有同一存储库的存储库URL和登录凭据。 I am not the repository's admin. 我不是存储库的管理员。 I don't want to create any hooks for the repository. 我不想为存储库创建任何钩子。
  2. Build this code with existing ant script along with test execution. 使用现有的ant脚本以及测试执行来构建此代码。
  3. Deploy on server if the build is successful. 如果构建成功,则在服务器上部署。

I am stuck at task 1: pull code from repository. 我陷入了任务1:从存储库中提取代码。 I need help to solve this. 我需要帮助解决此问题。 On the Jenkins side, I am using Git plugin. 在詹金斯方面,我正在使用Git插件。

To pull code from Bitbucket repository, you need: 要从Bitbucket存储库中提取代码,您需要:

Step 1: Make sure you have Git Plugin installed. 第1步:确保已安装Git插件。 If not, you can install from Manage Jenkins->Manage Plugins->Avaliable 如果没有,您可以从Manage Jenkins->Manage Plugins->Avaliable安装

Step 2: use ssh-keygen to generate a ssh key pair and upload your ssh public key to Bitbucket site so that your machine can communicate with Bitbucket server(If you already done this, then please see Step 3 directly.) 第2步:使用ssh-keygen生成ssh密钥对,并将ssh公钥上载到Bitbucket站点,以便您的计算机可以与Bitbucket服务器进行通信(如果已完成此操作,请直接参阅第3步。)

Step 3: Create a job, from its configuration page, Under Source Code Management choose git , and put your repo address of Bitbucket into the Repository URL 步骤3:在其配置页面上的Job创建一个作业,在Source Code Management选择git ,然后将您的Bitbucket的回购地址放入Repository URL

Save the job, and click the Build Now , it should work. 保存作业,然后单击“ Build Now ,它应该可以工作。

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

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