--- /dev/null
+#!/usr/bin/python
+
+# Copyright (C) 2014, ProfitBricks GmbH
+# Authors: Benjamin Drung <benjamin.drung@profitbricks.com>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+import logging
+import os
+
+import flask
+import jenkins
+
+JENKINS_URL = "https://jenkins/"
+JENKINS_JOB = "gitlab_integration"
+JENKINS_JOB_TOKEN = "gitlab"
+_LOG_LEVEL = logging.INFO
+_LOG_FORMAT = '%(asctime)s %(name)s [%(process)d] %(levelname)s: %(message)s'
+
+app = flask.Flask(__name__)
+logging.basicConfig(format=_LOG_FORMAT, level=_LOG_LEVEL)
+logger = logging.getLogger(os.path.basename(__file__))
+
+
+@app.route('/', methods=['POST'])
+def receive_gitlab_webhook():
+ logger.info("Received push event:\n{event}".format(event=flask.request.data))
+ jenkins_client = jenkins.Jenkins(JENKINS_URL, None, None)
+ logger.info("Sending payload to {url}job/{job} ...".format(url=JENKINS_URL, job=JENKINS_JOB))
+ jenkins_client.build_job(JENKINS_JOB, {'payload': flask.request.data}, JENKINS_JOB_TOKEN)
+ return "OK"
+
+if __name__ == '__main__':
+ app.run(host='0.0.0.0')