Skip to content

Commit

Permalink
add tanzu cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Proud committed Oct 3, 2023
1 parent 78ca9e6 commit d6a415c
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 9 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/test-tanzu-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: test-uaa-cli
on: [push, pull_request]

jobs:
test-latest:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install asdf and checkout latest tag
run: |
set -e
if [ -n "$GITHUB_RUN_ID" ]; then
export GITHUB_API_TOKEN="${{ secrets.GITHUB_TOKEN }}"
fi
./tests/setup-env.sh
- name: Test asdf script
run: |
set -e
if [ -n "$GITHUB_RUN_ID" ]; then
export GITHUB_API_TOKEN="${{ secrets.GITHUB_TOKEN }}"
fi
./tests/run-tests.sh tanzu-cli
test-0-6-3:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Manually add plugings to repository
run: |
set -e
export ASDF_LEGACY=true
if [ -n "$GITHUB_RUN_ID" ]; then
export GITHUB_API_TOKEN="${{ secrets.GITHUB_TOKEN }}"
fi
./tests/setup-env.sh
- name: Test plugin
run: |
set -e
export ASDF_LEGACY=true
if [ -n "$GITHUB_RUN_ID" ]; then
export GITHUB_API_TOKEN="${{ secrets.GITHUB_TOKEN }}"
fi
./tests/run-tests.sh tanzu-cli
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ASDF allows you to install multiple versions of a single tool and switch between
- kpack
- om
- pivnet
- tanzu-cli
- uaa-cli

## Prerequisites
Expand Down
8 changes: 2 additions & 6 deletions bin/download
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,11 @@ function extract_and_move() {

function move_largest_file() {
local -r downloaded_file="$1"
local -r download_path=$(dirname $downloaded_file)
rm "${downloaded_file}"

# Select the largest extracted file starting with file_name
extracted_file="$( ls -d -1 "${download_dir}/${file_name}"* | head -n 1 )"

# if tar/zip outputs a directory, select the largest file as the target
if [[ -d ${extracted_file} ]]; then
extracted_file="$( ls -Sd -1 "${extracted_file}/"* | head -n 1 )"
fi
extracted_file="$( find $download_path -type f -printf '%s\t%p\n' | sort -n | tail -1 | awk '{print $2}' )"

mv "${extracted_file}" "${asdf_download_path}/${file_name}"
}
Expand Down
12 changes: 9 additions & 3 deletions products.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ setEnv() {
VERSION_COMMAND='--version'
;;
credhub)
REPO_SLUG='cloudfoundry-incubator/credhub-cli'
PRIMARY_GIT_TEMPLATE="${v}/credhub-${o}-${v}.tgz"
SECONDARY_GIT_TEMPLATE=""
REPO_SLUG='cloudfoundry/credhub-cli'
PRIMARY_GIT_TEMPLATE="${v}/credhub-${o}-amd64-${v}.tgz"
SECONDARY_GIT_TEMPLATE="${v}/credhub-${o}-${v}.tgz"
VERSION_COMMAND='--version'
;;
fly)
Expand All @@ -77,6 +77,12 @@ setEnv() {
SECONDARY_GIT_TEMPLATE=""
VERSION_COMMAND='version'
;;
tanzu)
REPO_SLUG='vmware-tanzu/tanzu-cli'
PRIMARY_GIT_TEMPLATE="v${v}/tanzu-cli-${o}-amd64.tar.gz"
SECONDARY_GIT_TEMPLATE=""
VERSION_COMMAND='version' #| grep version | sed -n -e "s/^.*version: v//p"
;;
uaa-cli)
REPO_SLUG='cloudfoundry/uaa-cli'
PRIMARY_GIT_TEMPLATE="${v}/uaa-${o}-amd64-${v}"
Expand Down
2 changes: 2 additions & 0 deletions tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function test_plugin() {
. "${script_dir}/../products.inc.sh" "${plugin_name}"

echo "Adding plugin $plugin_name"
rm -rf "${HOME}/.asdf/plugins/${plugin_name}"
mkdir -p "${HOME}/.asdf/plugins/${plugin_name}"
cp -r "$repo_dir" "${HOME}/.asdf/plugins/${plugin_name}"

Expand Down Expand Up @@ -58,6 +59,7 @@ function test_plugin() {
function test_plugins() {
plugin_name="${1:-}"
if [ -z "${plugin_name:-}" ]; then
test_plugin tanzu
test_plugin kpack-cli
test_plugin uaa-cli
test_plugin om
Expand Down

0 comments on commit d6a415c

Please sign in to comment.