message: chore: add function to extract feature flag variables
  This function extracts feature flag variables from either the build
  environment, or the Lagoon project/environment env-vars.
diff: @@ -25,6 +25,52 @@ function contains() {
  [[ $1 =~ (^|[[:space:]])$2($|[[:space:]]) ]] && return 0 || return 1
  }
  +# featureFlag searches for feature flag variables in the following locations
  +# and order:
  +#
  +# 1. The cluster-force feature flag, prefixed with LAGOON_FEATURE_FLAG_FORCE_,
  +# in the build environment. This is set via a flag on the build-deploy
  +# controller. This overrides the other variables and allows policy
  +# enforcement at the cluster level.
  +#
  +# 2. The regular feature flag, prefixed with LAGOON_FEATURE_FLAG_, in the
  +# Lagoon environment env-vars. This allows policy control at the environment
  +# level.
  +#
  +# 3. The regular feature flag, prefixed with LAGOON_FEATURE_FLAG_, in the
  +# Lagoon project env-vars. This allows policy control at the project level.
  +#
  +# 4. The cluster-default feature flag, prefixed with
  +# LAGOON_FEATURE_FLAG_DEFAULT_, in the build environment. This is set via a
  +# flag on the build-deploy controller. This allows default policy to be set
  +# at the cluster level, but maintains the ability to selectively override at
  +# the project or environment level.
  +#
  +# The value of the first variable found is printed to stdout. If the variable
  +# is not found, print an empty string. Additional arguments are ignored.
  +function featureFlag() {
  + # check for argument
  + [ "$1" ] || return
  +
  + local forceFlagVar defaultFlagVar flagVar
  +
  + # check build environment for the force policy first
  + forceFlagVar="LAGOON_FEATURE_FLAG_FORCE_$1"
  + [ "${!forceFlagVar}" ] && echo "${!forceFlagVar}" && return
  +
  + flagVar="LAGOON_FEATURE_FLAG_$1"
  + # check Lagoon environment variables
  + flagValue=$(jq -r '.[] | select((.scope as $scope | ["build", "global"] | index($scope)) and .name == "'"$flagVar"'") | .value' <<<"$LAGOON_ENVIRONMENT_VARIABLES")
  + [ "$flagValue" ] && echo "$flagValue" && return
  + # check Lagoon project variables
  + flagValue=$(jq -r '.[] | select((.scope as $scope | ["build", "global"] | index($scope)) and .name == "'"$flagVar"'") | .value' <<<"$LAGOON_PROJECT_VARIABLES")
  + [ "$flagValue" ] && echo "$flagValue" && return
  +
  + # fall back to the default, if set.
  + defaultFlagVar="LAGOON_FEATURE_FLAG_DEFAULT_$1"
  + echo "${!defaultFlagVar}"
  +}
  +
  ##############################################
  ### PREPARATION
  ##############################################
  