Hacking on Pagure CI
3 min read
“Ahaa!” I got a lot of ahaa moments when I was hacking on Pagure CI , Pagure CI’s initial draft was laid by lsedlar and I have blogged about it followed by me and Pingou. Pingou has done really amazing work with the flow and refactoring of code to making beautiful api calls.
I had great time hacking around it and got a bunch of learning. Few of the learning are :
- Try to do the minimal work in setting up the development environment mock everything that is available for testing.
- Think deeply about something when your mentor points it to you.
So the issue I was working on is a long pending one the issue was to attach build ID to all the Jenkins build Pagure was getting . Reason why attaching build id’s are necessary is to distinguish between different builds and to make the link to Jenkins a bit more specific for example if a build fail which was that build.
The first mistake I did was setting up Jenkins on my machine I had it previously but since my machine went under a kernel panic I lost all data related to Jenkins , now Fedora 25 has some packaging issue when installing Jenkins directly. But anyhow from Jenkins site I got a way to set it up and it worked for me. In the mean while Pingou was pointing it out that I actually don’t need Jenkins instance but I was not able to get him on that and I really feel bad about it.
After setting up Jenkins the other task for me was to configure it , which was really easy because I have done it before and also because it was well documented. For setting up the documentation is fine but for hacking on the CI you need a little less work.
REDIS on your machine , you can do that with installing redis using
sudo dnf install redis and enable the service using
sudo systemctl enable redis and then start the service using
sudo systemctl start redis. Along with this you need to add config for
default_config.py or which ever config file you are giving to the server using
--config. The configuration are well documented in
Now, copy the
pagure-ci directory into the parent directory. Now once you have done that , this step is necessary because this is the service that run for
pagure-ci. Now you just have to run
python pagure-ci-server.py. Once this started your service will be up and running.
Now you just fire up your instance and make a project , have two branches and open a PR form once branch to other, if you get some authentication error that is most probably because you not done the right permission for users to use Jenkins, this is not recommended but you can entirely turn off the
security of Jenkins just because you are testing something.
If you have done everything correct you will see the Jenkins flag being attached to the Pull Request.
VERY IMPORTANT NOTE:
All this could be saved if I have just used
python-jenkins to fetch a job from Fedora Jenkins instance and send it as a flag to my PR. Thank you Pingou for telling me this hack.
Did you find this article valuable?
Support Farhaan Bukhsh by becoming a sponsor. Any amount is appreciated!