Child pipeline (or another job) does not receive dotenv inherited variable in rules

Summary

If a non ci/cd custom variable is passed down to a child pipeline (dynamic or not) or another job using dotenv variable inheritance, and if the child pipeline (or another job) has rules that use the variable, the rules do not receive the variable value. Only the script in jobs in child pipeline receives the value.

Steps to reproduce

  1. Manually run this pipeline: https://gitlab.com/sliaquat/test-child-pipeline-pass-var/-/pipelines (Example run)
  2. The job-with-rules should have run since the variable FOO is set. It can be seen printed in job-without-rules output.

Note: This might not be only dotenv specific as highlighted in Parent YAML variables passed to child are not a... (#408160 - closed).

Example Project

https://gitlab.com/sliaquat/test-child-pipeline-pass-var

What is the current bug behavior?

The rules do not receive the variable value passed using dotenv variable inheritance

What is the expected correct behavior?

The rules should receive the variable value passed using dotenv variable inheritance

Output of checks

This bug happens on GitLab.com

Edited by Max Orefice