Skip to content

Instantly share code, notes, and snippets.

View marcusphi's full-sized avatar

Marcus Philip marcusphi

View GitHub Profile
/**
* Clean all non-locked lockable resources from Jenkins config.
*
* Rationale: When using lock function in pipeline with a dynamic string that will have many values
* over time, the Jenkins global configure page is filled with lockable resources.
*
* @param mailTo String - Comma separated list of email addresses to mail upon error
*/
def cleanLockableResources(String mailTo) {
try {
def myFolder = "JobDSL"
def myJob = 'maintenance-LockableResourceGC'
def mailTo = '[email protected]' // Whitespace-separated list of recipient addresses
pipelineJob("${myFolder}/${myJob}") {
description("""Cleanup lockable resources on a scheduled basis\n""" + generatedByString())
logRotator { numToKeep(10) }
concurrentBuild(false)
// TRIGGERS ------------------------
triggers {

Keybase proof

I hereby claim:

  • I am marcusphi on github.
  • I am marcus_phi (https://keybase.io/marcus_phi) on keybase.
  • I have a public key ASAOyy9nbBac2_a4cE7ZaTSC6yLx8hNiTXy7eTJuRotuVQo

To claim this, I am signing this object:

@marcusphi
marcusphi / puppet_jdk_rpm_fails.txt
Created January 13, 2016 09:42
puppet jdk rpm install fails silently
Puppet code:
------------
package { 'jdk-1.7.0_80-fcs.i586':
provider => 'rpm',
source => '/etc/puppet/modules/jdk/files/jdk-7u80-linux-i586.rpm',
}
#Get rpm manually:
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-i586.rpm"
@marcusphi
marcusphi / ansible_conditionals_examples.yaml
Created October 2, 2013 09:48
Ansible 1.3 Conditional Execution -- Very complete example with comments -- I find the conditional expressions to be ridiculously hard to get right in Ansible. I don't have a good model of what's going on under the surface so I often get it wrong. What makes it even harder is that there has been at least three different variants over the course …
---
# This has been tested with ansible 1.3 with these commands:
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=false"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=true"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts"
# NB: The type of the variable is crucial!
- name: Ansible Conditionals Examples
hosts: $hosts
vars_files: