doutuobao4004 2015-03-11 01:42
浏览 179
已采纳

我的Jenkins是否从我的SCM构建结账?

Trying to understand this CI thing so I've downloaded Jenkins in my production server...

1. Is Jenkins (or any other CI system) installed in the production server or I should have a separate server for Jenkins builds? If Jenkins is in another server, how can I integrate the builds as my running production code? Or this CI thing does have nothing to do with deploys?

Then I created a SSH key at /var/lib/jenkins/.ssh added to my Bitbucket (Git) repository as Deployment key...

2. Is this the correct approach?

...And set the repository URL git@bitbucket.org:... with jenkins user credentials in the Git plugin at project settings. So far so good, my build checkout the project to the Jenkins workspace, then I noticed that every build it run is a checkout and for every checkout, as a Composer powered project, my vendors/ directory isn't there, so I don't have the autoload.php file that phpunit.xml uses as bootstrap to load the classes and run the tests. So besides phpunit as one of the build shell commands I've added composer init.

3. Is this right? Should I run composer init on every build?

The main question maybe is: are my builds constructed from greenfield space? Should I checkout and run composer install and whatever scripts my project must take to be running every time (every build)?

Thanks!

  • 写回答

2条回答 默认 最新

  • duankuaiwang2706 2015-03-11 03:05
    关注
    1. Is Jenkins (or any other CI system) installed in the production server or I should have a separate server for Jenkins builds? If Jenkins is in another server, how can I integrate the builds as my running production code? Or this CI thing does have nothing to do with deploys?

    Then I created a SSH key at /var/lib/jenkins/.ssh added to my Bitbucket >(Git) repository as Deployment key...

    1. Is this the correct approach?

    That's correct. I have a bunch of servers configured this way. In the near future I want investigate if it would be possible to use the SSH Credentials Plugin to store my credentials there, so that I don't have to take care with the file system permissions for that key.

    1. Is this right? Should I run composer init on every build?

    The main question maybe is: are my builds constructed from greenfield space? Should I checkout and run composer install and whatever scripts my project must take to be running every time (every build)?

    It depends on your requirements. You can have several builds, or parametrize you build to support different behaviours. For instance, I have Laravel builds that depending on the environment parameter, they might do further testing with Selenium, or simply run phpunit.

    I usually have two projects in Jenkins for each PHP application. One that checks out the code from git, clean any left-over of other builds in the workspace, and invokes Laravel's Envoy for building the project. What it basically does, is call composer install with some extra parameters, and call the migration and database seed routines to prepare the application for testing.

    The other job is triggered when I promote (with Jenkins Promoted Builds Plugin) a build, and it copies (with the Copy Artifacts Plugin) the workspace created during build and already tested, and deploys it via scp to a folder in a QA server. It then updates some symbolic links, and finally it's ready to test.

    With time and more requirements from developers and other teams, you'll get familiar with many other plug-ins, like the Email-ext Plug-in, to send custom notifications and include further information about the build.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用