Remove .git suffix on repository name

* Repository name is extracted from URL and used as WORKDIR.
  It leads to error when the repository URL is provided with ".git"
  "https://github.com/airshipit/airshipctl.git"

* Remove the ".git suffix when present in repository URL

Closes: #653
Change-Id: If154873f4126cedd85aa7f5deac13e17726a732c
This commit is contained in:
Siraj Yasin 2021-10-13 19:30:14 +00:00
parent 4bce04c86b
commit 3ca5d825b5

View File

@ -22,7 +22,10 @@ export AIRSHIP_CONFIG_MANIFEST_DIRECTORY=${AIRSHIP_CONFIG_MANIFEST_DIRECTORY:-"/
export AIRSHIP_CONFIG_PHASE_REPO_URL=${AIRSHIP_CONFIG_PHASE_REPO_URL:-"https://review.opendev.org/airship/airshipctl"}
export EXTERNAL_KUBECONFIG=${EXTERNAL_KUBECONFIG:-""}
export SITE=${SITE:-"test-site"}
export WORKDIR="${AIRSHIP_CONFIG_MANIFEST_DIRECTORY}/$(basename ${AIRSHIP_CONFIG_PHASE_REPO_URL})"
REPO_NAME=$(basename ${AIRSHIP_CONFIG_PHASE_REPO_URL})
# Remove .git from repository if present
REPO_NAME=${REPO_NAME%.git}
export WORKDIR="${AIRSHIP_CONFIG_MANIFEST_DIRECTORY}/${REPO_NAME}"
if [[ -z "$EXTERNAL_KUBECONFIG" ]]; then
# we want to take config from bundle - remove kubeconfig file so