zl程序教程

您现在的位置是:首页 >  其他

当前栏目

1分钟快速使用Docker上手新版Sentry-CLI - 创建一个版本

2023-04-18 13:15:38 时间

 

 

本文转载自微信公众号「黑客下午茶」,作者为少。转载本文请联系黑客下午茶公众号。

我们可以使用官方 sentry-cli 工具操作 Sentry API,从而来为你的项目管理一些数据。它主要用于管理 iOS、Android 的调试信息文件,以及其他平台的版本(release)和源代码映射(source maps)管理。

安装

Docker 镜像

默认情况下,该命令在 /work 目录中运行。挂载相关的你的项目文件夹并在那里构建输出以允许 sentry-cli 扫描资源:

  1. # 拉取镜像 
  2. docker pull getsentry/sentry-cli 
  3. # 执行命令 
  4. docker run --rm -v $(pwd):/work getsentry/sentry-cli --help 
  5. # sentry-cli 1.68.0 
  6.  
  7. # Command line utility for Sentry. 
  8.  
  9. # This tool helps you manage remote resources on a Sentry server like 
  10. # sourcemaps, debug symbols or releases.  Use `--help` on the subcommands 
  11. to learn more about them. 
  12.  
  13. # USAGE: 
  14. #     sentry-cli <SUBCOMMAND> 
  15.  
  16. # OPTIONS: 
  17. #         --api-key <API_KEY> 
  18. #             The given Sentry API key
  19.  
  20. #         --auth-token <AUTH_TOKEN> 
  21. #             Use the given Sentry auth token. 
  22.  
  23. #     -h, --help 
  24. #             Print this help message. 
  25.  
  26. #         --log-level <LOG_LEVEL> 
  27. #             Set the log output verbosity. [possible values: trace, debug, info, warn, error] 
  28.  
  29. #         --url <URL> 
  30. #             Fully qualified URL to the Sentry server. 
  31. #             [defaults to https://sentry.io/] 
  32. #     -V, --version 
  33. #             Print version information. 
  34.  
  35.  
  36. # SUBCOMMANDS: 
  37. #     bash-hook          Prints out a bash script that does error handling. 
  38. #     difutil            Locate or analyze debug information files. 
  39. #     help               Prints this message or the help of the given subcommand(s) 
  40. #     info               Print information about the Sentry server. 
  41. #     issues             Manage issues in Sentry. 
  42. #     login              Authenticate with the Sentry server. 
  43. #     projects           Manage projects on Sentry. 
  44. #     react-native       Upload build artifacts for react-native projects. 
  45. #     releases           Manage releases on Sentry. 
  46. #     repos              Manage repositories on Sentry. 
  47. #     send-event         Send a manual event to Sentry. 
  48. #     upload-dif         Upload debugging information files. 
  49. #     upload-proguard    Upload ProGuard mapping files to a project. 

配置和认证

配置文件

sentry-cli 工具可以使用名为 .sentryclirc 的配置文件以及环境变量和 .env 文件进行配置。从当前路径向上查找配置文件,并且始终加载 ~/.sentryclirc 中的默认值。您还可以从命令行参数覆盖这些设置。

.sentryclirc

  1. [auth] 
  2. token=your-auth-token 
  3.  
  4. [defaults] 
  5. org=sentry 
  6. project=react-sentry-demo 
  7. url=https://x.xxx.com 

进入容器内

创建一个新版本:

  1. docker run --rm -it -v $(pwd):/work getsentry/sentry-cli /bin/sh 
  2.  
  3. sentry-cli releases new 1.0.0 

Refs

https://docs.sentry.io/product/cli/