-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
There are many many shell scripts in the project, but most of them are in this repo.
Currently we are using checkResult $? from commons.sh to check last command result when we want to make sure it passes.
It's better to use set -euxo pipefail at the beginning of bash files to avoid silent issues, especially when running on these scripts on CI.
GitHub Workflows/Actions already use set to fail early.
-
set -eoption instructs bash to immediately exit if any command has a non-zero exit status. -
set -o pipefailoption prevents errors in a pipeline from being masked. If any command in a pipeline fails, that return code will be used as the return code of the whole pipeline -
set -xoption enables a mode of the shell where all executed commands are printed to the terminal. -
set -uoption validate reference to any variable you haven't previously defined - with the exceptions of$* and $ @ - is an error, and causes the program to immediately exit.
Tasks:
- list all shell scripts
- For each shell scripts
- add
set -euxo pipefailafter#!/bin/bash - remove the
checkResult $? - check it doesn't break current workflows (pay attention to
difforgit diff --exit-code... and other commands that exits with1for expected results, not errors)
- add
Links: