Skip to content

WIP: Add a POSIX shell implementation, use it for the "sh" shell executor

Nick Thomas requested to merge (removed):1550-fix-shell-bashisms into master

What does this MR do?

Implements a POSIX-safe shell script builder

Why was this MR needed?

BashShell currently tries to dynamically fall back to 'sh' if 'bash' isn't present, but it uses bashisms, so the runner is broken in environments where only POSIX shells are available.

This MR allows people to continue to use bash if they want, but if bash is not available, specifying the 'sh' shell in the the command line will generate POSIX-compatible scripts for use.

Are there points in the code the reviewer needs to double check?

  • We move entirely to single-quote escaping
  • pipefail isn't available under POSIX shells, so is disabled
  • The generated script now runs commands directly rather than going through : | eval $'...'
  • Should we just dump shells/bash.go entirely?

Does this MR meet the acceptance criteria?

  • CHANGELOG entry added
  • Documentation created/updated
  • Tests
    • Added for this feature/bug
    • All builds are passing
  • Branch has no merge conflicts with master (if you do - rebase it please)

What are the relevant issue numbers?

Merge request reports

Loading