-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Add a Linux Devcontainer for osquery developers #7992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Fix issue with lack of git tag
@@ -0,0 +1,25 @@ | ||
#!/bin/sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole script is basically a duplicate of what's published here: https://osquery.readthedocs.io/en/stable/development/building/#linux-ubuntu-18
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes a third place these live.
- Docs
- CI pipeline
- here
Is there a way we can unify these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, this is what @directionless is referring to: https://github.com/osquery/osquery/blob/master/tools/ci/osquery-ubuntu18.04-toolchain.dockerfile
The Docker image we create for the CI though is particularly targeted; also the version of the distribution there is a bit arbitrary (and not updated continuosly just for maintenance reasons), while in a devenv one might want to use the latest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we think of this possible change to the docs?
https://github.com/NickBorgers/osquery/blob/30c2cccc65b44cd85af8d70573f40f14e5b50df3/docs/wiki/development/building.md#linux-ubuntu-18
sudo apt update | ||
|
||
# Install the prerequisites | ||
sudo apt install -y --no-install-recommends wget sudo xz-utils nano bc git python3 bison flex make cppcheck gdb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I added here was gdb
, as I was trying to debug some behavior I find odd in how osquery
applies the DISTINCT
constraint.
@@ -0,0 +1,33 @@ | ||
.DEFAULT_GOAL := help |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a Makefile here is a bit sketchy, but technically avoids stomping on the CMake and generated build/Makefile
I think it's nice to capture some of the test instructions from here, and I leverage this in the setup of the Devcontainer.
/easycla |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome! I use VSCode but haven't tried out the devcontainer stuff. Shall we consider the version change I proposed below and then merge this either way?
Co-authored-by: Zach Wasserman <zach@fleetdm.com>
fix use of Makefile in devcontainer startup
First, I found a bug in my Second I finally ran
I'm going to go back to a full VM and try to see what is different. |
On a fresh VM (Ubuntu 22.04) I cloned my fork and ran:
And one of these tests is still failing; so I don't think it's related to being in a Devcontainer.
I am going to try and look at what is different about One thing I'm struggling with a bit is finding the command to run these individual tests by name. Looks like I will need to learn a bit of |
This PR adds a Linux Devcontainer for OSQuery. While this change will only help folks trying to build and test changes for
osquery
from a Linux development environment, this has been useful to me in making changes toosquery
myself. It's possible this doesn't belong in the main repo or something, but I'm less familiar with storing something like this outside the main repository; I know the buildchain is to some degree such a separate codebase.Devcontainers are a Microsoft spec and are currently (to my knowledge) only supported in IDEs provided by Microsoft (VSCode and GitHub Codespaces), however fully independent CLI clients are possible. I've personally been using VSCode, though I don't see this change as coupling
osquery
development to VSCode or Microsoft.There's a YouTube Video demo of this functionality with VSCode here.