Title
#fleet
w

wennan.he

10/27/2022, 12:08 AM
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.
Kathy Satterlee

Kathy Satterlee

10/27/2022, 12:30 AM
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

wennan.he

10/27/2022, 6:12 PM
thx, but i dont understand the logic in the code from the link, maybe could u help to explain the logic?
Kathy Satterlee

Kathy Satterlee

10/27/2022, 6:27 PM
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.
6:28 PM
That allows you to reference the exact state of the code when the build happened.
6:29 PM
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

wennan.he

10/27/2022, 6:42 PM
@Kathy Satterlee one more question, why the standard building process pkg osquery has different val of this field?
Kathy Satterlee

Kathy Satterlee

10/27/2022, 6:46 PM
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.
6:48 PM
If I built right now from the
master
branch of osquery, the version I'd get would be
5.6.0-3-g030e7af09
6:51 PM
If I made some changes before the build without committing, it would be
5.6.0-3-g030e7af09-dirty
6:51 PM
The version accurately reflects the exact state of the code when
osquery
is built.
w

wennan.he

10/27/2022, 6:53 PM
ok i got it, but this isnot what i want
Kathy Satterlee

Kathy Satterlee

10/27/2022, 6:59 PM
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.