Skip to content
Open
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
31 changes: 29 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
run: ./setup-cli/assert/not-installed.sh
shell: bash

- run: curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/${{ github.sha }}/install.sh | sh
- run: curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/install.sh | sh
shell: bash

- run: databricks version
Expand All @@ -189,6 +189,33 @@ jobs:
if: matrix.os == 'windows-latest'
run: ./setup-cli/assert/path.sh /c/Windows/databricks

- run: rm -f "$(which databricks)"
if: matrix.os != 'windows-latest'
shell: bash

- name: Assert databricks CLI is not already installed
run: ./setup-cli/assert/not-installed.sh
if: matrix.os != 'windows-latest'
shell: bash

- run: curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/install.sh | sh -s ~/.local/bin
if: matrix.os != 'windows-latest'
shell: bash

- run: PATH="$HOME/.local/bin:$PATH" databricks version
if: matrix.os != 'windows-latest'
shell: bash

- name: Assert the version of the CLI installed
run: PATH="$HOME/.local/bin:$PATH" ./setup-cli/assert/version.sh $(cat ./setup-cli/VERSION)
if: matrix.os != 'windows-latest'
shell: bash

- name: Assert installation path is ~/.local/bin for non-windows platforms
run: ./setup-cli/assert/path.sh ~/.local/bin/databricks
if: matrix.os != 'windows-latest'
shell: bash

curl-dbr:
# All DBR images are built on top of Ubuntu
runs-on: ubuntu-latest
Expand All @@ -206,7 +233,7 @@ jobs:
run: ./setup-cli/assert/not-installed.sh
shell: bash

- run: curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/${{ github.sha }}/install.sh | sh
- run: curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/install.sh | sh
shell: bash
env:
DATABRICKS_RUNTIME_VERSION: value-does-not-matter
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ To install a specific version, you can replace `main` with a specific release ta
curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/v0.243.0/install.sh | sh
```

To install a specific version, in a specific location (e.g. `~/.local/bin`):

```bash
curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/v0.243.0/install.sh | sh -s ~/.local/bin
```

## GitHub Actions

This repository can be used from GitHub Actions.
Expand Down
8 changes: 8 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ MINGW64_NT)
;;
esac

# Check for a command-line argument for the target directory
if [ "$#" -gt 0 ]; then
TARGET="$1"
fi

# Set target to ~/bin if DATABRICKS_RUNTIME_VERSION environment variable is set.
if [ -n "$DATABRICKS_RUNTIME_VERSION" ]; then
# Set the installation target to ~/bin when run on DBR
Expand Down Expand Up @@ -57,6 +62,9 @@ arm64|aarch64)
;;
esac

# Create the target directory if it does not exist
mkdir -p "$TARGET"

# Make sure the target directory is writable.
if [ ! -w "$TARGET" ]; then
echo "Target directory $TARGET is not writable."
Expand Down