UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects
Commit f5bc7d18 authored by runyontr's avatar runyontr
Browse files

Merge branch 'ib-image-script' into 'master'

Add script to identify if newer images are available in iron bank

See merge request platform-one/big-bang/bigbang!450
parents 3075a994 a2efb40c
No related branches found
No related tags found
1 merge request!450Add script to identify if newer images are available in iron bank
Pipeline #238818 failed
#!/bin/bash
# This script looks at all the deployed images from iron bank and identifies if the
# currently deployed version is the latest in IronBank. Could be used as part of CI
# or as general awareness for development
# Needs crane( https://github.com/google/go-containerregistry/tree/main/cmd/crane )
# to be configured before hand via
# crane auth login -p ${REGISTRY1_CREDENTIALS} -u ${REGISTRY1_USER} registry1.dso.mil
images=`kubectl get pods -A -o jsonpath="{..image}" | tr -s '[[:space:]]' '\n' | sort | uniq -c | grep "registry1" | awk '{ print $2 }'`
for i in $images
do
image=`echo "$i" | awk '{split($0,a,":"); print a[1] }'`
tag=`echo "$i" | awk '{split($0,a,":"); print a[2] }'`
upstream_tag=`crane ls $image | grep -v "latest" | sort -r | head -n1`
if [[ "$tag" != "$upstream_tag" ]]
then
echo "Update for $image: $tag ----> $upstream_tag"
fi
done
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment