Prompt
What should I use for injecting secrets into CI builds?
Latest observation
Oct 25, 2026
OpenAI APIWeb search: off
For CI builds, the safest default is:
Use your CI provider’s built-in secret store or a dedicated secrets manager, and inject secrets at runtime as environment variables or short-lived files.
Good options
- CI-native secret variables
- GitHub Actions Secrets, GitLab CI Variables, CircleCI Contexts, etc.
- Best for simple setups and small teams.
- External secrets manager
- AWS Secrets Manager, HashiCorp Vault, GCP Secret Manager, Azure Key Vault, Doppler, 1Password Secrets Automation, etc.
- Best for larger teams, rotation, auditability, and cross-environment consistency.
Preferred injection pattern
- Fetch secrets only during the job
- Pass them as:
- environment variables for apps/tools that expect them, or
- temporary files for credentials like SSH keys, JSON service account files, kubeconfigs, etc.
- Avoid committing secrets to repo, build args, or image layers.
What to avoid
- Hardcoding secrets in the pipeline config
- Passing secrets as plain CLI arguments if they may show up in logs/process listings
- Embedding secrets into Docker images during build
- Using long-lived static credentials when you can use OIDC/workload identity instead
Best practice for modern CI
If your CI supports it, use OIDC to get short-lived cloud credentials instead of storing cloud keys at all. This is often the best choice for:
- AWS role assumption
- GCP Workload Identity Federation
- Azure federated identity
Simple rule of thumb
- Small/simple CI: use CI secrets
- Serious production CI: use a secrets manager + OIDC + short-lived credentials
If you want, I can recommend the best approach for your specific CI system, like GitHub Actions, GitLab, Jenkins, or CircleCI.