Skip to content

Commit

Permalink
added not installed check
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas-goenka committed Feb 22, 2024
1 parent dbbcefb commit 5138a84
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 5 deletions.
48 changes: 43 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ jobs:
- run: env
shell: bash

- name: Assert databricks CLI is not already installed
run: ./setup-cli/assert/not-installed.sh
shell: bash

- run: ./setup-cli/install.sh
shell: bash

Expand Down Expand Up @@ -108,15 +112,21 @@ jobs:
with:
path: ./setup-cli

- run: ./setup-cli/install.sh
# Append ~/bin to the PATH. This helps with the assertions in the next steps.
- run: echo "PATH=$PATH:$HOME/bin" >> $GITHUB_ENV

- name: Assert databricks CLI is not already installed
run: ./setup-cli/assert/not-installed.sh
shell: bash

- name: Install the CLI
run: ./setup-cli/install.sh
shell: bash
env:
DATABRICKS_RUNTIME_VERSION: value-does-not-matter

# Append ~/bin to the PATH. This helps with the assertions in the next steps.
- run: echo "PATH=$PATH:$HOME/bin" >> $GITHUB_ENV

- run: databricks version
- name: Run the CLI
run: databricks version
shell: bash

- name: Assert the version of the CLI installed
Expand Down Expand Up @@ -190,3 +200,31 @@ jobs:
- name: Assert installation path is ~/bin
run: ./setup-cli/assert/path.sh ~/bin/databricks
shell: bash

curl-dbr-main:
# All DBR images are built on top of Ubuntu
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
path: ./setup-cli

- run: curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/${{ github.sha }}/install.sh | sh
shell: bash
env:
DATABRICKS_RUNTIME_VERSION: value-does-not-matter

# Append ~/bin to the PATH. This helps with the assertions in the next steps.
- run: echo "PATH=$PATH:$HOME/bin" >> $GITHUB_ENV

- run: databricks version
shell: bash

- name: Assert the version of the CLI installed
run: ./setup-cli/assert/version.sh $(cat ./setup-cli/VERSION)
shell: bash

- name: Assert installation path is ~/bin
run: ./setup-cli/assert/path.sh ~/bin/databricks
shell: bash
10 changes: 10 additions & 0 deletions assert/not-installed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -euo pipefail

# Assert databricks CLI is not already installed
if which databricks >/dev/null 2>&1; then
exit 1
else
exit 0
fi

0 comments on commit 5138a84

Please sign in to comment.