Gary Wu | 7f114f5 | 2018-05-03 17:06:06 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Gary Wu | ce4fcc0 | 2018-05-07 15:09:28 -0700 | [diff] [blame] | 3 | if [ "$#" -ne 1 ]; then |
| 4 | echo This script checks docker-manifest.csv to verify that the specified versions exist in nexus3 |
| 5 | echo "$0 <docker-manifest.csv>" |
| 6 | exit 1 |
| 7 | fi |
| 8 | |
Gary Wu | 7f114f5 | 2018-05-03 17:06:06 -0700 | [diff] [blame] | 9 | if [ -z "$WORKSPACE" ]; then |
| 10 | export WORKSPACE=`git rev-parse --show-toplevel` |
| 11 | fi |
| 12 | |
Gary Wu | af169aa | 2018-05-09 19:34:30 -0700 | [diff] [blame] | 13 | NEXUS_PUBLIC_PREFIX="https://nexus3.onap.org/repository/docker.public/v2" |
| 14 | NEXUS_RELEASE_PREFIX="https://nexus3.onap.org/repository/docker.release/v2" |
Gary Wu | 7f114f5 | 2018-05-03 17:06:06 -0700 | [diff] [blame] | 15 | |
| 16 | err=0 |
| 17 | for line in $(tail -n +2 $1); do |
| 18 | image=$(echo $line | cut -d , -f 1) |
| 19 | tag=$(echo $line | cut -d , -f 2) |
Gary Wu | af169aa | 2018-05-09 19:34:30 -0700 | [diff] [blame] | 20 | |
| 21 | tags=$(curl -s $NEXUS_PUBLIC_PREFIX/$image/tags/list | jq -r '.tags[]' 2> /dev/null) |
Gary Wu | 7f114f5 | 2018-05-03 17:06:06 -0700 | [diff] [blame] | 22 | echo "$tags" | grep -q "^$tag\$" |
| 23 | if [ $? -ne 0 ]; then |
| 24 | echo "[ERROR] $image:$tag not found" |
Gary Wu | af169aa | 2018-05-09 19:34:30 -0700 | [diff] [blame] | 25 | #echo "$tags" | sed 's/^/ /' |
Gary Wu | 7f114f5 | 2018-05-03 17:06:06 -0700 | [diff] [blame] | 26 | (( err++ )) |
Gary Wu | af169aa | 2018-05-09 19:34:30 -0700 | [diff] [blame] | 27 | |
| 28 | else |
| 29 | tags=$(curl -s $NEXUS_RELEASE_PREFIX/$image/tags/list | jq -r '.tags[]' 2> /dev/null) |
| 30 | echo "$tags" | grep -q "^$tag\$" |
| 31 | if [ $? -ne 0 ]; then |
| 32 | echo "[WARN] $image:$tag not released" |
| 33 | #echo "$tags" | sed 's/^/ /' |
| 34 | fi |
Gary Wu | 7f114f5 | 2018-05-03 17:06:06 -0700 | [diff] [blame] | 35 | fi |
| 36 | done |
| 37 | exit $err |