Skip to content

Instantly share code, notes, and snippets.

@GauntletWizard
Created November 7, 2019 22:22
Show Gist options
  • Select an option

  • Save GauntletWizard/e5af979a8814dbd8dcc61bbb8b30abfc to your computer and use it in GitHub Desktop.

Select an option

Save GauntletWizard/e5af979a8814dbd8dcc61bbb8b30abfc to your computer and use it in GitHub Desktop.
git fetch
for deployment in $(kubectl get deployment -o name) ; do
local sha=$(kubectl get “$deployment” -o json |jq -r '.spec.template.spec.containers[].image | capture(".*:(?<sha>.*)")| .sha’);
count=$(git rev-list --count “${SHA}..origin/master”) ;
echo $deployment is $count revisions behind master (at $sha)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment