Skip to content

Instantly share code, notes, and snippets.

@tknerr
tknerr / .kitchen.docker.yml
Last active December 4, 2017 20:11
Tricking kitchen-vagrant to use the vagrant/docker provider (why? for better caching via vagrant-cachier)
---
driver:
name: docker
driver_config:
provision_command:
- curl -L https://www.opscode.com/chef/install.sh | bash -s -- -v 12.3.0
- env GEM_HOME=/tmp/verifier/gems GEM_PATH=/tmp/verifier/gems GEM_CACHE=/tmp/verifier/gems/cache /opt/chef/embedded/bin/gem install thor busser busser-serverspec serverspec bundler && chown -R kitchen:kitchen /tmp/verifier
require_chef_omnibus: false
use_sudo: false
@tknerr
tknerr / org1-prod.rb
Last active August 29, 2015 14:23 — forked from ranjib/org1-prod.rb
# located at chef_repo/environments/org1-prod.rb
require 'deep_merge'
name 'org1-prod'
description 'Production environment for org1'
org1_yml_path = File.expand_path('../common/org1.yml', __FILE__)
common = YAML.load_file(org1_yml_path)
default_attributes(
common['default'].deep_merge!(
# declare all you org1-prod specific things here.
@tknerr
tknerr / virtualbox-vs-vmware-benchmark.md
Last active January 18, 2016 21:55
Benchmark: comparing Vagrant VirtualBox vs VMWare Provider

Environment

  • vagrant 1.7.4
  • vagrant-vmware-workstation 4.0.5

Minimal with Synced Folders Disabled

@tknerr
tknerr / git-remote-symlink
Created June 10, 2016 08:15
Git remote helper to allow for `git clone symlink:///path/to/original/repo` which simply creates a symlink to the original repo
@tknerr
tknerr / x.sh
Created June 14, 2016 05:42
show the total count and list the first 10 files per day, archive all of them
# show the total count and list the first 10 files per day
for i in `seq 1 100`; do files=$(find . -daystart -mtime $i); num=$(echo $files | wc -w); date=$(date -d "-$i day" +%Y-%m-%d); if [ $num -gt 0 ]; then echo "$num files found for $date"; echo $files | tr ' ' '\n' | xargs ls -l | head -n 10; fi; done
# also archive...
for i in `seq 1 100`; do files=$(find /var/log/ccu/noise-test -daystart -mtime $i -name "TM-Noise*.csv.*.gz"); num=$(echo $files | wc -w); date=$(date -d "-$i day" +%Y-%m-%d); if [ $num -gt 0 ]; then echo "$num files found for $date"; echo $files | tr ' ' '\n' | xargs ls -l | head -n 10; tar -czf /tmp/TM-NoiseTest-$date.tgz $files; fi; done
# long
for i in `seq 1 100`; do
@tknerr
tknerr / list-jenkins-plugins.sh
Created October 19, 2016 22:02
List the installed jenkins plugins @ version
#!/bin/sh
curl 'http://localhost:8080/pluginManager/api/xml?depth=1&xpath=/*/*/shortName|/*/*/version&wrapper=plugins' | perl -pe 's/.*?<shortName>([\w-]+).*?<version>([^<]+)()(<\/\w+>)+/\1@\2\n/g' | sort
@tknerr
tknerr / pedantically_commented_playbook.yml
Created October 25, 2016 14:21 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@tknerr
tknerr / abstract.md
Created January 20, 2017 16:49
Karlsruher Entwicklertag 2017

Title

Abstract

Author Bio

@tknerr
tknerr / preapprove.groovy
Created January 31, 2017 09:15
pre-approve all pending script approvals, e.g. from a JobDSL script
import jenkins.*
import jenkins.model.*
Jenkins.instance.getExtensionList('org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval')[0].get().preapproveAll()

I was trying to get more meaningful stack traces, but it seems that the exception we catch does not carry any more specific details about the step that failed. The only info we get is that the pipeline step failed and the exit code it failed with.

Example pipeline code snippet:

node {
    try {
        stage('do-stuff') {
            sh "echo do somehing; exit 0"
        }