githubEdit

Production deployments routing to staging environment

If your production deployments are unexpectedly routing to your staging environment instead of production, this is typically caused by hardcoded environment values in your GitHub Actions workflow file. Diagnosing the issue To identify the root cause, check your GitHub Actions logs for the production deployment run and search for these variables: TENANT= ENVIRONMENT= duplo_tenant STACK= duplo host Any variable containing STAGING or PRODUCTION Look for conditional statements in your workflow that might contain hardcoded values like: if [[ "staging" == "production" ]]; then Common cause and solution This issue often occurs when someone copies a workflow from staging to production but accidentally leaves hardcoded staging values in the production workflow file. The fix is to ensure your conditional statements use dynamic branch references instead of hardcoded values. Replace any hardcoded environment references with: if [[ "${{ github.ref_name }}" == "production" ]]; then This ensures the workflow correctly identifies which branch triggered the deployment and routes to the appropriate environment. Additional troubleshooting If the issue persists, verify: Your production workflow is running on the correct branch (production branch, not staging) The workflow file for production is not accidentally residing in the staging branch Check the top-left metadata in your GitHub Actions run to confirm which branch triggered the deployment

Last updated

Was this helpful?