I am new to CI and would like your thoughts and input on how to go about my problem. I would like to first start off that I have been wrestling with this for 2 days(and I don't have that much background in sys ad) so please play nice?(I am mainly a front-end web dev) :)
Basically my plan was to install jenkins then make a CI env with these steps:
- poll for any changes to github
- if there are, run the build script: a. migrate the development and test dbs?(does that mean i have to put the config/database.yml in my repo?) b. run cucumber c. if all tests pass go to 3, else fail
- run any rake setup stuff
- run the server(deploy)
I have done some of the stuff by cheating:
- in my local, i switch my rvm to the correct one i need(rvm use 1.8.7-p174@mygemset)
- run jenkins(java -jar jenkins.war) so that it gets the RVM ruby as default
- run spork 开发者_开发知识库in a separate terminal(because for some reason my cucumbers don't run without spork - that's another problem)
- build the project manually by clicking Build
so basically, I want to automate these stuff. Maybe what I need is a set of steps to follow(general or specific, depending on your taste) so I can setup my CI up and running.
Keep in mind that my "cheats" won't do as I want to test different projects with different setups and the startup cheat just won't do. Currently, my project build was successful because all I did was to run cucumber(and all my cukes pass). I want it to be able to deploy after it passes so maybe some help there also? Thanks
Okay I will try and help you as best I can.
- poll for any changes to github
This can be easily done with the Github Plugin located here
- if there are, run the build script: a. migrate the development and test dbs?(does that mean i have to put the config/database.yml in my repo?) b. run cucumber c. if all tests pass go to 3, else fail
Then all you would is run the build script you have configure in the in the build from
Select "Add Build Step" -> "Execute shell".
You can either do that which is probably what I would do because when you create build you want them to be portable so you can start up in new jenkins instances, so you dont have to setup your build machine, with build specific files.
Then you run your tests, if they fail the build should fail regardless here is some information on running ruby on rails tests. if you need to manually fail a build in a script based on a result usually exiting a script with non-zero will fail the build. If not continue and run your rake and deployment scripts.
Just a few notes on Jenkins it wont do everything for you but if you can do it manaually Jenkins can automate it. So anything you have setup running manually with a little bit of effort you can get up and running automated with Jenkins
Here is another answer you might find helpful in your general setup and ideology behind Jenkins.
Goodluck!
精彩评论