[GSoC] Gitlab support in Packit-Service (Fedora)

Hi! I have been working on adding support of packit-service on GitLab, and this is my final report/work.

Description

The goal of the project is to make packit-service work on GitLab, so that it can process events from GitLab and return feedback of successful builds or failed tests back into the merge request.

Workings and Deployment

Packit Service now supports copr-build on GitLab🎉

  • I worked on GitLab authentication workflow where you get unique token for your project to authenticate with packit. In the later part of the blog I have shown the working of it.
  1. Build status as commit status when packit-user has the project access.

Here I will show how to use packit-service on GitLab.

In this example, I have cloned the ogr repository from github to shreyaspapi/ogr.

Adding webhook to your project

Now in order to send events to packit-service we need to setup webhook for the project by going to Settings -> Webhooks

Here, I am using my own packit instance (URL will be https://prod.packit.dev/api/webhooks/gitlab).

Select the triggers (with minimum trigger permissions of Push events, Comments, Issue events, Merge request events) and Enable SSL verification than add webhook.

Now after adding the webhook, packit will create a confidential issue in the repository.

Confidential issue created by packit-service

Only users with the right access to the project will be able to see the confidential issues.

Follow the steps from the issue description by adding the unique secret token sent by packit for your repository. Edit the webhook setting you added earlier with the secret token written in the issue.

Now for packit to send build status to your merge requests you will need to give admin access to the packit user defined in the issue.

You need to add packit config file to your repository to know more about it click here.

To check if Packit Service works in your project, create a merge request, Packit Service builds the code from the merge request in COPR repository and reports back COPR build status to the merge request.

Here is an example of the merge request build status -

https://gitlab.com/shreyaspapi/ogr/-/merge_requests/1

Currently, GitLab only supports copr-build.

To retrigger the build you can comment to merge request as

/packit copr-build

Now, here is another example of how Packit Service will send build status to merge request when packit (user) does not have the permission to the repository https://gitlab.com/shreyaspapi/ogr/-/merge_requests/2.

Work Achieved

  • Packit-service can now parse GitLab events #629

That’s it for now!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store