Gitaly rebuilds unnecessarily when precompiled binaries exist

Problem Statement

This is a regression introduced by !4825 (merged).

Tests in gitlab-org/gitlab are rebuilding Gitaly after gdk update even though the latest binaries are already downloaded. We need to investigate why the original implementation isn't working and add the cache check for .cache/.gitaly_commit_sha.

Impact

Around 60 seconds wasted each time users run tests locally. This adds unnecessary wait time and slows down local development.

Proposal

Investigate and implement the cache check to compare the SHA in .cache/.gitaly_commit_sha with the version in GITALY_SERVER_VERSION and skip the rebuild when they match.

Edited by Nao Hashizume