圆ci 2. sentry-cli找不到找到dist文件夹来上传源地图

时间:2018-04-05 11:45:35

标签: docker sentry circleci-2.0

我有一个Reactjs web项目,我使用web pack。当我做一个prod构建时,会在其中创建一个dist文件夹,其中包含源映射。然后,每次创建新标签时,我都会在Sentry中创建一个新版本。但是圆圈找不到docker图像中的dist文件夹,这意味着圆形构建失败。

  - run:
      name: Install sentry-cli
      command: curl -sL https://sentry.io/get-cli/ | bash

  - run:
      name: Create new sentry release from latest tag
      command: sentry-cli releases -o my-org -p my-project new ${CIRCLE_TAG/v/}

  - run:
      name: Upload Source Maps to sentry
      command: sentry-cli releases -o my-org -p my-project files ${CIRCLE_TAG/v/} upload-sourcemaps ./dist

我在将新标记推送到docker之后运行此命令,但是我收到此错误。

error: ./dist: IO error for operation on ./dist: No such file or directory (os error 2)
Exited with code 1

如何才能使用源地图访问我的dist文件夹?

1 个答案:

答案 0 :(得分:1)

我不确定您的项目是如何设置的 - 但通常dist文件夹位于.gitignore但未上传到GIT,因此在CI中不可用。

如果您在CI上构建应用,则dist文件夹将可用。我假设您的构建命令是npm run build,但也可能是yarn build或用于构建应用程序的任何自定义命令。

- run:
    name: Build react application
    command: npm run build

- run:
    name: Install sentry-cli
    command: curl -sL https://sentry.io/get-cli/ | bash

- run:
    name: Create new sentry release from latest tag
    command: sentry-cli releases -o my-org -p my-project new ${CIRCLE_TAG/v/}

- run:
    name: Upload Source Maps to sentry
    command: sentry-cli releases -o my-org -p my-project files ${CIRCLE_TAG/v/} upload-sourcemaps ./dist