From 0089cf1b4f00478997212a88464137097617f16e Mon Sep 17 00:00:00 2001 From: zyy17 Date: Thu, 14 Nov 2024 05:54:24 +0800 Subject: [PATCH] fix: run `install.sh` error (#4989) * fix: use '/bin/sh' shebang and remove function key word * ci: check install.sh in nightly CI --- .github/scripts/check-install-script.sh | 14 ++++++++++++++ .github/workflows/nightly-ci.yml | 4 ++++ scripts/install.sh | 8 ++++---- 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100755 .github/scripts/check-install-script.sh diff --git a/.github/scripts/check-install-script.sh b/.github/scripts/check-install-script.sh new file mode 100755 index 000000000000..37232320801c --- /dev/null +++ b/.github/scripts/check-install-script.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +# Get the latest version of github.com/GreptimeTeam/greptimedb +VERSION=$(curl -s https://api.github.com/repos/GreptimeTeam/greptimedb/releases/latest | jq -r '.tag_name') + +echo "Downloading the latest version: $VERSION" + +# Download the install script +curl -fsSL https://raw.githubusercontent.com/greptimeteam/greptimedb/main/scripts/install.sh | sh -s $VERSION + +# Execute the `greptime` command +./greptime --version diff --git a/.github/workflows/nightly-ci.yml b/.github/workflows/nightly-ci.yml index 5b47b49ff018..b6ff247ffb9e 100644 --- a/.github/workflows/nightly-ci.yml +++ b/.github/workflows/nightly-ci.yml @@ -22,6 +22,10 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + + - name: Check install.sh + run: ./.github/scripts/check-install-script.sh + - name: Run sqlness test uses: ./.github/actions/sqlness-test with: diff --git a/scripts/install.sh b/scripts/install.sh index 4a2bd8415146..6b5103ec4469 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh set -ue @@ -15,7 +15,7 @@ GITHUB_ORG=GreptimeTeam GITHUB_REPO=greptimedb BIN=greptime -function get_os_type() { +get_os_type() { os_type="$(uname -s)" case "$os_type" in @@ -31,7 +31,7 @@ function get_os_type() { esac } -function get_arch_type() { +get_arch_type() { arch_type="$(uname -m)" case "$arch_type" in @@ -53,7 +53,7 @@ function get_arch_type() { esac } -function download_artifact() { +download_artifact() { if [ -n "${OS_TYPE}" ] && [ -n "${ARCH_TYPE}" ]; then # Use the latest stable released version. # GitHub API reference: https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#get-the-latest-release.