pagure_ci_jenkins.rst 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. Jenkins with Pagure-ci
  2. ======================
  3. Jenkins is a Continuous Integration service that can be configured to be
  4. integrated with pagure.
  5. This document describe the steps needed to make it work.
  6. How to enable Pagure CI
  7. -----------------------
  8. * Visit the settings page of your project
  9. * Scroll down to the `Hooks` section and click on `Pagure CI`
  10. * Select the type of CI service you want
  11. * Enter the URL to the project on the CI service. For example, if your
  12. project is running at `http://jenkins.fedoraproject.org` you will need to
  13. enter the url: `http://jenkins.fedoraproject.org/job/<projectname>`
  14. * Tick the checkbox activating the hook.
  15. These steps will activate the hook, after reloading the page or the tab, you
  16. will be given access to two important values: the token used to trigger the
  17. build on jenkins and the URL used by jenkins to report the status of the
  18. build.
  19. Keep these two available when configuring jenkins for your project.
  20. Configure Jenkins
  21. -----------------
  22. These steps can only be made by the admins of your jenkins instance, but
  23. they only need to be made once.
  24. * Download the following plugins:
  25. * `Git Plugin <https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin>`_
  26. * `Notification Plugin <https://wiki.jenkins-ci.org/display/JENKINS/Notification+Plugin>`_
  27. Configure your project on Jenkins
  28. ---------------------------------
  29. * Go to the `Configure` page of your project
  30. * Under `Job Notification` click `Add Endpoint`
  31. * Fields in Endpoint will be :
  32. ::
  33. FORMAT: JSON
  34. PROTOCOL: HTTP
  35. EVENT: Job Finalized
  36. URL: <The URL provided in the Pagure CI hook on pagure>
  37. TIMEOUT: 3000
  38. LOG: 1
  39. * Tick the checkbox `This build is parameterized`
  40. * Add two `String Parameters` named REPO and BRANCH
  41. * Source Code Management select Git and give the URL of the pagure project
  42. * Under Build Trigger click on Trigger build remotely and specify the token
  43. given by pagure.
  44. * Under Build -> Add build step -> Execute Shell
  45. * In the box given enter the shell steps you want for testing your project.
  46. Example Script
  47. ::
  48. # Script specific for Pull-Request build
  49. if [ -n "$REPO" -a -n "$BRANCH" ]; then
  50. git remote rm proposed || true
  51. git remote add proposed "$REPO"
  52. git fetch proposed
  53. git checkout origin/master
  54. git config --global user.email "you@example.com"
  55. git config --global user.name "Your Name"
  56. git merge --no-ff "proposed/$BRANCH" -m "Merge PR"
  57. fi
  58. # Part of the script specific to how you run the tests on your project