Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mfriedenhagen's full-sized avatar

Mirko Friedenhagen mfriedenhagen

View GitHub Profile
@mfriedenhagen
mfriedenhagen / password_from_keyring.py
Last active January 3, 2018 05:14
A simple keyring based password provisioner for ansible
"""
Store this file as `vars_plugins/password_from_keyring.py` and specify the
following in `ansible.cfg`:
```
[defaults]
vars_plugins=./vars_plugins
```
In your inventory specify:
@mfriedenhagen
mfriedenhagen / simple_logger.py
Created August 25, 2014 13:54
Strange logging behaviour in hooks (debug level activated resp. handler message shown) (https://github.com/bundlewrap/bundlewrap/issues/130)
#!/usr/bin/env python
import logging
def _post_message(message):
"""
Will not create a logging message but emit a warning: No handlers could be found for logger "simple_logger"
"""
logging.getLogger("simple_logger").warn(message)
@mfriedenhagen
mfriedenhagen / git-trigger-jenkins
Created September 4, 2013 08:34
Small shell script which will read the GIT scm connection and ciManagement URL from a POM and trigger the poll of jobs in a Jenkins instance
#!/bin/sh
# Small shell script which will read the GIT scm connection and ciManagement URL
# from a POM and trigger the poll of jobs in a Jenkins instance.
# SED-Voodoo via http://www.grymoire.com/Unix/Sed.html
#
# Note that you have do run this once online to get all needed dependencies for
# help plugin. Afterwards you may invoke this with "--offline" or "-o" for speed.
GOAL="org.apache.maven.plugins:maven-help-plugin:2.2:evaluate"
BASEURL="`mvn $@ $GOAL -Dexpression=project.ciManagement.url | sed -n '\,/job/, s,\(.*\)\/job\/.*,\1/git/notifyCommit?url=,p'`"
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
<distributionManagement>
<relocation>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
@mfriedenhagen
mfriedenhagen / restartjenkins.py
Created March 25, 2012 20:21
Sample restarter script for jenkins
#!/usr/bin/python
"""
Simple restarter for jenkins - not a real Tanuki wrapper :-).
- Install to /usr/local/bin and make the script executable.
- Then create a cron entry to execute the script every 10 minutes:
cat << EOF > /etc/cron.d/restartjenkins
*/10 * * * * root /usr/local/bin/restartjenkins.py 2>&1 | logger -t restartjenkins
EOF
"""
import os
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>validate</phase>
<configuration>
<tasks>
<exec
executable="git"