Skip to content

Commit f7dd396

Browse files
dploegerDennis Ploeger
authored andcommitted
feat: Support for Tanzucli
Includes fixes to the feature-installer-utils that came up during development
1 parent b063dd6 commit f7dd396

7 files changed

Lines changed: 41 additions & 4 deletions

File tree

assets/feature-installer-utils.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ function downloadFromGithub {
115115
TARGET=$6
116116

117117
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')"
118-
PACKAGE="${PACKAGE_PREFIX}${ARCH}.${PACKAGE_SUFFIX}"
119-
execHandle "Downloading ${USER}/${REPO}@${VERSION}" curl -f -s -L "https://github.com/${USER}/${REPO}/releases/${VERSION}/download/${PACKAGE}" --output "${TARGET}"
118+
PACKAGE="${PACKAGE_PREFIX}${ARCH}${PACKAGE_SUFFIX}"
119+
120+
execHandle "Downloading ${USER}/${REPO}@${VERSION}" curl -f -s -L "https://github.com/${USER}/${REPO}/releases/download/${VERSION}/${PACKAGE}" --output "${TARGET}"
120121
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Setup required environment for test
2-
export EXAMPLE_ENVIRONMENT=something
2+
EXAMPLE_ENVIRONMENT=something

feature/k9s/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fi
1010
TEMPDIR=$(mktemp -d)
1111
cd "${TEMPDIR}" || exit
1212

13-
downloadFromGithub derailed k9s "${K9S_VERSION}" k9s_Linux_ tar.gz k9s.tar.gz
13+
downloadFromGithub derailed k9s "${K9S_VERSION}" k9s_Linux_ .tar.gz k9s.tar.gz
1414

1515
execHandle "Unpacking k9s" tar xzf k9s.tar.gz
1616
execHandle "Installing k9s" mv k9s /home/cloudcontrol/bin

feature/tanzucli/feature.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
icon: ""
2+
3+
title: "Tanzu CLI"
4+
5+
description: "Installs the [Tanzu CLI](https://github.com/vmware-tanzu/tanzu-cli)"
6+
7+
configuration:
8+
- |
9+
Environment TANZU_CLI_VERSION: Tanzu CLI version to install (required)

feature/tanzucli/goss/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TANZUCLI_VERSION=1.4.0

feature/tanzucli/goss/goss.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
command:
2+
test:
3+
exec: "/home/cloudcontrol/bin/tanzu-cli version"
4+
stdout:
5+
- "version: v1.4.0"
6+
exit-status: 0

feature/tanzucli/install.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
. /feature-installer-utils.sh
2+
3+
if [ -n "${TANZUCLI_VERSION}" ]
4+
then
5+
prepare
6+
VERSION=$(checkAndCleanVersion "${TANZUCLI_VERSION}")
7+
SUFFIX=".tar.gz"
8+
if [ "$(getPlatform)" = "arm64" ]
9+
then
10+
SUFFIX="-unstable.tar.gz"
11+
fi
12+
downloadFromGithub vmware-tanzu tanzu-cli "v${VERSION}" tanzu-cli-linux- "${SUFFIX}" tanzu-cli-linux.tar.gz
13+
execHandle "Extracting tanzu cli" tar xzf tanzu-cli-linux.tar.gz
14+
execHandle "Installing tanzu cli" mv "${VERSION}"/tanzu-cli* "${BINPATH}/tanzu-cli"
15+
execHandle "Making tanzu cli executable" chmod +x "${BINPATH}/tanzu-cli"
16+
cleanup
17+
else
18+
echo "The tanzucli feature requires a version set using TANZUCLI_VERSION. See https://github.com/vmware-tanzu/tanzu-cli/releases for valid versions"
19+
exit 1
20+
fi

0 commit comments

Comments
 (0)