Skip to content

Commit

Permalink
Merge pull request #1 from jmcubel/main
Browse files Browse the repository at this point in the history
Upgrade to jfrog-cli-v2-jf
  • Loading branch information
LozanoMatheus authored Oct 25, 2023
2 parents ed425d7 + 4f2df94 commit dec5281
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
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

0 comments on commit dec5281

Please sign in to comment.