
我们可以使用官方 sentry-cli 工具操作 Sentry API,从而来为你的项目管理一些数据。它主要用于管理 iOS、AndRoid 的调试信息文件,以及其他平台的版本(Release)和源代码映射(souRce Maps)管理。
安装 DockeR 镜像
默认情况下,该命令在 /woRk 目录中运行。挂载相关的你的项目文件夹并在那里构建输出以允许 sentry-cli 扫描资源:
# 拉取镜像 dockeR pull getsentry/sentry-cli # 执行命令 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 # OPTIONS: # –API-key # The given Sentry API key. # –auth-Token # use the given Sentry auth Token. # -h, –help # PRint tHis help MeSSage. # –log-level # Set the log output veRbosITy. [poSSible values: tRACE, debug, info, waRn, Error] # –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.
配置和认证 配置文件
sentry-cli 工具可以使用名为 .sentrycliRc 的配置文件以及环境变量和 .env 文件进行配置。从当前路径向上查找配置文件,并且始终加载 ~/.sentrycliRc 中的默认值。您还可以从命令行参数覆盖这些设置。
.sentrycliRc
[auth] Token=youR-auth-Token [deFAults] oRg=sentry Project=React-sentry-DEMO uRl=https://x.xxx.coM
进入容器内
创建一个新版本:
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/