Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to jfrog-cli-v2-jf #1

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions bin/download
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ os_name="$(get_os_name)"
arch="$(get_arch)"

release_file="${ASDF_DOWNLOAD_PATH}/${TOOL_NAME}"

download_release "${ASDF_INSTALL_VERSION}" "${os_name}" "${arch}" "${release_file}"
if [ "$os_name" == "mac" ] && [ "$arch" != "arm64" ]; then
download_release "${ASDF_INSTALL_VERSION}" "${os_name}" "386" "${release_file}"
else
download_release "${ASDF_INSTALL_VERSION}" "${os_name}" "${arch}" "${release_file}"
fi

\mv "${ASDF_DOWNLOAD_PATH}/${TOOL_NAME}" "${ASDF_DOWNLOAD_PATH}/${TOOL_SHORT_NAME}"

Expand Down
15 changes: 11 additions & 4 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
set -euo pipefail

REPO="jfrog/jfrog-cli"
TOOL_LONG_NAME="jfrog-cli"
TOOL_NAME="jfrog"
TOOL_NAME="jfrog-cli"
TOOL_SHORT_NAME="jf"
TOOL_TEST="${TOOL_SHORT_NAME} --version"

Expand All @@ -31,7 +30,7 @@ list_github_tags() {
local RC="0"
set +euo pipefail
while [ ${RC} -eq 0 ]; do
GH_RELEASES_PAGE=$((${GH_RELEASES_PAGE} + 1))
GH_RELEASES_PAGE=$((GH_RELEASES_PAGE + 1))
GH_RELEASES="${GH_RELEASES}$(curl "${CURL_OPTS[@]}" "https://api.github.com/repos/${REPO}/releases?per_page=100&page=${GH_RELEASES_PAGE}" | awk '/tag_name/{ rc = 1; gsub(/,|"/,"") ; print $2 }; END { exit !rc }')"
RC="${?}"
done
Expand All @@ -52,7 +51,15 @@ download_release() {
arch="$3"
filename="$4"

url="https://releases.jfrog.io/artifactory/jfrog-cli/v${cli_major_version}/${version}/jfrog-cli-${os_name}-${arch}/jfrog"
if [ "$cli_major_version" -eq 2 ]; then
effective_cli_major_version=2-jf
jfrog_cli_name=jf
else
effective_cli_major_version=$cli_major_version
jfrog_cli_name=jfrog
fi

url="https://releases.jfrog.io/artifactory/jfrog-cli/v${effective_cli_major_version}/${version}/jfrog-cli-${os_name}-${arch}/${jfrog_cli_name}"

echo "* Downloading $TOOL_NAME release $version..."
curl "${CURL_OPTS[@]}" -o "$filename" -C - "$url" || fail "Could not download $url"
Expand Down
Loading