这是indexloc提供的服务,不要输入任何密码
Skip to content

[turborepo] turbo prune in v1.7.1 generates turbo.json file that breaks commands #3570

@jplwood

Description

@jplwood

What version of Turborepo are you using?

1.7.1

What package manager are you using / does the bug impact?

npm

What operating system are you using?

Linux

Describe the Bug

originally posted as a comment here: #3564, but I think it’s actually a separate issue than the one described there

My CI dockerfile build randomly started failing today when seemingly nothing changed. I noticed that my dockerfile blindly globally installs the latest turbo in order to prune the repo, so we started using 1.7.1 today. I get the following error on my turbo build step, after I've already pruned my repo:

Step 17/33 : RUN npm run build -- --filter=api... &&     npm prune --omit=dev
 ---> Running in 1e638563d2dc

> traveler-recruitment@0.0.0 build
> turbo run build --filter=api...

 ERROR  run failed: turbo.json: json: cannot unmarshal number into Go struct field rawTurboJSON.pipeline of type string
Turbo error: turbo.json: json: cannot unmarshal number into Go struct field rawTurboJSON.pipeline of type string
The command '/bin/sh -c npm run build -- --filter=api... &&     npm prune --omit=dev' returned a non-zero code: 1

Upon trying out the turbo prune locally on 1.7.0 and 1.7.1, the generated turbo.json files are significantly different. Nothing is wrong per se with the version produced by 1.7.1, but turbo build is clearly unhappy about this differently formatted turbo.json file.

1.7.0 turbo.json
{
  "$schema": "https://turbo.build/schema.json",
  "pipeline": {
    "dev": {
      "dependsOn": ["^build"],
      "outputs": [],
      "cache": false,
      "persistent": true
    },
    "build": {
      "dependsOn": ["^build"],
      "outputs": ["build/**", "dist/**"],
      "outputMode": "new-only"
    },
    "lint": {
      "dependsOn": ["^build"],
      "outputs": [],
      "outputMode": "new-only"
    },
    "test": {
      "outputs": ["coverage/**"],
      "dependsOn": ["^build"],
      "inputs": ["src/**/*.tsx", "src/**/*.ts", "jest.config.ts", "jest-setup.ts"],
      "outputMode": "new-only"
    },
    "test:watch": {
      "cache": false,
      "persistent": true
    },
    "clean": {
      "cache": false
    }
  }
}
1.7.1 turbo.json
{
  "pipeline": {
    "build": {
      "Outputs": { "Inclusions": ["build/**", "dist/**"], "Exclusions": null },
      "ShouldCache": true,
      "EnvVarDependencies": [],
      "TopologicalDependencies": ["build"],
      "TaskDependencies": [],
      "Inputs": null,
      "OutputMode": 3,
      "Persistent": false
    },
    "clean": {
      "Outputs": { "Inclusions": null, "Exclusions": null },
      "ShouldCache": false,
      "EnvVarDependencies": [],
      "TopologicalDependencies": [],
      "TaskDependencies": [],
      "Inputs": null,
      "OutputMode": 0,
      "Persistent": false
    },
    "dev": {
      "Outputs": { "Inclusions": null, "Exclusions": null },
      "ShouldCache": false,
      "EnvVarDependencies": [],
      "TopologicalDependencies": ["build"],
      "TaskDependencies": [],
      "Inputs": null,
      "OutputMode": 0,
      "Persistent": true
    },
    "lint": {
      "Outputs": { "Inclusions": null, "Exclusions": null },
      "ShouldCache": true,
      "EnvVarDependencies": [],
      "TopologicalDependencies": ["build"],
      "TaskDependencies": [],
      "Inputs": null,
      "OutputMode": 3,
      "Persistent": false
    },
    "test": {
      "Outputs": { "Inclusions": ["coverage/**"], "Exclusions": null },
      "ShouldCache": true,
      "EnvVarDependencies": [],
      "TopologicalDependencies": ["build"],
      "TaskDependencies": [],
      "Inputs": ["src/**/*.tsx", "src/**/*.ts", "jest.config.ts", "jest-setup.ts"],
      "OutputMode": 3,
      "Persistent": false
    },
    "test:watch": {
      "Outputs": { "Inclusions": null, "Exclusions": null },
      "ShouldCache": false,
      "EnvVarDependencies": [],
      "TopologicalDependencies": [],
      "TaskDependencies": [],
      "Inputs": null,
      "OutputMode": 0,
      "Persistent": true
    }
  },
  "remoteCache": {}
}

My workaround for now is pinning the turbo version to 1.7.0 for my docker build

Expected Behavior

turbo prune should generate a turbo.json file that can be used by turbo CLI commands

To Reproduce

run turbo prune on 1.7.1 and 1.7.0, the turbo.json file generated in the /out/ dir in 1.7.1 doesn’t work with the turbo commands you configured in your root turbo.json. Should be able to confirm this with a docker build in the with-docker example, though I haven’t tried that one yet (also it uses yarn, so not positive if this is only NPM)

I’ll try to get more detail in here tomorrow

Reproduction Repo

No response

Metadata

Metadata

Labels

kind: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions