Blame pagure-ci/README.rst

farhaanbukhsh 3f88c9
Pagure CI
farhaanbukhsh 3f88c9
=========
farhaanbukhsh 3f88c9
farhaanbukhsh 52f61f
This is to setup Pagure CI for development. It is assumed that all the
Pierre-Yves Chibon 1ed98c
dependencies are resolved.
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
 * Run::
farhaanbukhsh 3f88c9
Pierre-Yves Chibon 1ed98c
        PAGURE_CONFIG=/path/to/config python pagure-ci/pagure_ci_server.py
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
Configuring Jenkins
farhaanbukhsh 3f88c9
===================
farhaanbukhsh 3f88c9
farhaanbukhsh 52f61f
Jenkins configuration is the most important part of how the Pagure CI works,
farhaanbukhsh 52f61f
after you login to your Jenkins Instance.
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
farhaanbukhsh 52f61f
* Go to Manage Jenkins -> Configuire Global Security and under that select
farhaanbukhsh 52f61f
  'Project-based Matrix Authorization Strategy'
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
* Add a user and give all the permission to that user.
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
* Download the following plugins:
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
::
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
      Build Authorization Root Plugin
farhaanbukhsh 3f88c9
      Git Plugins
farhaanbukhsh 3f88c9
      Notification Plugin
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
* Click on the New Item
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
* Select Freestyle Project
farhaanbukhsh 3f88c9
farhaanbukhsh 52f61f
* Click OK and enter the name of the project, make sure the project name you
farhaanbukhsh 52f61f
  filled in the Pagure CI form should match the name you entered here.
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
* Under 'Job Notification'  click 'Add Endpoint'
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
* Fields in Endpoint will be :
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
::
farhaanbukhsh 3f88c9
Pierre-Yves Chibon 1ed98c
        FORMAT: JSON
Pierre-Yves Chibon 1ed98c
        PROTOCOL: HTTP
Pierre-Yves Chibon 1ed98c
        EVENT: Job Finalized
Pierre-Yves Chibon 1ed98c
        URL: <the form="" jenkins="" post="" returned="" that="" url=""></the>
Pierre-Yves Chibon 1ed98c
        TIMEOUT: 3000
Pierre-Yves Chibon 1ed98c
        LOG: 1
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
* Tick the build is parameterized
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
* From the Add Parameter drop down select String Parameter
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
* Two string parameters need to be created REPO and BRANCH
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
* Source Code Management select Git  and give the URL of the pagure project
farhaanbukhsh 3f88c9
farhaanbukhsh 52f61f
* Under Build Trigger click on Trigger build remotely and give the same token
farhaanbukhsh 52f61f
  that you gave in the Pagure CI form.
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
* Under Build -> Add build step -> Execute Shell
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
* In the box given  enter the shell steps you want for testing your project.
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
Example Script
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
::
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
        if [ -n "$REPO" -a -n "$BRANCH" ]; then
farhaanbukhsh 3f88c9
        git remote rm proposed || true
farhaanbukhsh 3f88c9
        git remote add proposed "$REPO"
farhaanbukhsh 3f88c9
        git fetch proposed
farhaanbukhsh 3f88c9
        git checkout origin/master
farhaanbukhsh 3f88c9
        git config --global user.email "you@example.com"
farhaanbukhsh 3f88c9
        git config --global user.name "Your Name"
farhaanbukhsh 3f88c9
        git merge --no-ff "proposed/$BRANCH" -m "Merge PR"
farhaanbukhsh 3f88c9
        fi
farhaanbukhsh 3f88c9
farhaanbukhsh 52f61f
* After all the configuration done, go to the dev instance of pagure running
farhaanbukhsh 52f61f
  and under project settings in `Plugin` select Pagure CI and fill the appropriate
farhaanbukhsh 52f61f
  information. Which on submiting should give you a POST url.
farhaanbukhsh 3f88c9
farhaanbukhsh 52f61f
* Copy and paste the URL in the Notification section under the Jenkins project
Pierre-Yves Chibon 1ed98c
  you want the CI to work.