We have a freestyle job (named config_job) that configures other freestyle jobs on the same jenkins via REST. In some of these freestyle jobs the config_job is added as a reverse build trigger and thus some jobs become downstream jobs of the config_job. We noticed that sometimes these newly added downstream jobs are not built.
After looking at the jenkins source code, we noticed the following TODO in BuildTrigger.executes:
Since the dependency graph is still rebuilding when our config_job finishes, an old version of the dependency graph is used which does not include the reverse triggers we just added and thus some downstream jobs are not built.