Skip to content
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

builder: vagrant: introduce Vagrantfile #237

Merged
merged 1 commit into from
Sep 14, 2022

Conversation

geyslan
Copy link
Member

@geyslan geyslan commented Sep 8, 2022

The contributor can make use of a VM box (arm64/amd64) using the following Makefile rules: vagrant-up, vagrant-ssh, vagrant-halt and vagrant-destroy.

One can override the ARCH env var: make vagrant-up ARCH=arm64

Whether the override will work depends on the availability of online boxes and compatibility of architecture and providers (vbox, parallels).

Tested in Darwin (M1) and Linux (amd64).

@geyslan geyslan added the feature New feature or request label Sep 8, 2022
@geyslan geyslan requested a review from grantseltzer September 8, 2022 14:04
@geyslan geyslan self-assigned this Sep 8, 2022
@geyslan
Copy link
Member Author

geyslan commented Sep 8, 2022

I put the environment building logic inside builder/prepare-ubuntu.sh so it can be reused by .github workflows, by instance.

@geyslan geyslan force-pushed the vagrant branch 2 times, most recently from 565acb4 to 7e7e035 Compare September 8, 2022 18:14
Copy link
Contributor

@rafaeldtinoco rafaeldtinoco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this change is for a contributor, we should create a markdown file explaining how to use it, giving examples of outputs and on how to obtain a shell and do the needed compilations IMO.

@geyslan
Copy link
Member Author

geyslan commented Sep 9, 2022

If this change is for a contributor, we should create a markdown file explaining how to use it, giving examples of outputs and on how to obtain a shell and do the needed compilations IMO.

For sure, I'm on this as well. I spent these days running some builds and I realized today that this current proposal has the libbpfgo build broken due to the old version of libbpf and bpftool available in ubuntu 20.04. I was discussing with @grantseltzer that if we should stick with the bpftool requirement, it would be best to compile libbpf and bpftool altogether. BTW I'm changing the Vagrantfile to use 22.04 boxes.

Copy link
Contributor

@rafaeldtinoco rafaeldtinoco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't like the "vagrant" experience to be the default (but a complement only), which I think the separate Makefile does.

For me, the default should be a linux box compiling Tracee (and all vagrant recipes in here and in Tracee should be an addendum).

I would rename builder/prepare-ubuntu.sh to having/specifying it is vagrant related (for other future files not to be confused).

@geyslan
Copy link
Member Author

geyslan commented Sep 9, 2022

I wouldn't like the "vagrant" experience to be the default (but a complement only), which I think the separate Makefile does.

For me, the default should be a linux box compiling Tracee (and all vagrant recipes in here and in Tracee should be an addendum).

@rafaeldtinoco but wouldn't we mixing things this way? I strongly believe that libbpfgo, in despite of having foundations on Tracee, is now a standalone being. So for sure Tracee could make use of a vagrant environment, but its own.

I would rename builder/prepare-ubuntu.sh to having/specifying it is vagrant related (for other future files not to be confused).

builder/prepare-ubuntu.sh is a loose shell script. It can be reused from a Dockerfile, github workflow etc.

@rafaeldtinoco
Copy link
Contributor

@rafaeldtinoco but wouldn't we mixing things this way? I strongly believe that libbpfgo, in despite of having foundations on Tracee, is now a standalone being. So for sure Tracee could make use of a vagrant environment, but its own.

Sorry, I meant libbpfgo (not Tracee) in my statement.

@geyslan
Copy link
Member Author

geyslan commented Sep 9, 2022

Sorry, I meant libbpfgo (not Tracee) in my statement.

@rafaeldtinoco Oh, I get it.

I wouldn't like the "vagrant" experience to be the default (but a complement only), which I think the separate Makefile does.

So, do you mean create a separate Makefile (e.g. ./contrib/{Makefile,Vagrantfile}) just for controlling the Vagrant box?

The contributor can make use of a VM box (arm64/amd64) using the
following Makefile rules: vagrant-up, vagrant-ssh, vagrant-halt and
vagrant-destroy.

One can override the ARCH env var:
make vagrant-up ARCH=arm64

Whether the override will work depends on the availability of online
boxes and compatibility of architecture and providers (vbox, parallels).

Documentation added.

Tested in Darwin (M1) and Linux (amd64).
Copy link
Contributor

@grantseltzer grantseltzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me, nice work!

Comment on lines +197 to +199
vagrant-ssh: .vagrant-ssh

.vagrant-%:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the . signify by convention?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for letting the reader know that's internal. But they are also not considered first targets: https://www.gnu.org/software/make/manual/make.html#How-Make-Works

@grantseltzer grantseltzer merged commit bd31ff0 into aquasecurity:main Sep 14, 2022
@geyslan geyslan deleted the vagrant branch March 31, 2023 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants