Skip to content

Conversation

@blinkagent
Copy link
Contributor

@blinkagent blinkagent bot commented Dec 13, 2025

Summary

Fixes a race condition when multiple git-clone modules with post_clone_script run concurrently.

Problem

All instances of the git-clone module use the same hardcoded /tmp/post_clone.sh path. When multiple modules run concurrently (or overlap), they collide on the same temp file, causing:

rm: cannot remove '/tmp/post_clone.sh': No such file or directory

This results in a non-zero exit code, causing the workspace to appear unhealthy.

Solution

Use mktemp to generate a unique temporary filename for each module instance:

POST_CLONE_TMP=$(mktemp /tmp/post_clone_XXXXXX.sh)

This ensures each concurrent execution uses its own temp file, eliminating the race condition.

Fixes #600

@matifali matifali added the version:patch Add to PRs requiring a patch version upgrade label Dec 13, 2025
@github-actions
Copy link
Contributor

❌ Version Bump Validation Failed

Bump Type: patch

Module versions need to be updated but haven't been bumped yet.

Required Actions:

  1. Run the version bump script locally: ./.github/scripts/version-bump.sh patch
  2. Commit the changes: git add . && git commit -m "chore: bump module versions (patch)"
  3. Push the changes: git push

Script Output:

🔍 Detecting modified modules...
Found modules:
registry/coder/modules/git-clone

📦 Processing: coder/git-clone
Found git tag: release/coder/git-clone/v1.2.2 (v1.2.2)
Current version: 1.2.2
New version: 1.2.3
Updating version references for coder/git-clone in registry/coder/modules/git-clone/README.md

🔧 Running formatter to ensure consistent formatting...

📋 Summary:
Bump Type: patch

Modules Updated:

- coder/git-clone: v1.2.2 → v1.2.3

READMEs Updated:

- coder/git-clone

✅ Version bump completed successfully!
📝 README files have been updated with new versions.

Next steps:
1. Review the changes: git diff
2. Commit the changes: git add . && git commit -m 'chore: bump module versions (patch)'
3. Push the changes: git push

Please update the module versions and push the changes to continue.

@DevelopmentCats
Copy link
Contributor

I'm testing this now to make sure the issue is resolved and then I will merge

@DevelopmentCats
Copy link
Contributor

This works perfectly and LGTM

@DevelopmentCats DevelopmentCats merged commit ab6799a into main Dec 15, 2025
4 checks passed
@DevelopmentCats DevelopmentCats deleted the fix/git-clone-post-script-race-condition branch December 15, 2025 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

version:patch Add to PRs requiring a patch version upgrade

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: multiple git-clone modules with post_clone_scripts will fail due to hard-coded path

3 participants