-
Notifications
You must be signed in to change notification settings - Fork 277
/
get-ci-images.sh
executable file
·72 lines (63 loc) · 2.11 KB
/
get-ci-images.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Copyright OpenSearch Contributors
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
# This script is to return the latest ci docker images
set -e
function usage() {
echo ""
echo "This script is used to return the latest ci docker images (mostly used in distribution build or integtest pipelines)"
echo "This script will not return any older images, please check 'manifests' directory for those images"
echo "--------------------------------------------------------------------------"
echo "Usage: $0 [args]"
echo ""
echo "Required arguments:"
echo -e "-p PLATFORM\tSpecify the ci image target platform, e.g. 'rockylinux8(default)', 'centos7', 'ubuntu2004' or 'windows2019-servercore'"
echo -e "-u USAGE\tSpecify the ci image target usage, e.g. 'opensearch(default)' or 'opensearch-dashboards' or 'systemd-base'"
echo -e "-t TYPE\tSpecify the usages ci image target type, e.g. 'build(default)' or 'integtest'"
echo ""
echo "Optional arguments:"
echo -e "-h\t\tPrint this message."
echo "--------------------------------------------------------------------------"
}
while getopts ":hp:u:t:" arg; do
case $arg in
h)
usage
exit 1
;;
p)
PLATFORM=$OPTARG
;;
u)
USAGE=$OPTARG
;;
t)
TYPE=$OPTARG
;;
:)
echo "-${OPTARG} requires an argument"
usage
exit 1
;;
?)
echo "Invalid option: -${arg}"
exit 1
;;
esac
done
# Validate the required parameters to present
if [ -z "$PLATFORM" ]; then
PLATFORM="almalinux8"
fi
if [ -z "$USAGE" ]; then
USAGE="opensearch"
fi
if [ -z "$TYPE" ]; then
TYPE="build"
fi
# Run script
crane ls public.ecr.aws/opensearchstaging/ci-runner | grep -Eo '.*v[0-9]' | sort -r | uniq | grep $PLATFORM-$USAGE-$TYPE | sed 's/^/public.ecr.aws\/opensearchstaging\/ci-runner\:/g'