Don't use current time in prometheus build command to avoid cache dirtying
Update: As a quick fix, we just dropped BuildDate and Revision flags from compile process. Keeping this issue open in case we ever want those info.
While building Prometheus, we specify build flags which are generated by https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/lib/gitlab/prometheus_helper.rb. There, BuildDate
has the time of building the binary, which changes with each build. This, in effect changes the actual build command , where we extrapolate the flags.
One of the factors omnibus considers to detect whether a software needs to be rebuilt from scratch or not is checking whether the build commands changed. In case of Prometheus, it is changed always, thus dirtying the cache always.
Proposal
We are not using the BuildDate output from prometheus --version
. For GitLab, what interests is the Prometheus version. So, either we can drop BuildDate
from flags (need to check if that will break anything), or we can use version
as BuildDate
instead of Time.now
.
/cc @marin @bjk-gitlab