我有一个使用Web Pack的Reactjs Web项目。当我执行产品构建时,将在其中创建带有源映射的dist文件夹。然后,每次创建新标签时,我都会在Sentry中创建新版本。但是circle无法在docker镜像中找到dist文件夹,这意味着Circle构建失败。

  - 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

我怎样才能访问包含源 map 的dist文件夹?

最佳答案

我不确定您的项目的设置方式-但通常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

关于docker - Circle CI 2. Sentry-cli找不到查找dist文件夹以上传源 map ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49671578/

10-11 03:55