Skip to content

Error and quit if an unset variable is used in functions. - #209

Open
kierenevans wants to merge 1 commit into
mainfrom
feature/error-if-using-an-unset-variable
Open

Error and quit if an unset variable is used in functions.#209
kierenevans wants to merge 1 commit into
mainfrom
feature/error-if-using-an-unset-variable

Conversation

@kierenevans

Copy link
Copy Markdown
Collaborator

Helps avoid rm -rf ${VAR}/* wiping /* if $VAR is not set, as it could wipe out mountpoints.

A few variables such as GITHUB_TOKEN are impacted, this PR will gradually build over time to ensure variables are declared before being used.

Helps avoid `rm -rf ${VAR}/*` wiping /* if $VAR is not set, as it could wipe out mountpoints.
@sroze

Copy link
Copy Markdown
Member

this PR will gradually build over time to ensure variables are declared before being used

What do you mean?

@kierenevans

Copy link
Copy Markdown
CollaboratorAuthor

GITHUB_TOKEN is currently not set anywhere, but we check if it's set with if [ -n "${GITHUB_TOKEN}" ].

That would not work with this -u flag and would exit the script. We should declare that and other variables in env files before use.

@kierenevans
kierenevans changed the base branch from master to mainNovember 5, 2020 11:33
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@kierenevans@sroze