fix(git-clone): propagate pre/post-clone script failures#891
Draft
ikkz wants to merge 4 commits into
Draft
Conversation
The pre-clone and post-clone scripts were executed but their exit codes were never checked, silently ignoring failures. - Check exit code with if! and fail fast on non-zero - Clean up temp files before exiting on failure - Add tests for both pre-clone and post-clone script failures - Bump version 1.3.0 to 1.3.1
Collaborator
|
Hey, thanks for looking into this! The root cause here is actually that @ikkz Would you be open to swapping the approach to just add |
Replace manual if! exit code checks with set -euo pipefail. With errexit enabled, script exits automatically on failure, no need for explicit cleanup or error messages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix git-clone module to fail fast when
pre_clone_scriptorpost_clone_scriptreturns a non-zero exit code. Previously, both scripts were executed but their exit codes were never checked — a failing pre-clone hook (e.g., a prerequisite check that callsexit 1) was silently ignored and cloning continued. This broke the advertised "validate prerequisites before cloning" behavior and could leave workspaces starting with unmet preconditions.Type of Change
Module Information
Path:
registry/coder/modules/git-cloneNew version:
v1.3.1Breaking change: [ ] Yes [x] No
Testing & Validation
bun test)bun fmt)Related Issues