mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-01-30 08:39:29 +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/"
|
workdir="tip/"
|
||||||
ref="master"
|
ref="master"
|
||||||
base="master"
|
base="master"
|
||||||
|
history="no"
|
||||||
|
|
||||||
ARGUMENT_LIST=(
|
ARGUMENT_LIST=(
|
||||||
"ref"
|
"ref"
|
||||||
"workdir"
|
"workdir"
|
||||||
"gitrepo"
|
"gitrepo"
|
||||||
"base"
|
"base"
|
||||||
|
"history"
|
||||||
)
|
)
|
||||||
|
|
||||||
opts=$(getopt \
|
opts=$(getopt \
|
||||||
@ -41,6 +43,7 @@ while true; do
|
|||||||
echo "--workdir specify the working directory"
|
echo "--workdir specify the working directory"
|
||||||
echo "--gitrepo specify the git repository"
|
echo "--gitrepo specify the git repository"
|
||||||
echo "--base specify the base branch to checkout"
|
echo "--base specify the base branch to checkout"
|
||||||
|
echo "--history fetch the history of the base branch"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Sample Usage:"
|
echo "Sample Usage:"
|
||||||
echo "./prepare.sh --gitrepo=https://github.com/example --workdir=/opt/build --ref=pull/123/head"
|
echo "./prepare.sh --gitrepo=https://github.com/example --workdir=/opt/build --ref=pull/123/head"
|
||||||
@ -63,6 +66,10 @@ while true; do
|
|||||||
shift
|
shift
|
||||||
base=${1}
|
base=${1}
|
||||||
;;
|
;;
|
||||||
|
--history)
|
||||||
|
shift
|
||||||
|
history="yes"
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
@ -75,7 +82,14 @@ set -x
|
|||||||
|
|
||||||
dnf -y install git podman make
|
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}"
|
cd "${workdir}"
|
||||||
git fetch origin "${ref}:tip/${ref}"
|
git fetch origin "${ref}:tip/${ref}"
|
||||||
git checkout "tip/${ref}"
|
git checkout "tip/${ref}"
|
||||||
|
Loading…
Reference in New Issue
Block a user