ndimiduk commented on a change in pull request #1725:
URL: https://github.com/apache/hbase/pull/1725#discussion_r428329850
##########
File path: dev-support/create-release/do-release-docker.sh
##########
@@ -168,11 +172,65 @@ if [ -n "$JAVA" ]; then
JAVA_VOL=(--volume "$JAVA:/opt/hbase-java")
fi
+#TODO some debug output would be good here
+GIT_REPO_MOUNT=()
+if [ -n "${GIT_REPO}" ]; then
+ case "${GIT_REPO}" in
+ # skip the easy to identify remote protocols
+ ssh://*|git://*|http://*|https://*|ftp://*|ftps://*) ;;
+ # for sure local
+ /*)
+ GIT_REPO_MOUNT=(--mount "type=bind,src=${GIT_REPO},dst=/opt/hbase-repo")
+ echo "HOST_GIT_REPO=${GIT_REPO}" >> "${ENVFILE}"
+ GIT_REPO="/opt/hbase-repo"
+ ;;
+ # on the host but normally git wouldn't use the local optimization
+ file://*)
+ echo "[INFO] converted file:// git repo to a local path, which changes
git to assume --local."
+ GIT_REPO_MOUNT=(--mount
"type=bind,src=${GIT_REPO#file://},dst=/opt/hbase-repo")
+ echo "HOST_GIT_REPO=${GIT_REPO}" >> "${ENVFILE}"
+ GIT_REPO="/opt/hbase-repo"
+ ;;
+ # have to decide if it's a local path or the "scp-ish" remote
+ *)
Review comment:
Is it simpler to match on a regex like
`(?<protocol>.+)://(?<host_and_path>.+)`? If this does not match, it's local
for sure. if `protocol` matches as `file`, you treat `host_and_path` as a local
path. Anything else you pass through as `GIT_REPO` and let git sort it out.
##########
File path: dev-support/create-release/release-util.sh
##########
@@ -389,6 +389,40 @@ function configure_maven {
EOF
}
+# force a clone of the repo, optionally with auth details for pushing.
+function git_force_clone {
+ local asf_repo
+ if [ -d "${PROJECT}" ]; then
Review comment:
skip the `if [ -d` check? if there's something there, you want it
removed. doesn't matter if it's a dir or not.
##########
File path: dev-support/create-release/release-util.sh
##########
@@ -389,6 +389,40 @@ function configure_maven {
EOF
}
+# force a clone of the repo, optionally with auth details for pushing.
+function git_force_clone {
Review comment:
why is this function called "force"? is there some version that performs
a clone more gracefully?
##########
File path: dev-support/create-release/release-util.sh
##########
@@ -389,6 +389,40 @@ function configure_maven {
EOF
}
+# force a clone of the repo, optionally with auth details for pushing.
+function git_force_clone {
+ local asf_repo
+ if [ -d "${PROJECT}" ]; then
+ rm -rf "${PROJECT}"
+ fi
+
+ if [[ -z "${GIT_REPO}" ]]; then
+ asf_repo="gitbox.apache.org/repos/asf/${PROJECT}.git"
+ echo "[INFO] clone will be of the gitbox repo for ${PROJECT}."
+ if [ -n "${ASF_USERNAME}" ] && [ -n "${ASF_PASSWORD}" ]; then
+ # Ugly!
+ encoded_username=$(python -c "import urllib; print
urllib.quote('''$ASF_USERNAME''')")
+ encoded_password=$(python -c "import urllib; print
urllib.quote('''$ASF_PASSWORD''')")
+ GIT_REPO="https://$encoded_username:$encoded_password@${asf_repo}"
+ else
+ GIT_REPO="https://${asf_repo}"
+ fi
+ else
+ echo "[INFO] clone will be of provided git repo."
+ fi
+ # N.B. we use the shared flag because the clone is short lived and if a
local repo repo was
+ # given this will let us refer to objects there directly instead of
hardlinks or copying.
+ # The option is silently ignored for non-local repositories. see the
note on git help clone
+ # for the --shared option for details.
Review comment:
nice
##########
File path: dev-support/create-release/release-util.sh
##########
@@ -389,6 +389,40 @@ function configure_maven {
EOF
}
+# force a clone of the repo, optionally with auth details for pushing.
+function git_force_clone {
+ local asf_repo
+ if [ -d "${PROJECT}" ]; then
+ rm -rf "${PROJECT}"
+ fi
+
+ if [[ -z "${GIT_REPO}" ]]; then
+ asf_repo="gitbox.apache.org/repos/asf/${PROJECT}.git"
+ echo "[INFO] clone will be of the gitbox repo for ${PROJECT}."
+ if [ -n "${ASF_USERNAME}" ] && [ -n "${ASF_PASSWORD}" ]; then
+ # Ugly!
+ encoded_username=$(python -c "import urllib; print
urllib.quote('''$ASF_USERNAME''')")
+ encoded_password=$(python -c "import urllib; print
urllib.quote('''$ASF_PASSWORD''')")
+ GIT_REPO="https://$encoded_username:$encoded_password@${asf_repo}"
+ else
+ GIT_REPO="https://${asf_repo}"
+ fi
+ else
+ echo "[INFO] clone will be of provided git repo."
+ fi
+ # N.B. we use the shared flag because the clone is short lived and if a
local repo repo was
+ # given this will let us refer to objects there directly instead of
hardlinks or copying.
+ # The option is silently ignored for non-local repositories. see the
note on git help clone
+ # for the --shared option for details.
+ git clone --shared -b "${GIT_BRANCH}" -- "${GIT_REPO}" "${PROJECT}"
+ # If this was a host local git repo then add in an alterntes and remote that
will
+ # work back on the host if the RM needs to do any post-processing steps,
i.e. pushing the git tag
Review comment:
this sounds like black-git-magic :)
##########
File path: dev-support/create-release/release-util.sh
##########
@@ -389,6 +389,40 @@ function configure_maven {
EOF
}
+# force a clone of the repo, optionally with auth details for pushing.
+function git_force_clone {
+ local asf_repo
+ if [ -d "${PROJECT}" ]; then
+ rm -rf "${PROJECT}"
+ fi
+
+ if [[ -z "${GIT_REPO}" ]]; then
+ asf_repo="gitbox.apache.org/repos/asf/${PROJECT}.git"
+ echo "[INFO] clone will be of the gitbox repo for ${PROJECT}."
+ if [ -n "${ASF_USERNAME}" ] && [ -n "${ASF_PASSWORD}" ]; then
+ # Ugly!
+ encoded_username=$(python -c "import urllib; print
urllib.quote('''$ASF_USERNAME''')")
+ encoded_password=$(python -c "import urllib; print
urllib.quote('''$ASF_PASSWORD''')")
+ GIT_REPO="https://$encoded_username:$encoded_password@${asf_repo}"
+ else
+ GIT_REPO="https://${asf_repo}"
+ fi
+ else
+ echo "[INFO] clone will be of provided git repo."
+ fi
+ # N.B. we use the shared flag because the clone is short lived and if a
local repo repo was
Review comment:
small question, what does "N. B." stand for?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]