Skip to content

Instantly share code, notes, and snippets.

@brokenthumbs
brokenthumbs / normalize_xml.rb
Last active December 16, 2015 07:19
Normalize all JUnit formatted .xml files in the specified folder
def normalize_xml(folder)
xml_files = []
Dir.entries(folder).each do |element|
xml_files << "#{folder}/#{element}" if element.end_with?(".xml")
end
merged_files = {}
xml_files.each do |xml_file|
@brokenthumbs
brokenthumbs / error.prop
Created January 2, 2014 22:30
Example Java Properties file.
EMAIL_SUBJECT=3
ERRORS=test_flag [qa] => expired on 2011-01-01<br>test_flag [stage] => expired on 2011-01-01<br>test_flag [prod] => expired on 2011-01-01
Subject:
${ENV, var="JOB_NAME"} - Build # ${ENV, var="BUILD_NUMBER"} - ${ENV, var="EMAIL_SUBJECT"} Errors Found!
Content:
----------<br><br>
ERRORS<br><br>
${ENV, var="ERRORS"}
<br><br>
----------<br><br>
${JELLY_SCRIPT, template="html-with-health-and-console"}
#!/usr/bin/ruby
require 'rubygems'
require 'typhoeus'
require 'json'
jenkins = 'buildmaster.jenkins.com'
user = "jenkins"
process = "ruby"
logfile = "/tmp/zombie_killer.log"
channel = manager.build.workspace.channel;
workspace = manager.build.workspace.toString();
def readFromFile( file ) {
return new hudson.FilePath( channel, workspace + "/" + file ).readToString()
}
failedTests = manager.build.testResultAction.getFailedTests()
for ( int i = 0; i < failedTests.size() ; i++ ) {
def service = "your-service"
def proc = "yum --showduplicates list $service".execute()
def results = proc.in.text
stringList = results.split()
list = []
require 'typhoeus'
require 'json'
require 'awesome_print'
def display_server_status(response)
t = {}
t["disabled"] = response["properties"]["basic"]["disabled"]
t["draining"] = response["properties"]["basic"]["draining"]
t["active"] = response["properties"]["basic"]["nodes"]
ap t
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
HOSTS = [
["puppet-master", 100],
node 'puppet-agent.example.com' {
file { 'hello_world':
path => '/tmp/hello_world.log',
ensure => present,
content => "Hello World",
}
}
---
:backends:
- eyaml
- yaml
:hierarchy:
- %{environment}
- common
:yaml: