Hi Fleet team, could u tell me how does fleet fetc...
# fleet
w
Hi Fleet team, could u tell me how does fleet fetch the version of osquery, i have a osquery pkg built by myself following the standard Debian requirement. and fleet telling that with some weird content as showing below.
k
Fleet gets that from osquery. It’s being set when osquery is built, based on info pulled from git: https://github.com/osquery/osquery/blob/030e7af09f310101e0ef8da99c8288239ba2e7d9/cmake/options.cmake#L14
w
thx, but i dont understand the logic in the code from the link, maybe could u help to explain the logic?
k
When the build process runs,
git describe
is run to get the most recent tag. The
--tags
flag allows for
refs
in
refs/tags
to be detected as tags. The
--always
flag allows for a commit to be used if both of those fail. The
--dirty
flag adds an indicator if there are local changes (which you're seeing in your version). So what you're seeing there is the most recent tag, then the most recent commit after the tag, then the
dirty
suffix to show that there were local changes when the build was run.
That allows you to reference the exact state of the code when the build happened.
Any additional questions about this would be best posted in the #general channel. That way, you've got the larger osquery community to help you out rather than just those that also check this channel 🙂
w
@Kathy Satterlee one more question, why the standard building process pkg osquery has different val of this field?
k
If I understand the question properly, it's because generally the version you're building is a tagged release, so there are no additional commits and only the tag is returned.
If I built right now from the
master
branch of osquery, the version I'd get would be
5.6.0-3-g030e7af09
If I made some changes before the build without committing, it would be
5.6.0-3-g030e7af09-dirty
The version accurately reflects the exact state of the code when
osquery
is built.
w
ok i got it, but this isnot what i want
k
Gotcha. Since this isn't directly related to Fleet, the best bet at this point would be to reach out to the wider community over in #general to see if anyone can suggest ways to set a custom version number or change that logic.