Skip to content

Commit

Permalink
Adding docker ci images getter scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
  • Loading branch information
peterzhuamazon committed Sep 5, 2023
1 parent 2942920 commit aec547f
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions docker/ci/get-ci-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,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="rockylinux8"
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

0 comments on commit aec547f

Please sign in to comment.