1分鐘快速使用Docker上手新版Sentry-CLI - 創(chuàng)建一個(gè)版本
本文轉(zhuǎn)載自微信公眾號(hào)「黑客下午茶」,作者為少。轉(zhuǎn)載本文請(qǐng)聯(lián)系黑客下午茶公眾號(hào)。
我們可以使用官方 sentry-cli 工具操作 Sentry API,從而來(lái)為你的項(xiàng)目管理一些數(shù)據(jù)。它主要用于管理 iOS、Android 的調(diào)試信息文件,以及其他平臺(tái)的版本(release)和源代碼映射(source maps)管理。
安裝
Docker 鏡像
默認(rèn)情況下,該命令在 /work 目錄中運(yùn)行。掛載相關(guān)的你的項(xiàng)目文件夾并在那里構(gòu)建輸出以允許 sentry-cli 掃描資源:
- # 拉取鏡像
- docker pull getsentry/sentry-cli
- # 執(zhí)行命令
- docker run --rm -v $(pwd):/work getsentry/sentry-cli --help
- # sentry-cli 1.68.0
- # Command line utility for Sentry.
- # This tool helps you manage remote resources on a Sentry server like
- # sourcemaps, debug symbols or releases. Use `--help` on the subcommands
- # to learn more about them.
- # USAGE:
- # sentry-cli <SUBCOMMAND>
- # OPTIONS:
- # --api-key <API_KEY>
- # The given Sentry API key.
- # --auth-token <AUTH_TOKEN>
- # Use the given Sentry auth token.
- # -h, --help
- # Print this help message.
- # --log-level <LOG_LEVEL>
- # Set the log output verbosity. [possible values: trace, debug, info, warn, error]
- # --url <URL>
- # Fully qualified URL to the Sentry server.
- # [defaults to https://sentry.io/]
- # -V, --version
- # Print version information.
- # SUBCOMMANDS:
- # bash-hook Prints out a bash script that does error handling.
- # difutil Locate or analyze debug information files.
- # help Prints this message or the help of the given subcommand(s)
- # info Print information about the Sentry server.
- # issues Manage issues in Sentry.
- # login Authenticate with the Sentry server.
- # projects Manage projects on Sentry.
- # react-native Upload build artifacts for react-native projects.
- # releases Manage releases on Sentry.
- # repos Manage repositories on Sentry.
- # send-event Send a manual event to Sentry.
- # upload-dif Upload debugging information files.
- # upload-proguard Upload ProGuard mapping files to a project.
配置和認(rèn)證
配置文件
sentry-cli 工具可以使用名為 .sentryclirc 的配置文件以及環(huán)境變量和 .env 文件進(jìn)行配置。從當(dāng)前路徑向上查找配置文件,并且始終加載 ~/.sentryclirc 中的默認(rèn)值。您還可以從命令行參數(shù)覆蓋這些設(shè)置。
.sentryclirc
- [auth]
- token=your-auth-token
- [defaults]
- org=sentry
- project=react-sentry-demo
- url=https://x.xxx.com
進(jìn)入容器內(nèi)
創(chuàng)建一個(gè)新版本:
- docker run --rm -it -v $(pwd):/work getsentry/sentry-cli /bin/sh
- sentry-cli releases new 1.0.0
Refs
https://docs.sentry.io/product/cli/