Skip to content

Instantly share code, notes, and snippets.

@jdickie
jdickie / CarbonJobCreate.groovy
Last active September 28, 2016 02:30
From the upstream job we get a nice Config object that can be iterated through to create jobs. Here we're making a job that will SSH into a server and run PHPUnit tests with variables specified within that Config object. If the Config specifies the job being iterated is a 'master' job, then it creates a MultiJob for running all of the tests in t…
Config.jobs.each { _job ->
switch (_job.type) {
case 'job':
job(namePrefix + _job.name) {
logRotator(CarbonApiProps.num_days_to_keep, CarbonApiProps.num_builds_to_keep,
CarbonApiProps.num_artifacts_days, CarbonApiProps.num_artifacts)
throttleConcurrentBuilds {
categories([carbonThrottleCategory])
}
if (serverName && _job.remoteCommand) {
@jdickie
jdickie / ApiConfigCreate.groovy
Created September 6, 2016 21:27
Here the code is going through a folder specified in a Jenkins job string parameter and finding all tests. It iterates through each file and makes a JSON config file that will get read by a downstream Jenkins job that generates tests. A lot of this is based on assumptions about our codebase and we'd like to eventually move on to more robust setu…
def traverseWorkspaceDir(File path, jobs, jobMaster) {
path.traverse { file ->
if (!file.isDirectory() && !(file.name.matches(/^\.[A-z]*/))) {
addFileToJobsList(file, jobs, jobMaster)
}
}
}
def addFileToJobsList(File file, jobs, jobMaster) {
curJob = new Job()
@jdickie
jdickie / content-person.php
Created January 31, 2012 20:46 — forked from kirstenkeister/content-person.php
WPAlchemy meta definitions for repeating links
<?php
global $peoplelinks_mb;
$peoplelinks_mb->the_meta();
$i = 0;
while($peoplelinks_mb->have_fields('links')) {
?>
<?php
if($i == 0) { ?>
<div id="info-links" class="column left">
<h2 class="column-title">Links</h2>