- Inspecting a reusable workflow to identify required secrets
- Two approaches for passing secrets
- A step-by-step guide to explicitly declare and pass secrets
- Common pitfalls and how to propagate environment variables
Inspecting the Reusable Workflow
First, review the reusable workflow metadata to see which secrets it expects:
These must be supplied by the caller workflow (the “Solar System Workflow”).
Caller Workflow Example
Here’s how you might create a Kubernetes secret and deploy in your caller workflow:Approaches to Passing Secrets
You have two main methods for forwarding secrets to a reusable workflow:Using
secrets: inherit is quick, but explicit declaration reduces blast radius by only passing the secrets you need.Step-by-Step: Explicitly Passing Secrets
Follow these steps to declare and forward secrets in your reusable workflow.1. Declare Secrets in the Reusable Workflow
Add asecrets section under workflow_call:
2. Call the Reusable Workflow with Secrets
Reference the reusable workflow from your Solar System repo and pass the required secrets:If a required secret is missing, the workflow will fail to start with an “invalid workflow file” error. Always verify secret names and availability before committing.
Limitation: Environment Variables Aren’t Propagated
Note that environment variables (e.g.,MONGO_URI) defined in the caller do not automatically flow into a reusable workflow:
Create MongoDB Secret logs, you’ll see an empty URI: