Skip to content

Instantly share code, notes, and snippets.

View techlunacy's full-sized avatar

Graeme Wilson techlunacy

  • Singapore
View GitHub Profile
kubectl get pods --all-namespaces | grep Error | awk '{print $2 " --namespace=" $1}' | xargs -I '{}' bash -c 'kubectl delete pods {}'
kubectl get pods --all-namespaces | grep OOMKilled | awk '{print $2 " --namespace=" $1}' | xargs -I '{}' bash -c 'kubectl delete pods {}'
@techlunacy
techlunacy / list_all_plugins_with_updated_versions.groovy
Created November 12, 2019 01:29
gets a list of all installed plugins on a jenkins instance. if there is an available update for the plugin insert that version instead. good for updating all plugins in the docker container using the plugins.txt.
import jenkins.*
import jenkins.model.*
import hudson.*
import hudson.model.*
List<String> jenkinsPlugins = new ArrayList<String>(Jenkins.instance.pluginManager.activePlugins);
jenkinsPlugins.sort { it.displayName }
println ""
jenkinsPlugins.each{
plugin -> if(plugin.getUpdateInfo()){
@techlunacy
techlunacy / list_all_plugins_with_updated_versions.groovy
Created November 12, 2019 01:28
gets a list of all installed plugins on a jenkins instance. if there is an available update for the plugin insert that version instead.
import jenkins.*
import jenkins.model.*
import hudson.*
import hudson.model.*
List<String> jenkinsPlugins = new ArrayList<String>(Jenkins.instance.pluginManager.activePlugins);
jenkinsPlugins.sort { it.displayName }
println ""
jenkinsPlugins.each{
plugin -> if(plugin.getUpdateInfo()){
@techlunacy
techlunacy / .zshrc
Last active July 7, 2019 09:29
clone repository into project folder and poll another command
# clone repository into project/repository name
function clone() {
local url="${1}" # https://github.com/jenkinsci/configuration-as-code-plugin.git
local project="$(cut -d'/' -f4 <<<"$url")" # jenkinsci
local repository="$(cut -d'/' -f5 <<<"$url")" # configuration-as-code-plugin.git
repository="$(cut -d'.' -f1 <<<"$repository")" # configuration-as-code-plugin
local filepath="${project}/${repository}" # jenkinsci/configuration-as-code-plugin
mkdir -p "$filepath" # mkdir -p jenkinsci/configuration-as-code-plugin
git clone "$url" "$filepath" #git clone "https://github.com/jenkinsci/configuration-as-code-plugin.git" "jenkinsci/configuration-as-code-plugin"
}
@techlunacy
techlunacy / delete-merged-branches.sh
Created February 27, 2019 04:17
repository maintinence tasks
git fetch
git remote prune origin
git branch --no-color -r --merged | grep -v master | sed 's/origin\// /' | xargs -n 1 git push --delete origin
@techlunacy
techlunacy / delete_from_view.groovy
Last active June 15, 2017 04:12
jenkins admin jobs
Jenkins.instance.getItem('foldername').getView('viewname').items.each { item ->
println "deleting $item.name"
item.delete()
}
@techlunacy
techlunacy / useful commands
Last active May 11, 2016 00:58
commands i need to remember
# SHELL COMMANDS
## SORT BY SIZE
du -hs * | sort -h
## SHOW SUDO PERMISSIONS
sudo -l
## SHOW ARCHITECTURE OF LINUX
uname –a
@techlunacy
techlunacy / .gitconfig
Created July 30, 2015 01:21
my gitconfig
[alias]
ci = commit
cim= commit --amend
co = checkout
cp = cherry-pick
pr = pull --rebase
st = status
update = pull --rebase
br = branch
po = push origin
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name=$inputline
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url=$inputline

Description

Dashing widget to display a Jenkins build status and build progress

The widget is based on the meter-widget which is default in the Dashing installation

The widget can also see the progress of a "pre-build", i.e if you have a job triggering the actual build you want to define, you can configure this job in the jenkins_build.rb as a prebuild.

For more information, please see Coding Like a tosser