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 987edf
    PAGURE_CONFIG=/path/to/config PYTHONPATH=. python pagure-ci/pagure_ci_server.py
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
Pierre-Yves Chibon 987edf
Configure Jenkins
Pierre-Yves Chibon 987edf
=================
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
Pierre-Yves Chibon 987edf
  * Build Authorization Root Plugin
Pierre-Yves Chibon 987edf
  * `Git Plugin <https: display="" git+plugin="" jenkins="" wiki.jenkins-ci.org="">`_</https:>
Pierre-Yves Chibon 987edf
  * `Notification Plugin <https: display="" jenkins="" notification+plugin="" wiki.jenkins-ci.org="">`_</https:>
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
Pierre-Yves Chibon 987edf
Configure your project on Jenkins
Pierre-Yves Chibon 987edf
=================================
farhaanbukhsh 3f88c9
Pierre-Yves Chibon 987edf
* Start by enabling the `Pagure CI` hook in the settings of your project on
Pierre-Yves Chibon 987edf
  pagure. This will provide you two values needed to configure your project
Pierre-Yves Chibon 987edf
  on jenkins: a token and an URL that jenkins calls to return the results
Pierre-Yves Chibon 987edf
  of a build.
farhaanbukhsh 3f88c9
Pierre-Yves Chibon 987edf
* Go to the `Configure` page of your project
farhaanbukhsh 3f88c9
Pierre-Yves Chibon 987edf
* Under `Job Notification`  click `Add Endpoint`
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
* Fields in Endpoint will be :
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
::
farhaanbukhsh 3f88c9
Pierre-Yves Chibon 987edf
    FORMAT: JSON
Pierre-Yves Chibon 987edf
    PROTOCOL: HTTP
Pierre-Yves Chibon 987edf
    EVENT: Job Finalized
Pierre-Yves Chibon 987edf
    URL: <the ci="" hook="" in="" on="" pagure="" provided="" the="" url=""></the>
Pierre-Yves Chibon 987edf
    TIMEOUT: 3000
Pierre-Yves Chibon 987edf
    LOG: 1
farhaanbukhsh 3f88c9
Pierre-Yves Chibon 987edf
* Tick the checkbox `This build is parameterized`
farhaanbukhsh 3f88c9
Pierre-Yves Chibon 987edf
* Add two `String Parameters` named REPO and BRANCH
farhaanbukhsh 3f88c9
farhaanbukhsh 3f88c9
* Source Code Management select Git  and give the URL of the pagure project
farhaanbukhsh 3f88c9
Pierre-Yves Chibon 987edf
* Under Build Trigger click on Trigger build remotely and specify the token
Pierre-Yves Chibon 987edf
  given by pagure.
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
Pierre-Yves Chibon 987edf
    # Script specific for Pull-Request build
Pierre-Yves Chibon 987edf
    if [ -n "$REPO" -a -n "$BRANCH" ]; then
Pierre-Yves Chibon 987edf
    git remote rm proposed || true
Pierre-Yves Chibon 987edf
    git remote add proposed "$REPO"
Pierre-Yves Chibon 987edf
    git fetch proposed
Pierre-Yves Chibon 987edf
    git checkout origin/master
Pierre-Yves Chibon 987edf
    git config --global user.email "you@example.com"
Pierre-Yves Chibon 987edf
    git config --global user.name "Your Name"
Pierre-Yves Chibon 987edf
    git merge --no-ff "proposed/$BRANCH" -m "Merge PR"
Pierre-Yves Chibon 987edf
    fi
Pierre-Yves Chibon 987edf
    
Pierre-Yves Chibon 987edf
    # Part of the script specific to how you run the tests on your project