semver icon indicating copy to clipboard operation
semver copied to clipboard

Another git process seems to be running in this repository

Open christophediprima opened this issue 3 years ago • 4 comments

I am trying to run this command on my lerna monorepo and I always have issues with '/.git/index.lock': File exists.

yarn nx run-many --target=version --all --trackDeps

It looks like it is trying to commit files in two independent packages at the same time.

My nx.json looks like this:

{
  "extends": "@nrwl/workspace/presets/npm.json",
  "npmScope": "frontend",
  "tasksRunnerOptions": {
    "default": {
      "runner": "@nrwl/nx-cloud",
      "options": {
        "cacheableOperations": ["build", "test", "lint", "package", "prepare"],
        "runtimeCacheInputs": ["node -v"],
        "accessToken": "***",
        "url": "***"
      }
    }
  },
  "targetDependencies": {
    "build": [
      {
        "target": "build",
        "projects": "dependencies"
      }
    ],
    "prepare": [
      {
        "target": "prepare",
        "projects": "dependencies"
      }
    ],
    "package": [
      {
        "target": "package",
        "projects": "dependencies"
      }
    ],
    "version": [
      {
        "target": "version",
        "projects": "dependencies"
      }
    ]
  },
  "affected": {
    "defaultBase": "master"
  }
}

My dependencies:

{
"devDependencies": {
    "@commitlint/cli": "^15.0.0",
    "@commitlint/config-angular": "^15.0.0",
    "@jscutlery/semver": "^2.13.3",
    "@nrwl/nx-cloud": "^13.0.0",
    "@nrwl/workspace": "^13.1.4",
    "nx": "^13.1.4"
}}

christophediprima avatar Dec 15 '21 09:12 christophediprima

OK I guess posting this issue helped me on finding the solution!

I just added parallel=1 to the command.

It would be nice to mention this in the documentation as I guess this is a common use case.

christophediprima avatar Dec 15 '21 09:12 christophediprima

It still seems like there is some sort of race condition still happening. I used parallel=1 inline (I'm not entirely sure if that is the correct way to use it either with digging into the nx code base or docs more), and it seemed to have helped but I still occasionally get the fatal error in my CI for my repo with 17 different projects:

https://app.circleci.com/pipelines/github/dereekb/dbx-components/446/workflows/5f0ed268-07d8-4be4-86ed-7556deead13f/jobs/955

I still need to dig into it a bit more and try adding the configuration to the nx task runner configuration, but I don't want to disable default parallel processing for all tasks either.

dereekb avatar May 15 '22 05:05 dereekb

@edbzn there is a way to run the versioning in parallel?

ild0tt0re avatar Apr 17 '23 11:04 ild0tt0re

I am running into the same issue. Parallel=1 solves it, but I would like to be able to run my versioning in parallel so its faster...

faileon avatar Jan 05 '24 13:01 faileon