Skip to content

Commit

Permalink
Merge pull request #20 from foomo/grafana-logcli
Browse files Browse the repository at this point in the history
feat(grafana/logcli): add
  • Loading branch information
franklinkim authored Jan 10, 2025
2 parents 7a62f30 + fe9d3ed commit cae42ca
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
11 changes: 10 additions & 1 deletion grafana/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Grafana


## K6 ([releases](https://github.com/grafana/k6/releases))

```yaml
Expand All @@ -10,3 +9,13 @@ ownbrew:
tap: foomo/tap/grafana/k6
version: 0.45.0
```
## Logcli ([releases](https://github.com/grafana/loki/releases))
```yaml
ownbrew:
packages:
- name: logcli
tap: foomo/tap/grafana/logcli
version: 3.3.2
```
46 changes: 46 additions & 0 deletions grafana/logcli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

set -e

# colors
CRed='\033[1;31m'
CGray='\033[0;37m'
CGreen='\033[1;32m'
CYellow='\033[1;33m'
NC='\033[0m'

# logging
info() {
echo -e "${CGray}${1}${NC}"
}

warn() {
echo -e "${CYellow}${1}${NC}"
}

error() {
echo -e "${CRed}${1}${NC}"
}

success() {
echo -e "${CGreen}${1}${NC}"
}

# vars
os="${os:-${1}}"
arch="${arch:-${2}}"
version="${version:-${3}}"

info "downloading ..."
curl -fL "https://github.com/grafana/loki/releases/download/v${version}/logcli-${os}-${arch}.zip" -o "${TEMP_DIR}/logcli.zip"
curl -fL "https://github.com/grafana/loki/releases/download/v${version}/SHA256SUMS" -o "${TEMP_DIR}/logcli.zip.sha256"

info "validating ..."
echo "$(cat "${TEMP_DIR}/logcli.zip.sha256" | grep "logcli-${os}-${arch}.zip" | awk '{print $1;}') ${TEMP_DIR}/logcli.zip" | shasum -a 256 --check --quiet

info "extracting ..."
unzip -p "${TEMP_DIR}/logcli.zip" "logcli-${os}-${arch}" > "${BIN_DIR}/logcli-v${version}-${os}-${arch}"
chmod a+x "${BIN_DIR}/logcli-v${version}-${os}-${arch}"

info "cleanup ..."
rm "${TEMP_DIR}/logcli.zip" "${TEMP_DIR}/logcli.zip.sha256"
5 changes: 5 additions & 0 deletions grafana/logcli_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

source .include/test.sh

test "$(dirname $0)/logcli.sh" "3.3.2"

0 comments on commit cae42ca

Please sign in to comment.