2021-05-03 09:51:34 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-06-15 15:02:49 +02:00
|
|
|
clone_component()
|
2021-05-03 09:51:34 +02:00
|
|
|
{
|
2022-06-28 12:21:32 +02:00
|
|
|
OPTS=$(getopt -o c: --long component:,git-repository:,git-branch:,product-build: -n 'clone-repositories' -- "$@")
|
2021-05-03 09:51:34 +02:00
|
|
|
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
|
|
|
|
eval set -- "$OPTS"
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
2022-06-15 15:02:49 +02:00
|
|
|
-c | --component ) COMPONENT=$2; shift 2;;
|
|
|
|
--git-repository ) GIT_REPO=$2; shift 2;;
|
|
|
|
--git-branch ) GIT_BRANCH=$2; shift 2;;
|
|
|
|
--product-build ) PRODUCT_BUILD=$2; shift 2;;
|
2021-05-03 09:51:34 +02:00
|
|
|
-- ) shift; break ;;
|
|
|
|
* ) break ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2022-06-15 15:02:49 +02:00
|
|
|
if [ "${COMPONENT}" != "apicurio" ] && [ "${COMPONENT}" != "strimzi" ] ;
|
|
|
|
then
|
2022-07-13 10:52:21 +02:00
|
|
|
echo "unknown component: ${COMPONENT}"
|
2022-06-15 15:02:49 +02:00
|
|
|
exit 2 ;
|
|
|
|
fi ;
|
|
|
|
|
2022-06-21 11:01:30 +02:00
|
|
|
if [ "${PRODUCT_BUILD}" == false ];
|
2022-06-13 14:02:08 +02:00
|
|
|
then
|
2022-06-15 15:02:49 +02:00
|
|
|
git clone --branch "${GIT_BRANCH}" "${GIT_REPO}" "${COMPONENT}" || exit 2 ;
|
|
|
|
else
|
2022-06-28 12:21:32 +02:00
|
|
|
unzip /testsuite/"${COMPONENT}".zip -d "${COMPONENT}" ;
|
|
|
|
rm /testsuite/"${COMPONENT}".zip ;
|
2021-05-03 09:51:34 +02:00
|
|
|
fi ;
|
2022-06-13 14:02:08 +02:00
|
|
|
}
|