fix: don't check presence of `GERRIT_PROJECT_PREFIX`
In POSIX shell and derivatives like Bash, the `${FOO?}` parameter
expansion expands the `FOO` variable if it's defined, and triggers a
"parameter not set" error if it isn't.
We use this to sanity-check our use of the `GERRIT_PROJECT_PREFIX`
environment variable, which is expected to represent the site-specific
Gerrit project prefix ("" on production, "next/" on staging). This
environment variable is defined globally by our CloudBees bundles.
Unfortunately, Jenkins appears to skip exporting environment variables
with empty values to processes it executes (see [here][1]), which means
that this environment variable is unset on the production site.
This change works around this behaviour by removing the sanity-checks,
instead expanding to an empty variable if the variable is undefined
using the `${FOO:-}` parameter expansion.
[1]: https://community.jenkins.io/t/environment-variables-with-empty-values-are-not-passed-to-process-jenkins-exec/9949
Change-Id: I5c2fd0bec6bfcdb23024e3e02802f9842f2970f1
Signed-off-by: Chris Kay <chris.kay@arm.com>
10 files changed