Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #33606

Closed (moved)
(moved)
Open
Created Mar 13, 2020 by teor@teor

Catch common bash errors in sbws scripts

We're going to gradually update tor, chutney, and fallback-scripts bash scripts to catch more errors. sbws might also want to make similar changes.

I'm not sure if sbws uses shellcheck already. Shellcheck helps catch errors while writing scripts.

To catch more runtime failures, set these options at the start of each script:

set -e
set -u
set -o pipefail

You might also want to set:

IFS=$'\n\t'

But it can change how lists are processed.

These settings help catch common errors in bash scripts at runtime: http://redsymbol.net/articles/unofficial-bash-strict-mode/

But they can cause scripts to fail, so you should have good unit tests and CI for all your scripts, before making these changes.

Follow-up to #33451 (moved).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking