CI/CD Integration
Use the Superflag CLI in your continuous integration and deployment workflows to automate flag management.Authentication in CI
For CI/CD environments, you’ll need to obtain a CLI token and store it as a secret.Step 1: Get CLI Token
On your local machine:token value (starts with cli_).
Step 2: Store as Secret
Store the token in your CI platform’s secrets:- GitHub Actions
- GitLab CI
- CircleCI
- Travis CI
- Go to repository Settings → Secrets and variables → Actions
- Create new secret:
SUPERFLAG_TOKEN - Paste your token
Step 3: Set Token in CI
Create the credentials file in your CI workflow:CI/CD Examples
GitHub Actions
.github/workflows/deploy.yml
GitLab CI
.gitlab-ci.yml
CircleCI
.circleci/config.yml
Common Patterns
Feature Flag Deployment
Enable a feature flag after successful deployment:Environment-Specific Configuration
Bulk Flag Updates
Rollback on Failure
Best Practices
1. Use Context
Set context once per job to avoid repeating--app and --env:
2. Fail Fast
Check authentication before running other steps:3. Log Flag Changes
Keep an audit trail of flag changes:4. Use Exit Codes
Check command success in scripts:5. Separate Deploy and Feature Enable
Deploy code first, enable features second:Security
Protect Your Token
- Never commit
~/.superflag/credentials.jsonto version control - Store tokens in CI secrets, not in code
- Use masked/protected variables in your CI platform
- Rotate tokens if compromised
Audit Trail
All flag changes made via CLI are logged in your Superflag dashboard under “Activity”.Troubleshooting
Authentication Fails
Context Not Persisting
Theuse command saves context to ~/.superflag/context.json. Ensure this persists between steps: