release: properly change working dir if tmp location already exists

Currently, the script won't change directories into the previously
cloned repository if the temporary location exists. This may be an issue
when testing first with a dry run and later with the actual release.

Signed-off-by: Ivan Valdes <ivan@vald.es>
This commit is contained in:
Ivan Valdes
2024-10-30 16:27:57 -07:00
parent 6883308899
commit 4763cb10f0

View File

@ -86,10 +86,12 @@ main() {
# Set up release directory. # Set up release directory.
local reldir="/tmp/etcd-release-${VERSION}" local reldir="/tmp/etcd-release-${VERSION}"
log_callout "Preparing temporary directory: ${reldir}" log_callout "Preparing temporary directory: ${reldir}"
if [ ! -d "${reldir}/etcd" ] && [ "${IN_PLACE}" == 0 ]; then if [ "${IN_PLACE}" == 0 ]; then
if [ ! -d "${reldir}/etcd" ]; then
mkdir -p "${reldir}" mkdir -p "${reldir}"
cd "${reldir}" cd "${reldir}"
run git clone "${REPOSITORY}" --branch "${BRANCH}" --depth 1 run git clone "${REPOSITORY}" --branch "${BRANCH}" --depth 1
fi
run cd "${reldir}/etcd" || exit 2 run cd "${reldir}/etcd" || exit 2
run git checkout "${BRANCH}" || exit 2 run git checkout "${BRANCH}" || exit 2
run git pull origin run git pull origin