Branches are always pulling from master when building the site

When a pipeline runs for a version-branch, a Docker image is created and uploaded to the Registry which is a snapshot of the respective product versions.

During the pipeline, before the image builds, we compile the site and test for broken links. The thing is that the compile_prod job pulls the master branch instead of the respective ones for the given version.

This is the example of the 11.7 version build https://gitlab.com/gitlab-com/gitlab-docs/-/jobs/150478116

=> Pulling master of https://gitlab.com/gitlab-org/gitlab-ce.git
From https://gitlab.com/gitlab-org/gitlab-ce
 * branch              master     -> FETCH_HEAD
 + ed1da730...490eeb51 master     -> origin/master  (forced update)
Already on 'master'

=> Pulling master of https://gitlab.com/gitlab-org/gitlab-ee.git
From https://gitlab.com/gitlab-org/gitlab-ee
 * branch              master     -> FETCH_HEAD
 + 456e8019...7d9f342e master     -> origin/master  (forced update)
Already on 'master'

=> Pulling master of https://gitlab.com/gitlab-org/omnibus-gitlab.git
From https://gitlab.com/gitlab-org/omnibus-gitlab
 * branch            master     -> FETCH_HEAD
 + f0a4ef2...df789ba master     -> origin/master  (forced update)
Already on 'master'

=> Pulling master of https://gitlab.com/gitlab-org/gitlab-runner.git
From https://gitlab.com/gitlab-org/gitlab-runner
 * branch            master     -> FETCH_HEAD
 + 0fba7a3...edfbc51 master     -> origin/master  (forced update)
Already on 'master'

=> Pulling master of https://gitlab.com/debugging/debug
From https://gitlab.com/debugging/debug
 * branch            master     -> FETCH_HEAD
 + f892a35...24d6192 master     -> origin/master  (forced update)
Already on 'master'