Why "needs" is not transitive (at least for artifacts)

I have init job on the begging of my pipeline which product dotenv artifact. I want to use generated variables in all other jobs. This solution was fine unless I started to use “needs” for job dependencies. I realised, that when I have tree jobs:

  • init (produces dotenv artifact)
  • build (needs init)
  • deploy (needs build)

the deploy job don’t see the dotenv artifact until I explictily set needs to init.

As this is only example, in reality, the pipeline consist of much more jobs with various dependencies.

Should I put the dependency on init to all the jobs? Why gitlab-ci doesn’t count with “transitivity”?