Skip to content

Instantly share code, notes, and snippets.

View scoheb's full-sized avatar

Scott Hebert scoheb

  • Red Hat
  • Montreal, Canada
View GitHub Profile
@scoheb
scoheb / init.groovy
Last active March 28, 2017 12:09
Disable ALL Jenkins jobs ONE TIME ONLY
import hudson.model.*
import jenkins.model.*
/** This script attempts to disable ALL jobs ONLY ONCE
* It uses JENKINS_HOME/disableAllJobs.done as the control file
*/
File controlFile = new File(Jenkins.instance.getRootDir(), "disableAllJobs.done")
if (controlFile.exists()) {
println("Disable All Jobs ALREADY completed: " + controlFile.getAbsolutePath() + " exists...")
} else {
@scoheb
scoheb / compare-plugins-against-csb.sh
Last active March 31, 2017 14:07
This script compare plugin name and versions between a local installation of Jenkins and the CCI Update Center versions
#!/usr/bin/env bash
###############################################
#
# This script compare plugin name and versions
# between a local installation of Jenkins
# and the CCI Update Center versions
#
##############################################
podTemplate(name: 'continous-infra-slave', label: 'continous-infra-slave', cloud: 'openshift',
containers: [
// This adds the custom slave container to the pod. Must be first with name 'jnlp'
containerTemplate(name: 'jnlp',
image: '172.30.1.1:5000/continuous-infra/jenkins-continuous-infra-slave',
ttyEnabled: false,
args: '${computer.jnlpmac} ${computer.name}',
command: '',
workingDir: '/tmp'),
podTemplate(name: 'some-slave', label: 'some-slave', cloud: 'openshift', serviceAccount: 'jenkins',
containers: [
// This adds the custom slave container to the pod. Must be first with name 'jnlp'
containerTemplate(name: 'jnlp',
image: '172.30.1.1:5000/continuous-infra/jenkins-continuous-infra-slave:latest',
ttyEnabled: false,
args: '${computer.jnlpmac} ${computer.name}',
command: '',
workingDir: '/tmp'),
def map = readProperties file: 'fedmsg_properties.txt'
def fedmsg_properties = map.collect { key, value -> return key+'='+value }
withEnv(fedmsg_properties) {
echo "${env.SCOTT}"
}
apiVersion: v1
kind: BuildConfig
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
creationTimestamp: 2017-08-10T18:54:27Z
labels:
app: rpmbuild-builder
template: rpmbuild-builder
name: rpmbuild
@scoheb
scoheb / gist:1217e2b2636930cca0209889815b115a
Last active October 5, 2017 16:19
Getting a fedmsg using httpie
# install httpie
# determine delta in secs...2 days == 172800
# http get https://apps.fedoraproject.org/datagrepper/raw topic=="org.fedoraproject.prod.git.receive" delta==172800 contains=="d1d2322" --timeout 3600
@scoheb
scoheb / gist:21d946bc5a7c19d77e10257460a4b95b
Last active March 20, 2018 01:30
Add signature to Script Approval
import org.jenkinsci.plugins.scriptsecurity.scripts.*
ScriptApproval sa = ScriptApproval.get();
//Add a signature to the list
signature = "staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods last java.lang.Iterable"
ScriptApproval.PendingSignature s = new ScriptApproval.PendingSignature(signature, false, ApprovalContext.create())
sa.approveSignature(s.signature);
import hudson.model.User;
import jenkins.security.ApiTokenProperty;
import hudson.util.Secret;
// Get the actual token
u = User.get("system_serviceaccount_rhproduct_jenkins-admin")
tokprop = u.getProperty(ApiTokenProperty.class)
actual_token = tokprop.getApiTokenInsecure()
<html>
<body>
<div style="font-family: Courier;
padding: 5px;
background-color: #00008B;
color: white;
font-size: xx-large;
margin-bottom: 15px;
font-weight: bold;