Fix the path for tmate ssh-debug env var#282
Open
yhaliaw wants to merge 3 commits into
Open
Conversation
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.
What this PR does
This pull request refactors how shared runner paths and the
prepend_after_shebanghelper are managed and used across the codebase. The main improvement is centralizing these definitions in a newrunner_pathsmodule, ensuring consistency and reducing duplication between template injection flows. Additionally, theprepend_after_shebangfunction is enhanced for robustness, and new tests are added to verify its behavior.Centralization and Consistency:
runner_paths.pymodule to define shared constants (RUNNER_USER,RUNNER_HOME,PRE_JOB_HOOK_PATH,RUNNER_ENV_PATH) and theprepend_after_shebangfunction, providing a single source of truth for runner paths and injection logic.garm_template.pyandrunner_template.pyto import runner paths and the injection helper fromrunner_paths, removing local definitions and ensuring both flows use the same logic. [1] [2]Code Simplification and Robustness:
prepend_after_shebangfromgarm_template.pyand replaced custom script injection logic inrunner_template.pywith the shared helper, making code easier to maintain and less error-prone. [1] [2]Testing Enhancements:
prepend_after_shebangto ensure correct behavior with and without shebangs, with or without trailing newlines, and with empty snippets.These changes improve maintainability, prevent drift between template flows, and ensure robust script injection.
Why we need it
Fix an issue where the wrong path for the .env file is used for the tmate debug-ssh env var.
Checklist
CONTRIBUTING.mdhas been updated upon changes to the contribution/development process (e.g. changes to the way tests are run)docs/changelog.mdwith user-relevant changes(e.g., in
.github/workflows/integration_tests.yaml, ensure themoduleslist is correct)terraform fmtpasses andtflintreports no errorsAGENTS.md.copilot-collections.yamlor.github/instructions/: I re-checked whether theAGENTS.md"12-factor divergences" guidance still matches the upstream copilot-collections guidance