-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·64 lines (55 loc) · 2.41 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·64 lines (55 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
# opik-cipx installer — downloads the latest release for your OS/arch into
# ~/.opik-cipx/bin/.
#
# Usage:
# curl -fsSL https://raw.githubusercontent.com/comet-ml/cost-intelligence-proxy/main/install.sh | bash
# curl -fsSL https://raw.githubusercontent.com/comet-ml/cost-intelligence-proxy/main/install.sh | bash -s -- v0.0.35
#
# The repo is public, so no auth is needed. GH_TOKEN is honored if set (e.g.
# to raise the GitHub API rate limit).
#
# Override env vars:
# CIPX_VERSION Tag to install (default: latest release)
# CIPX_INSTALL_DIR Install dir (default: ~/.opik-cipx/bin)
# CIPX_REPO Override repo (default: comet-ml/cost-intelligence-proxy)
set -euo pipefail
CIPX_VERSION="${1:-${CIPX_VERSION:-latest}}"
CIPX_INSTALL_DIR="${CIPX_INSTALL_DIR:-$HOME/.opik-cipx/bin}"
CIPX_REPO="${CIPX_REPO:-comet-ml/cost-intelligence-proxy}"
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
arch="$(uname -m)"
case "$arch" in
x86_64|amd64) arch="amd64" ;;
arm64|aarch64) arch="arm64" ;;
*) echo "opik-cipx: unsupported arch $arch" >&2; exit 1 ;;
esac
case "$os" in
darwin|linux) ;;
*) echo "opik-cipx: unsupported os $os (only darwin and linux are supported)" >&2; exit 1 ;;
esac
archive="opik-cipx-${os}-${arch}.tar.gz"
# Resolve "latest" via the GitHub API (GH_TOKEN honored if set).
if [ "$CIPX_VERSION" = "latest" ]; then
api="https://api.github.com/repos/${CIPX_REPO}/releases/latest"
hdrs=(-H "Accept: application/vnd.github+json")
[ -n "${GH_TOKEN:-}" ] && hdrs+=(-H "Authorization: Bearer ${GH_TOKEN}")
CIPX_VERSION="$(curl -fsSL "${hdrs[@]}" "$api" | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p' | head -n1)"
if [ -z "$CIPX_VERSION" ]; then
echo "opik-cipx: could not resolve latest release tag" >&2
exit 1
fi
fi
url="https://github.com/${CIPX_REPO}/releases/download/${CIPX_VERSION}/${archive}"
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
echo "opik-cipx: downloading $url"
curl_args=(-fsSL)
[ -n "${GH_TOKEN:-}" ] && curl_args+=(-H "Authorization: Bearer ${GH_TOKEN}")
curl "${curl_args[@]}" -o "$tmp/$archive" "$url"
mkdir -p "$CIPX_INSTALL_DIR"
tar -xzf "$tmp/$archive" -C "$CIPX_INSTALL_DIR"
chmod +x "$CIPX_INSTALL_DIR"/opik-cipx
echo "opik-cipx: installed $CIPX_VERSION to $CIPX_INSTALL_DIR"
echo "opik-cipx: add $CIPX_INSTALL_DIR to your PATH, then run \`opik-cipx sync\`."
echo "© 2026 Comet ML, Inc. All rights reserved. This software is proprietary and confidential."