|
farhaanbukhsh |
3f88c9 |
Pagure CI
|
|
farhaanbukhsh |
3f88c9 |
=========
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
52f61f |
This is to setup Pagure CI for development. It is assumed that all the
|
|
farhaanbukhsh |
52f61f |
dependencies are resolved. It is advised to use a virtual envivironment
|
|
farhaanbukhsh |
52f61f |
for development.
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
3f88c9 |
* Run::
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
3f88c9 |
python setup.py develop
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
3f88c9 |
Now in pagureCI/consumer.py add the following elements in `topic` list
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
3f88c9 |
::
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
3f88c9 |
'org.fedoraproject.dev.pagure.pull-request.new',
|
|
farhaanbukhsh |
3f88c9 |
'org.fedoraproject.dev.pagure.pull-request.comment.added',
|
|
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 |
|
|
farhaanbukhsh |
3f88c9 |
FORMAT: JSON
|
|
farhaanbukhsh |
3f88c9 |
PROTOCOL: HTTP
|
|
Farhaan Bukhsh |
5da92a |
EVENT: Job Finalized
|
|
farhaanbukhsh |
3f88c9 |
URL: <the form="" jenkins="" post="" returned="" that="" url=""></the>
|
|
farhaanbukhsh |
3f88c9 |
TIMEOUT: 3000
|
|
farhaanbukhsh |
3f88c9 |
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
|
|
farhaanbukhsh |
52f61f |
you want the CI to work,
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
3f88c9 |
Get It Running:
|
|
farhaanbukhsh |
3f88c9 |
===============
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
3f88c9 |
In one terminal window run:
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
3f88c9 |
::
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
3f88c9 |
fedmsg-relay
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
3f88c9 |
Another window:
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
3f88c9 |
::
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
3f88c9 |
fedmsg-hub
|
|
farhaanbukhsh |
3f88c9 |
|
|
farhaanbukhsh |
52f61f |
* Now clone the project locally and make a branch. make some changes and push it
|
|
farhaanbukhsh |
52f61f |
to the repo and try to make a PR. You will notice if everything works fine a lot
|
|
farhaanbukhsh |
52f61f |
of logs in the server console and `build fail` flag on the PR.
|
|
farhaanbukhsh |
52f61f |
Build fail because there is no git server running.
|