rets:

Setting it to NONE disables any validation.Setting it to SECRET_EXISTS only validates the existence of secrets. This might be useful if the machine you're running on only has permission to list secrets but not actually read their values.

Setting it to SECRET_AND_KEY_EXISTS (the default) validates both the secret existence as well as the existence of the exact key-value pair.

Fetch secret values in a step

If you are using centralized secrets management, you can access secrets directly from within your steps through the ZenML Client API. This allows you to use your secrets for querying APIs from within your step without hard-coding your access keys:

from zenml import step

from zenml.client import Client

@step

def secret_loader() -> None:

"""Load the example secret from the server."""

# Fetch the secret from ZenML.

secret = Client().get_secret( < SECRET_NAME >)

# `secret.secret_values` will contain a dictionary with all key-value

# pairs within your secret.

authenticate_to_some_api(

username=secret.secret_values["username"],

password=secret.secret_values["password"],

...

See Also

Interact with secrets: Learn how to create, list, and delete secrets using the ZenML CLI and Python SDK.

PreviousDeploy a stack using mlstacks

NextImplement a custom stack component

Last updated 19 days ago