This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generate a `:something-intensifies:` Slack emoji, given a reasonable image | |
# input. I recommend grabbing an emoji from https://emojipedia.org/ | |
set -euo pipefail | |
# Number of frames of shaking | |
count=10 | |
# Max pixels to move while shaking |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def busyExecutors = Jenkins.instance.computers | |
.collect { | |
c -> c.executors.findAll { it.isBusy() } | |
} | |
.flatten() // reminder: transforms list(list(executor)) into list(executor) | |
active = 0 | |
busy = 0 | |
offline = 0 | |
agents = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpwd=$(pwd); for f in $(ls -d */); do cd $cpwd/$f && echo `pwd` && git reset --hard origin/master && cd .. ; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo su | |
echo 1 > /sys/block/sda/device/rescan | |
fdisk /dev/sda | |
p | |
n | |
p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cancel all builds in queue called | |
import hudson.model.* | |
def q = Jenkins.instance.queue | |
q.items.each { | |
println (it) | |
if (it =~ /my.job.to.kill/) { | |
q.cancel(it.task) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// promote all update center plugins | |
import com.cloudbees.plugins.updatecenter.PluginData | |
// Example of an update center "myUpdateCenter" at root level, could be parameter to this job | |
def updateCenterFullName = "myUpdateCenter" | |
jenkins.model.Jenkins.instance.getItemByFullName("${updateCenterFullName}").getPluginsData().each { PluginData pluginData -> | |
if(pluginData.getVersions() != null && !pluginData.getVersions().isEmpty()) { | |
println "Promoting '${pluginData.getName()}' to version '${pluginData.getVersions().lastKey()}'" | |
pluginData.setPromotedVersion("${pluginData.getVersions().lastKey()}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jenkins.instance.updateCenter.getAvailables().each{ | |
println "${it.name}:${it.version}" | |
} | |
Jenkins.instance.pluginManager.plugins.each{ | |
println "${it}:${it.version}" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// installs single hardcoded plugin | |
import jenkins.model.* | |
import java.util.logging.Logger | |
def logger = Logger.getLogger("") | |
def installed = false | |
def initialized = false | |
def pluginParameter="apache-httpcomponents-client-4-api" // this could be a parameter if we wanted | |
def plugins = pluginParameter.split() | |
logger.info("" + plugins) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jenkins.instance.nodes.each { | |
if (it.computer.isOffline()){ | |
println(it.name) | |
it.computer.doDoDelete() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git branch | grep -v "master" | xargs git branch -D |
NewerOlder