mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-01-18 02:39:30 +00:00
ci: add --history option to prepare.sh
In case the history of the branch is needed (commitlint job), add an option --history to skip cloning the repository with --depth=1. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
56d545c2e2
commit
e9aec13761
16
prepare.sh
16
prepare.sh
@ -7,12 +7,14 @@ gitrepo="https://github.com/ceph/ceph-csi"
|
||||
workdir="tip/"
|
||||
ref="master"
|
||||
base="master"
|
||||
history="no"
|
||||
|
||||
ARGUMENT_LIST=(
|
||||
"ref"
|
||||
"workdir"
|
||||
"gitrepo"
|
||||
"base"
|
||||
"history"
|
||||
)
|
||||
|
||||
opts=$(getopt \
|
||||
@ -41,6 +43,7 @@ while true; do
|
||||
echo "--workdir specify the working directory"
|
||||
echo "--gitrepo specify the git repository"
|
||||
echo "--base specify the base branch to checkout"
|
||||
echo "--history fetch the history of the base branch"
|
||||
echo " "
|
||||
echo "Sample Usage:"
|
||||
echo "./prepare.sh --gitrepo=https://github.com/example --workdir=/opt/build --ref=pull/123/head"
|
||||
@ -63,6 +66,10 @@ while true; do
|
||||
shift
|
||||
base=${1}
|
||||
;;
|
||||
--history)
|
||||
shift
|
||||
history="yes"
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
@ -75,7 +82,14 @@ set -x
|
||||
|
||||
dnf -y install git podman make
|
||||
|
||||
git clone --depth=1 --branch="${base}" "${gitrepo}" "${workdir}"
|
||||
# if --history is passed, don't pass --depth=1
|
||||
depth='--depth=1'
|
||||
if [[ "${history}" == 'yes' ]]
|
||||
then
|
||||
depth=''
|
||||
fi
|
||||
|
||||
git clone "${depth}" --branch="${base}" "${gitrepo}" "${workdir}"
|
||||
cd "${workdir}"
|
||||
git fetch origin "${ref}:tip/${ref}"
|
||||
git checkout "tip/${ref}"
|
||||
|
Loading…
Reference in New Issue
Block a user