Interview Prep/CI/CD/GitLab CI Failures

`Job's rule evaluation produced: variable $FOO is not defined` or rules `if` always false for a custom variable.

AdvancedTroubleshootingGitLab CI Failures
Answer

Likely causes → Variable is protected/masked for a different ref, or defined in a scope that is not available at pipeline creation time (job-level variables cannot be used in rules:if of workflow).

Diagnose → Check variable scope and the rules evaluation context.

Fix → Define the variable at the top-level variables: or in project settings with proper scope.

Prevent → Print env (non-secret) while debugging.

All CI/CD questions Roadmap: GitLab CI/CD

More on GitLab CI Failures