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

Improve JFrog CLI install/get bash scripts #2227

Merged
merged 9 commits into from
Jan 21, 2024
21 changes: 14 additions & 7 deletions .github/workflows/scriptTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,25 @@ jobs:
name: Script tests (${{ matrix.suite.os }})
defaults:
run:
shell: bash
shell: sh
strategy:
fail-fast: false
matrix:
suite:
- os: "ubuntu"
- os: "ubuntu-latest"

- os: "ubuntu-20.04"

- os: "macos-latest"

- os: "macos"
- os: "macos-11"

- os: "windows-latest"
osSuffix: ".exe"

- os: "windows"
- os: "windows-2019"
osSuffix: ".exe"
runs-on: ${{ matrix.suite.os }}-latest
runs-on: ${{ matrix.suite.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -64,13 +71,13 @@ jobs:
run: |
sh build/build.sh
./jf${{ matrix.suite.osSuffix }} --version
if: ${{ matrix.suite.os != 'windows' }}
if: contains( matrix.suite.os, 'windows')

- name: Test Build CLI - bat
run: |
build/build.bat
./jf${{ matrix.suite.osSuffix }} --version
if: ${{ matrix.suite.os == 'windows' }}
if: contains( matrix.suite.os, 'windows')

# Prior to the release, we set the new version in the package.json files, introducing the prereleased version.
# This adjustment may result in an attempt to download a version that hasn't been published to releases.jfrog.io yet.
Expand Down
30 changes: 16 additions & 14 deletions build/getcli/jf.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
#!/bin/bash
#!/bin/sh
set -u

# This script is downloading the OS-specific JFrog CLI binary with the name - 'jf'

CLI_OS="na"
CLI_MAJOR_VER="v2-jf"
VERSION="[RELEASE]"
FILE_NAME="jf"

if [ $# -eq 1 ]
then
if [ $# -eq 1 ]; then
VERSION=$1
echo "Downloading version $VERSION of JFrog CLI..."
else
echo "Downloading the latest version of JFrog CLI..."
fi

if echo "${OSTYPE}" | grep -q msys; then
if uname -s | grep -q -E -i "(cygwin|mingw|msys|windows)"; then
CLI_OS="windows"
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-windows-amd64/jf.exe"
FILE_NAME="jf.exe"
elif echo "${OSTYPE}" | grep -q darwin; then
ARCH="amd64"
FILE_NAME="${FILE_NAME}.exe"
elif uname -s | grep -q -i "darwin"; then
CLI_OS="mac"
if [[ $(uname -m) == 'arm64' ]]; then
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-mac-arm64/jf"
if [ "$(uname -m)" = "arm64" ]; then
ARCH="arm64"
else
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-mac-386/jf"
ARCH="386"
fi
FILE_NAME="jf"
else
CLI_OS="linux"
MACHINE_TYPE="$(uname -m)"
Expand Down Expand Up @@ -54,9 +56,9 @@ else
exit 1
;;
esac
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/jf"
FILE_NAME="jf"
fi

URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/${FILE_NAME}"
echo "Downloading from: $URL"
curl -XGET "$URL" -L -k -g > $FILE_NAME
chmod u+x $FILE_NAME
chmod +x $FILE_NAME
30 changes: 16 additions & 14 deletions build/getcli/jfrog.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
#!/bin/bash
#!/bin/sh
set -u

# This script is downloading the OS-specific JFrog CLI binary with the name - 'jfrog'

CLI_OS="na"
CLI_MAJOR_VER="v2"
VERSION="[RELEASE]"
FILE_NAME="jfrog"

if [ $# -eq 1 ]
then
if [ $# -eq 1 ]; then
VERSION=$1
echo "Downloading version $VERSION of JFrog CLI..."
else
echo "Downloading the latest version of JFrog CLI..."
fi

if echo "${OSTYPE}" | grep -q msys; then
if uname -s | grep -q -E -i "(cygwin|mingw|msys|windows)"; then
CLI_OS="windows"
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-windows-amd64/jfrog.exe"
FILE_NAME="jfrog.exe"
elif echo "${OSTYPE}" | grep -q darwin; then
ARCH="amd64"
FILE_NAME="${FILE_NAME}.exe"
elif uname -s | grep -q -i "darwin"; then
CLI_OS="mac"
if [[ $(uname -m) == 'arm64' ]]; then
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-mac-arm64/jfrog"
if [ "$(uname -m)" = "arm64" ]; then
ARCH="arm64"
else
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-mac-386/jfrog"
ARCH="386"
fi
FILE_NAME="jfrog"
else
CLI_OS="linux"
MACHINE_TYPE="$(uname -m)"
Expand Down Expand Up @@ -54,9 +56,9 @@ else
exit 1
;;
esac
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/jfrog"
FILE_NAME="jfrog"
fi

URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/${FILE_NAME}"
echo "Downloading from: $URL"
curl -XGET "$URL" -L -k -g > $FILE_NAME
chmod u+x $FILE_NAME
chmod +x $FILE_NAME
30 changes: 16 additions & 14 deletions build/installcli/jf.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
#!/bin/bash
#!/bin/sh
set -u

# This script is downloading the OS-specific JFrog CLI binary with the name - 'jf', and adds it to PATH

CLI_OS="na"
CLI_MAJOR_VER="v2-jf"
VERSION="[RELEASE]"
FILE_NAME="jf"

if [ $# -eq 1 ]
then
if [ $# -eq 1 ]; then
VERSION=$1
echo "Downloading version $VERSION of JFrog CLI..."
else
echo "Downloading the latest version of JFrog CLI..."
fi
echo ""

if echo "${OSTYPE}" | grep -q msys; then
if uname -s | grep -q -E -i "(cygwin|mingw|msys|windows)"; then
CLI_OS="windows"
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-windows-amd64/jf.exe"
FILE_NAME="jf.exe"
elif echo "${OSTYPE}" | grep -q darwin; then
ARCH="amd64"
FILE_NAME="${FILE_NAME}.exe"
elif uname -s | grep -q -i "darwin"; then
CLI_OS="mac"
if [[ $(uname -m) == 'arm64' ]]; then
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-mac-arm64/jf"
if [ "$(uname -m)" = "arm64" ]; then
ARCH="arm64"
else
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-mac-386/jf"
ARCH="386"
fi
FILE_NAME="jf"
else
CLI_OS="linux"
MACHINE_TYPE="$(uname -m)"
Expand Down Expand Up @@ -55,12 +57,12 @@ else
exit 1
;;
esac
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/jf"
FILE_NAME="jf"
fi

URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/${FILE_NAME}"
echo "Downloading from: $URL"
curl -XGET "$URL" -L -k -g > $FILE_NAME
chmod u+x $FILE_NAME
chmod +x $FILE_NAME

# Move executable to a destination in path.
# Order is by destination priority.
Expand Down
30 changes: 16 additions & 14 deletions build/installcli/jfrog.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
#!/bin/bash
#!/bin/sh
set -u

# This script is downloading the OS-specific JFrog CLI binary with the name - 'jfrog', and adds it to PATH

CLI_OS="na"
CLI_MAJOR_VER="v2"
VERSION="[RELEASE]"
FILE_NAME="jfrog"

if [ $# -eq 1 ]
then
if [ $# -eq 1 ]; then
VERSION=$1
echo "Downloading version $VERSION of JFrog CLI..."
else
echo "Downloading the latest version of JFrog CLI..."
fi
echo ""

if echo "${OSTYPE}" | grep -q msys; then
if uname -s | grep -q -E -i "(cygwin|mingw|msys|windows)"; then
CLI_OS="windows"
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-windows-amd64/jfrog.exe"
FILE_NAME="jfrog.exe"
elif echo "${OSTYPE}" | grep -q darwin; then
ARCH="amd64"
FILE_NAME="${FILE_NAME}.exe"
elif uname -s | grep -q -i "darwin"; then
CLI_OS="mac"
if [[ $(uname -m) == 'arm64' ]]; then
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-mac-arm64/jfrog"
if [ "$(uname -m)" = "arm64" ]; then
ARCH="arm64"
else
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-mac-386/jfrog"
ARCH="386"
fi
FILE_NAME="jfrog"
else
CLI_OS="linux"
MACHINE_TYPE="$(uname -m)"
Expand Down Expand Up @@ -55,12 +57,12 @@ else
exit 1
;;
esac
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/jfrog"
FILE_NAME="jfrog"
fi

URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/${FILE_NAME}"
echo "Downloading from: $URL"
curl -XGET "$URL" -L -k -g > $FILE_NAME
chmod u+x $FILE_NAME
chmod +x $FILE_NAME

# Move executable to a destination in path.
# Order is by destination priority.
Expand Down
30 changes: 16 additions & 14 deletions build/setupcli/jf.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/bin/bash
#!/bin/sh
set -u

# This script is downloading the OS-specific JFrog CLI binary with the name - 'jf', adds it to PATH and prints greeting message

CLI_OS="na"
CLI_MAJOR_VER="v2-jf"
VERSION="[RELEASE]"
FILE_NAME="jf"
SETUP_COMMAND="jf setup"
GREEN_COLOR='\033[0;32m'
REMOVE_COLOR='\033[0m'
Expand All @@ -11,24 +15,22 @@ print_installation_greeting () {
echo "${GREEN_COLOR}Thank you for installing JFrog CLI! 🐸 ${REMOVE_COLOR}"
}

if [ $# -eq 1 ]
then
if [ $# -eq 1 ]; then
SETUP_COMMAND="$SETUP_COMMAND $1"
fi

echo "Downloading the latest version of JFrog CLI..."
if echo "${OSTYPE}" | grep -q msys; then
if uname -s | grep -q -E -i "(cygwin|mingw|msys|windows)"; then
CLI_OS="windows"
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-windows-amd64/jf.exe"
FILE_NAME="jf.exe"
elif echo "${OSTYPE}" | grep -q darwin; then
ARCH="amd64"
FILE_NAME="${FILE_NAME}.exe"
elif uname -s | grep -q -i "darwin"; then
CLI_OS="mac"
if [[ $(uname -m) == 'arm64' ]]; then
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-mac-arm64/jf"
if [ "$(uname -m)" = "arm64" ]; then
ARCH="arm64"
else
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-mac-386/jf"
ARCH="386"
fi
FILE_NAME="jf"
else
CLI_OS="linux"
MACHINE_TYPE="$(uname -m)"
Expand Down Expand Up @@ -59,12 +61,12 @@ else
exit 1
;;
esac
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/jf"
FILE_NAME="jf"
fi

URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/${FILE_NAME}"
echo "Downloading from: $URL"
curl -XGET "$URL" -L -k -g > $FILE_NAME
chmod u+x $FILE_NAME
chmod +x $FILE_NAME

# Move executable to a destination in path.
# Order is by destination priority.
Expand Down
Loading