Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding docker ci images getter scripts #3960

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading