#79 Add a jenkins hook
Closed: Fixed Opened by pingou.

It would be cool if after pushing we could automatically trigger a build on a jenkins.

This implies knowing the project on jenkins and storing a jenkins api key as well as knowing where the jenkins instance is running.


Thinking about it, I'm seeing:

  • An async server/service
  • A small DB to keep the info mentioned above
  • An API to add/remove projects
  • A pagure plugin making the call to the API of the service to add/remove the project and install the git hook
  • A git hook calling the API of the service after a push

The idea is:

  • I enable the plugin in the project's settings
    --> this registers the project to the service and install the git hook
  • I push some changes
    --> The git hook calls the API of the service
  • The service starts a build on jenkins
  • Every X secondes the service check the status of the build
  • When build reaches completion, the service adds a comment to the PR

And there is the question: how does the service know about the PR? -> So we need another approach than the git hook --> Maybe send a redis message when we check the status of the PR?

Sounds complex but its really cool , I would like to work on it :smile:

For the async services we have (webhooks and the event-source server) we're using aiohttp, if you want to look into it :)

It is actually very easy to build pushed branches – you can configure Jenkins to poll Git regularly and build new commits.

For the pull requests it is slighly more involved, but still quite doable. I have put together a somewhat hacky service that listens to fedmsg and triggers builds for pull requests and comments on them with the result.

It is actually very easy to build pushed branches – you can configure Jenkins to poll Git regularly and build new commits.

My idea for this was to automatically trigger the build via a git hook after the push, without having to wait for the automatic build

Let me check your blog post for the poor-man-ci, but thanks for looking into it! :)

As far as I could tell, Pagure does not send a separate message when pull request is updated or rebased. It does however add a comment with this information.

I kinda does now, look for PR comment where notification=True for example: https://apps.fedoraproject.org/datagrepper/id?id=2016-07a8d7f6-84c7-4998-b1a7-43c6ab2db5d1&is_raw=true&size=extra-large

Finally the last part is to post a comment to Pagure. This is really trivial, just submit an HTTP POST request.

You could add a flag instead of a comment :)
https://pagure.io/api/0/#pull-requests Check the Flag a pull-request

Two thing I envisioned differently are:

  • the 'use fedmsg to know when the build finished', I was thinking to just query jenkins' API regularly to know the status of the build, allowing the approach to be a little more generic/flexible than our (almost custom) setup

  • Maybe support both fedmsg and webhook notifications to be aware of changes to PRs

PS: but I clearly loving this :)

PS: but I clearly loving this :)

Me too ^^

This is done ;) isn't it ?

I believe @farhaan is right, this is now fully working :)

@pingou changed the status to Closed

Metadata