Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kanapuli's full-sized avatar
🏠
Working from home

Athavan Kanapuli kanapuli

🏠
Working from home
View GitHub Profile
@kanapuli
kanapuli / Jenkinsfile
Created December 2, 2019 04:18 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, kubernetes templates, shared volumes, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, Docker containers, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage c…
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(label: label, yaml: """
spec:
containers:
- name: mvn
image: maven:3.3.9-jdk-8-alpine
# This tells kubecfg to read its config from the local directory
export KUBECONFIG=./kubeconfig
# Looking at the cluster
kubectl get nodes
kubectl get pods --namespace=kube-system
# Running a single pod
kubectl run --generator=run-pod/v1 --image=gcr.io/kuar-demo/kuard-amd64:1 kuard
kubectl get pods
@kanapuli
kanapuli / find-old-branches.sh
Created July 12, 2019 08:13 — forked from mroderick/find-old-branches.sh
A small script to find stale branches
#!/bin/bash
# This is a very naive script, it doesn't do grouping and returns all branches
# I only really care about branches that have not seen commits in two months
#
# I am hoping to find some time to write a tool that can output these reports for me
# In the meantime, I am using this
echo "Merged branches"
for branch in `git branch -r --merged | grep -v HEAD`;do echo -e `git log --no-merges -n 1 --format="%ci, %cr, %an, %ae, " $branch | head -n 1` \\t$branch; done | sort -r