Giter Club home page Giter Club logo

gitlab-puppet-webhook's Introduction

Gitlab Puppet Webhook

An open source gitlab hook used to update puppet environments using r10k with legacy support for a single repo after receiving a gitlab push notification.


Concept

This application expects you to be using R10K to sync your puppet environments. It receives a Gitlab webhook post and acts on the relevant R10K environment(s) as well as looking for commit messages which may relate to Footprints ticketing system or the OTRS ticketing system and attempting to update the tickets based on the commit message.

Operations are all logged to /var/log/webhook-puppet.log by default. In order for this to work the user that is running the HTTP server must have its SSH Key listed as a 'deploy' key on all of the repos that it will need to clone, and must have SSL certificates.

If you enable multimaster mode, this python app can attempt to SSH as the user its running as to the specified servers, and launch R10k on the remote servers this is a poor mans version of the Puppet Enterprise "Compile Master" functionality it's not a replacement, but it's good enough for our purposes.


Multimaster Support

You can specify a list of comma seperated IP's/DNS names the webhook will attempt to SSH as the user that it is running as to each server listed and run the same R10k command that it ran on the local server. The assumption is made that R10k and everything is identical on all servers as there is no way to specify an alternative command per server.

This module does not take care of, or account for the requirements of access between the two servers though it's expected that you would use a passwordless ssh key restricted to the "MoM" ip address and the exact R10k command.


E-mail to Ticket system support

The webhook can cause specially formatted e-mails to be sent to the configured location currently Footprints is the only ticketing system supported, with full OTRS support coming soon.

Relevent configuration options are as follows

[email] method - Determines when e-mail's are sent to the ticket system [email] from - the FROM: address for e-mails

Footprints related configuration options

[footprints] project - Workspace # in footprints [footprints] to - the TO: address for e-mails [footprints] closed_status - Status that tickets should be set to if "FIX #[TICKETID]" is found in commit message

OTRS configuration settings are listed under [otrs]


gitlab-puppet-webhook

Starts up a proper linux Daemon that is listening on TCP 7010 for incoming Gitlab JSON. Can be started and stopped with the included startup scripts

Required Modules

Almost all imported modules should be part of the core Python 2.7 install, the following additional modules may need to be installed

  • python-daemon
  • slackweb
  • psutil

Installing on Centos6

yum -y install python-pip

pip install --upgrade python-daemon

Installing with Puppet

Use the Puppetforge Module vollmerk/gitlabr10khook https://forge.puppet.com/vollmerk/gitlabr10khook/readme

mod 'vollmerk-gitlabr10khook'

In your Puppetfile

Startup Scripts

Currently only SysVinitD scripts are included, you will need to modify the path to your script before the init.d script will work properly

gitlab-puppet-webhook's People

Contributors

vollmerk avatar

Stargazers

 avatar

Watchers

 avatar  avatar

gitlab-puppet-webhook's Issues

Add ability to trigger R10k runs on remote hosts

Ah-la filesync in the paid version of puppet, we want to be able to have a single webhook, that then ensures that all of your masters end up with the same code... could do this with R10k as that also gives you the heira, or just kick some type of file-push mechanism... not sure how to handle this really.

Add OTRS agent-note functionality

Make it so that the commit messages can be sent to OTRS, and show up as note-internal correctly, see below for more information

Followups are when a user mails an email. you will want to set the header : set this field :X-OTRS-FollowUp-ArticleType

see the code : ArticleType => $GetParam{'X-OTRS-FollowUp-ArticleType'}, http://tesisitil.googlecode.com/svn/trunk/trunk/otrs-2.4.5/Kernel/System/PostMaster/FollowUp.pm

see also : http://forums.otterhub.org/viewtopic.php?f=61&t=4966

Implement R10K with 'legacy' support

Implement R10K sync support, but maintain legacy module support for the short term.

  • Add R10K deploy trigger on push notification
  • Add legacymodule=true, legacymodulepath, legacymodulegitrepo options

Make E-mail system more modular

Right now it's kinda dumb, just assumes things are working and goes for it, need to have a [module] enabled=true or something setting so that the app can know which ticketing systems to attempt to update

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.