README.rst 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. Pagure CI
  2. =========
  3. This is to setup Pagure CI for development. It is assumed that all the
  4. dependencies are resolved. It is advised to use a virtual envivironment
  5. for development.
  6. * Run::
  7. python setup.py develop
  8. Now in pagureCI/consumer.py add the following elements in `topic` list
  9. ::
  10. 'org.fedoraproject.dev.pagure.pull-request.new',
  11. 'org.fedoraproject.dev.pagure.pull-request.comment.added',
  12. Configuring Jenkins
  13. ===================
  14. Jenkins configuration is the most important part of how the Pagure CI works,
  15. after you login to your Jenkins Instance.
  16. * Go to Manage Jenkins -> Configuire Global Security and under that select
  17. 'Project-based Matrix Authorization Strategy'
  18. * Add a user and give all the permission to that user.
  19. * Download the following plugins:
  20. ::
  21. Build Authorization Root Plugin
  22. Git Plugins
  23. Notification Plugin
  24. * Click on the New Item
  25. * Select Freestyle Project
  26. * Click OK and enter the name of the project, make sure the project name you
  27. filled in the Pagure CI form should match the name you entered here.
  28. * Under 'Job Notification' click 'Add Endpoint'
  29. * Fields in Endpoint will be :
  30. ::
  31. FORMAT: JSON
  32. PROTOCOL: HTTP
  33. EVENT: Job Finalized
  34. URL: <The POST URL that Jenkins form returned>
  35. TIMEOUT: 3000
  36. LOG: 1
  37. * Tick the build is parameterized
  38. * From the Add Parameter drop down select String Parameter
  39. * Two string parameters need to be created REPO and BRANCH
  40. * Source Code Management select Git and give the URL of the pagure project
  41. * Under Build Trigger click on Trigger build remotely and give the same token
  42. that you gave in the Pagure CI form.
  43. * Under Build -> Add build step -> Execute Shell
  44. * In the box given enter the shell steps you want for testing your project.
  45. Example Script
  46. ::
  47. if [ -n "$REPO" -a -n "$BRANCH" ]; then
  48. git remote rm proposed || true
  49. git remote add proposed "$REPO"
  50. git fetch proposed
  51. git checkout origin/master
  52. git config --global user.email "you@example.com"
  53. git config --global user.name "Your Name"
  54. git merge --no-ff "proposed/$BRANCH" -m "Merge PR"
  55. fi
  56. * After all the configuration done, go to the dev instance of pagure running
  57. and under project settings in `Plugin` select Pagure CI and fill the appropriate
  58. information. Which on submiting should give you a POST url.
  59. * Copy and paste the URL in the Notification section under the Jenkins project
  60. you want the CI to work,
  61. Get It Running:
  62. ===============
  63. In one terminal window run:
  64. ::
  65. fedmsg-relay
  66. Another window:
  67. ::
  68. fedmsg-hub
  69. * Now clone the project locally and make a branch. make some changes and push it
  70. to the repo and try to make a PR. You will notice if everything works fine a lot
  71. of logs in the server console and `build fail` flag on the PR.
  72. Build fail because there is no git server running.