Azure / Azure/azure-quickstart-templates

All bash scripts MUST use "set -e" (+strict bash mode)

Open
#2,483 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Bicep
Stars
14.9k
Forks
16.2k
Avg merge
6d 21h
Merged PRs (30d)
6

Description

### (Public Service Announcement)

Currently, any bash script that gets executed as part of a template deployment is potentially an issue if they don't contain `set -e`.

If one of the commands in the script fail, they will keep executing and the script will return with exit code 0 (=success). **Default bash behavior is to proceed executing the rest of the script, regardless of whether a command fails.**

This is well explained at http://redsymbol.net/articles/unofficial-bash-strict-mode/

Moreover, things like `set -u` are also required, because when a variable is misspelled/undeclared, bash will not error out.

Same with `set -o pipefail`. In bash scripts, if there is a `programA | programB` pattern and `programA` fails, the overall command (`programA | programB`) will still return status code 0 (=success) and bash script will continue running.

We've been getting quite many issues about this already and we need to teach our user base to at least using `set -e` in their Bash script if we want this repo to succeed.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue does not name specific files or tests; start by inventorying Bash scripts used by template deployments and compare their error handling with the linked strict-mode guidance. Done means every applicable script uses set -e, set -u, and pipefail so command, unset-variable, and pipeline failures are reported instead of masked.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash
Domain
cloud, devops
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.