Function: sys.get_env Stay organized with collections Save and categorize content based on your preferences.
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 name | Description |
|---|---|
GOOGLE_CLOUD_LOCATION | The workflow's location. |
GOOGLE_CLOUD_PROJECT_ID | The workflow project's identifier. |
GOOGLE_CLOUD_PROJECT_NUMBER | The workflow project's number. |
GOOGLE_CLOUD_SERVICE_ACCOUNT_NAME | The workflow execution's service |
| account name. | |
GOOGLE_CLOUD_WORKFLOW_EXECUTION_ID | The workflow execution's identifier. |
GOOGLE_CLOUD_WORKFLOW_ID | The workflow's identifier. |
GOOGLE_CLOUD_WORKFLOW_REVISION_ID | The workflow's revision identifier. |
You can also retrieve user-defined environment variables. For moreinformation, seeUse environment variables.
Arguments
| Arguments | |
|---|---|
name |
The requested environment variable name. |
default |
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 | |
|---|---|
TypeError | If eithername ordefault is not a string. |
Examples
For more information, seeBuilt-in environment variables
# Retrieve value of specified environment variable# For example, returns "us-central1"-returnStep:return:${sys.get_env("GOOGLE_CLOUD_LOCATION")}
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.