Function: sys.get_env

Retrieves the value of the specified environment variable.

If the specified variable is not set, returns the default value instead.

The following built-in environment variables are supported:

Variable nameDescription
GOOGLE_CLOUD_LOCATIONThe workflow's location.
GOOGLE_CLOUD_PROJECT_IDThe workflow project's identifier.
GOOGLE_CLOUD_PROJECT_NUMBERThe workflow project's number.
GOOGLE_CLOUD_SERVICE_ACCOUNT_NAMEThe workflow execution's service
account name.
GOOGLE_CLOUD_WORKFLOW_EXECUTION_IDThe workflow execution's identifier.
GOOGLE_CLOUD_WORKFLOW_IDThe workflow's identifier.
GOOGLE_CLOUD_WORKFLOW_REVISION_IDThe workflow's revision identifier.

You can also retrieve user-defined environment variables. For more information, see Use environment variables.

Arguments

Arguments
name

string

The requested environment variable name.

default

string

The string value to return if the named variable is not set.

Returns

The value of the named environment variable, or the default if not set.

Raised exceptions

Exceptions
TypeErrorIf either name or default is not a string.

Examples

For more information, see Built-in environment variables

# Retrieve value of specified environment variable
# For example, returns "us-central1"
- returnStep:
    return: ${sys.get_env("GOOGLE_CLOUD_LOCATION")}