Skip to content

fix: Add project name to command locking#6086

Merged
jamengual merged 3 commits intorunatlantis:mainfrom
carmennavarreteh:add-project-name-to-command-locking
Jan 21, 2026
Merged

fix: Add project name to command locking#6086
jamengual merged 3 commits intorunatlantis:mainfrom
carmennavarreteh:add-project-name-to-command-locking

Conversation

@carmennavarreteh
Copy link
Contributor

@carmennavarreteh carmennavarreteh commented Jan 16, 2026

what

  • Added projectName parameter to the working directory locking mechanism to create more granular locks per project within a pull request
  • Updated the TryLock method signature to include projectName as a required parameter across all command runners (plan, apply, import, pre/post workflow hooks)
  • Modified the lock key generation to include project name in the format: repo/pull/workspace/path/projectName
  • Updated all tests to include project name in lock assertions and expectations

why

  • Prevents lock conflicts between projects: Without project name in the lock key, two different projects in the same workspace and path would conflict with each other, blocking parallel operations
  • Enables parallel project execution: By including project name in the lock, multiple projects can run simultaneously in the same workspace as long as they have different project names
  • More accurate lock representation: The lock now accurately represents what is being locked (a specific project configuration) rather than just a workspace/path combination

tests

  • I have updated all existing tests to include the projectName parameter in TryLock calls
  • I have added new test TestTryLockDifferentProjectNames to verify that different project names can lock independently
  • I have added new test TestUnlockDifferentProjectNames to verify unlocking works correctly for different project names
  • I test the version 0.36.0 against this new change and it is working

references

@dosubot dosubot bot added bug Something isn't working go Pull requests that update Go code labels Jan 16, 2026
@github-actions github-actions bot removed the bug Something isn't working label Jan 16, 2026
@carmennavarreteh carmennavarreteh force-pushed the add-project-name-to-command-locking branch from c6980be to 761ab55 Compare January 16, 2026 17:07
@jamengual jamengual requested a review from lukemassa January 16, 2026 17:53
Signed-off-by: Carmen Navarrete Hernandez <carmennavarreteh@gmail.com>
@carmennavarreteh carmennavarreteh force-pushed the add-project-name-to-command-locking branch from 761ab55 to b5a1e46 Compare January 16, 2026 17:56
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 19, 2026
@jamengual jamengual merged commit 3dd1eba into runatlantis:main Jan 21, 2026
39 of 40 checks passed
@jamengual
Copy link
Contributor

thanks @carmennavarreteh for the contribution

carmennavarreteh added a commit to carmennavarreteh/atlantis-fork that referenced this pull request Jan 21, 2026
Signed-off-by: Carmen Navarrete Hernandez <carmennavarreteh@gmail.com>
Co-authored-by: PePe Amengual <2208324+jamengual@users.noreply.github.com>
Signed-off-by: Carmen Navarrete Hernandez <carmennavarreteh@gmail.com>
@albertorm95 albertorm95 mentioned this pull request Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update Go code lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants