blob: 875368506f2129236bf1b812eba6262862bcca14 [file] [log] [blame]
Gary Wu9ac1c292018-10-25 07:09:36 -07001#!/bin/bash
2
3if [ "$#" -ne 2 ]; then
4 echo This script compares docker-manifest.csv with docker-manifest-staging.csv to verify that staging has later versions than release.
5 echo "$0 <docker-manifest.csv> <docker-manifest-staging.csv>"
6 exit 1
7fi
8
9if [ -z "$WORKSPACE" ]; then
10 export WORKSPACE=`git rev-parse --show-toplevel`
11fi
12
13export LC_ALL=C
14
15err=0
16for line in $(join -t, $1 $2 | tail -n +2); do
17 image=$(echo $line | cut -d , -f 1)
18 release=$(echo $line | cut -d , -f 2)
19 staging=$(echo $line | cut -d , -f 3)
20
Gary Wud2851912019-05-09 08:50:23 -070021 if [[ "${staging//./-}_" < "${release//./-}_" ]]; then
22 echo "[ERROR] $image:$staging is out-of-date vs. release ($release)."
Gary Wu781a1242019-05-15 21:39:54 -070023
24 # Uncomment the following to update the staging manifest with the release version
25 # sed -i "s|$image,.*|$image,$release|g" $2
Gary Wu9ac1c292018-10-25 07:09:36 -070026 fi
27done
28exit $err