41 Commits
Author SHA1 Message Date
Caroline ZhuandgVisor bot e318f24f9a Add building the Python SandboxExec wheel to our build pipeline
Successful BuildKite run:
https://buildkite.com/gvisor/pipeline/builds/46443/list?sid=01a01bfa-83bd-4ea4-b075-176caf09f401&tab=output

PiperOrigin-RevId: 974634114
2026-09-01 12:12:14 -07:00
Ryan El Kochta beddb0f0ef make clangd work out of the box
- Adds a gen_compile_commands.py script to generate a `compile_commands.json` for clangd, similar to Linux's `scripts/clang-tools/gen_compile_commands.py`
- Configures the dev container to generate the database before the editor is opened
- Adds `clangd` vscode extension to the dev container (and installs `clangd` in the default image)
- Updates CONTRIBUTING.md with instructions for generating a `compile_commands.json` database when *not* using a dev container

Also switches to a less confusing link for the Dev Containers extension.
2026-07-28 17:28:28 -07:00
Ryan El Kochta f26a474965 make gopls work out of the box
Long-term, we want to clean up our use of Bazel so that a container isn't necessary to build gVisor. As a stop-gap, let's make the out-of-box VSCode experience a little smoother by configuring a GOPACKAGESDRIVER for gopls out-of-the-box, and recommending using a dev container.

The advantage of recommending a dev container is that we can configure an on-start command to run `@io_bazel_rules_go//go` through Bazel *before* gopls starts, which installs the correct Go version in the container automatically. And in the future we can configure a `compile_commands.json` to be generated at startup for clangd (for the C++ tests).

- Updates the dev container configuration to install the Go extension and fetch the Go compiler at startup.
- Adds a settings.json that configures gopls to run a GOPACKAGESDRIVER through bazel, making LSP work for the auto-generated code.
- Updates the docs to explain how to get gopls working with or without a dev container, and marks GOPATH as "not recommended"
- Install `buildifier` in the default container, as used by the Bazel vscode extension for formatting BUILD files
2026-07-28 18:50:48 +00:00
Tamir Duberstein 71b02882d0 Dockerfile: use correct gcloud CLI URL for arm 2026-01-12 13:27:01 -05:00
Tamir DubersteinandgVisor bot 7c117d1aca Update Go to 1.25.5
- **checkescape: improve error output**
  The output now includes stderr on failure e.g.:
  ```
  checkescape: tools/checkescape/test2/test2.go:98:6: stack: possible split on function entry (2 omitted) → (possible, error running "external/rules_go++go_sdk+main___download_0/bin/go tool objdump bazel-out/k8-fastbuild-ST-04c87098fb12/bin/tools/checkescape/test2/test2.a": exit status 2 (go: no such tool "objdump")) (GOOARCH=amd64, GOOS=linux)
  ```

  Simplify various bits of the implementation while I'm here:
  - Use a set of strings rather than a list to avoid some O(n) operations.
  - Use `CommandContext` to ensure proper cleanup.
  - Remove stderr pipe and goroutine by setting `Stderr` to a
    `bytes.Buffer`.
  - Use `bufio.Scanner` instead of manually calling
    `(*bufio.Reader).ReadString` and handling errors.
  - Remove `NextLine` loop label.
-  **go_stateify: plumb go binary to goimports**
    This avoids go_stateify relying on `go` being available outside of the
    bazel sandbox.
- **Update Go to 1.25.5**
  Reduce duplication of the version information in various places:
  - Use `go_sdk.from_file` instead of repeating the version encoded in
    `go.mod` in `MODULE.bazel`.

  Add a workaround to allow `objdump` to be lazily compiled in the manner
  introduced in https://go.dev/issue/71867 when invoked under bazel in
  checkescape.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/12452 from tamird:update-go 6c7f6400f5d3ea883096eef18d365c97f875bc68
PiperOrigin-RevId: 853572845
2026-01-07 23:11:36 -08:00
gVisor bot cd0a180bac Merge pull request #12160 from avagin:bazel-mod-switch
PiperOrigin-RevId: 811952342
2025-09-26 14:17:25 -07:00
AV 1c254bf062 Install the last golang version 2025-09-23 18:20:51 +00:00
AV 7f81d98b53 bazel: switch to bzlmod completly
- Deletion of the WORKSPACE file. Dependencies are now managed in the MODULE.bazel file.
- Removal of --noenable_bzlmod and --enable_workspace from .bazelrc to enable bzlmod.
- Update paths in MODULE.bazel to be relative to the repository root.
2025-09-23 06:06:59 +00:00
Konstantin BogomolovandgVisor bot 2cd5b380aa Allow default Docker image base to be configurable.
PiperOrigin-RevId: 807371902
2025-09-15 14:02:32 -07:00
Konstantin BogomolovandgVisor bot c8348aa7ee Update README with instructions on using Bazel directly.
A pointer to the build Dockerfile will be helpful.

PiperOrigin-RevId: 797484293
2025-08-20 15:21:55 -07:00
gVisor bot b1c18b049c Merge pull request #11935 from konstantin-s-bogom:master
PiperOrigin-RevId: 797465169
2025-08-20 14:31:33 -07:00
Konstantin Bogomolov 415fb10050 Fix build for Bazel 8.
Specifically, build using bazel WORKSPACE. Bazel modules is still not
used and requires further migration.

This updates some dependencies to make them compatible with Bazel 8,
which in turn requires explicitly adding some new dependencies to
support new versions. In some cases existing patches no longer applied
and had to be updated. A new patch was added to remove windows
toolchains from coral-crosstools, because that functionality requires
lots of bazel intrinsics that are no longer defined.

At least on my machine, when //vdso:vdso was a dependency (not targetted
explicitly), the Gold linker specified in `vdso_linker_option` failed to
be found (bazel build //vdso worked); however this led me to discover
that the Gold linker is deprecated, hence using it is removed entirely.

To make the repo compatible with bazelisk out of the box, a bazelversion
file has been added.
2025-08-13 02:14:21 +00:00
Andrei VaginandgVisor bot 68d4c18648 kvm/arm64: send SIGKILL if ring0.El0SyncInv has been triggered
Linux does the same thing.

PiperOrigin-RevId: 722789748
2025-02-03 14:07:09 -08:00
Andrei Vagin f8f59d8cad Update bazel packages 2024-10-09 17:40:55 -07:00
Andrei Vagin 0c21ab8130 buildkite: start testing the network plugin 2024-09-25 19:23:06 -07:00
Andrei VaginandgVisor bot 3cae0d54ac test: add the rtnetlink test suit
It is much easier to create complex configurations from bash scripts with help
of the iproute2 tools.

PiperOrigin-RevId: 646286415
2024-06-24 18:25:26 -07:00
Andrei VaginandAndrei Vagin 812d825b19 Update bazel to 7.1.2
The key highlight from the release notes:

Build without the Bytes for builds using remote caching and/or remote
execution is now enabled by default (i.e. --remote_download_outputs
defaults to toplevel). This means that Bazel will no longer try to
download any intermediate outputs from the remote server, but only the
outputs of requested top-level targets instead. This significantly
improves build performance. Bazel now also handles the case of an
artifact falling out of the remote cache gracefully, by rewinding the
build.

Signed-off-by: Andrei Vagin <[email protected]>
2024-05-09 15:43:34 -07:00
Kevin KrakauerandgVisor bot 3a721702f6 images: use mulitarch default image instead of hacky workaround
Instead of lying to clang about the targeted system, we can install the
necessary package only on x86_64 machines. Our tooling supports multiarch
packages (see tools/images.mk).

PiperOrigin-RevId: 591385576
2023-12-15 16:14:40 -08:00
Kevin KrakauerandgVisor bot dacccea780 xdp: install libbpf-dev and work around arch build issue
PiperOrigin-RevId: 590826409
2023-12-13 23:00:29 -08:00
Tiwei Bie b0d766c15c runsc: add the EROFS rootfs support
This patch adds the EROFS rootfs support. No gofer process will be
created for the container, when there is no need to pass through host
files into a container via the gofer process. Annotations for rootfs
are also introduced to provide extra information, including the mount
source, mount type and overlay config. Additionally, busybox-static
is added to the default image and will be used to build the EROFS
rootfs images during the test.

Updates #8956

Signed-off-by: Tiwei Bie <[email protected]>
2023-11-07 08:02:16 +08:00
Tiwei Bie 158ac5af54 Add an EROFS test in container tests
This patch adds an EROFS test which checks that the checksums we get
from the target directory in container are identical with the ones
got from the source directory that we used to create the EROFS images.

erofs-utils is also added to the default image and will be used to
build the EROFS images during the test.

Signed-off-by: Tiwei Bie <[email protected]>
2023-10-06 01:00:30 +08:00
Andrei Vagin 51fa9984e7 Update bazel, rules_go and gazelle 2023-08-03 18:22:26 -07:00
Andrei Vagin 0bc8c2ac3f Update bazel to 6.1.1 2023-03-21 23:20:28 -07:00
Adin ScannellandAndrei Vagin f278d0e433 Add appropriate arch_genrule transitions. 2023-02-28 12:28:17 -08:00
Andrei Vagin 6c3b2a8e88 Update bazel to 6.0.0 2023-02-17 14:42:11 -08:00
gVisor bot e7e22f38c1 Merge pull request #8154 from avagin:bazel-update
PiperOrigin-RevId: 492077389
2022-11-30 18:56:18 -08:00
Andrei Vagin 7f94c77962 Update bazel packages
Signed-off-by: Andrei Vagin <[email protected]>
2022-11-29 14:01:41 -08:00
Kevin KrakauerandgVisor bot 5ac93d5db1 remove unnecessary dockerfile step
After cl/473873880 this is no longer necessary.

PiperOrigin-RevId: 474334039
2022-09-14 10:49:28 -07:00
Kevin KrakauerandgVisor bot 94d74fed2f add clang to default image
clang will be used to compile BPF.

PiperOrigin-RevId: 463392266
2022-07-26 11:53:04 -07:00
Etienne PerotandgVisor bot a0ab6f841c Default Docker image: Add kmod package.
PiperOrigin-RevId: 450564818
2022-05-23 17:49:33 -07:00
Adin ScannellandgVisor bot 8b60115f51 Ensure that nogo is enabled.
A recent change stopped using the correct file (the export data, not the
archive) and checklocks started failing. Unfortunately, this was suppressed,
since the filter command was not failing with findings.

This change fixes that problem and adds a test to ensure that this cannot
happen again. If nogo starts failing to identify problems, the sanity_test in
nogo/sanity will also start to fail.

This change also requires updating the WORKSPACE to the latest rules_go and
Go version, in order to pick up the fixed go_tools. The latest rules_go in
turn required an updated bazel, which in turn required a minor change in the
coverdata implementation.

Fixing the fact propagation brought forward a number of problems with caching
for bazel workers. Its unclear whether this was a core worker issue or whether
some caching was broken, but the situation was basically undebugable. Instead,
the way facts are stored and loaded is optimized to be able to remove the use
of workers altogether and ideally make nogo debuggable.

PiperOrigin-RevId: 426327186
2022-02-03 23:45:40 -08:00
Zeling FengandgVisor bot 493bf93bd5 Dockerless PacketImpact
- More hermetic test network setup
- Easier to use/setup without docker

Updates #6018, #6835.

PiperOrigin-RevId: 410039248
2021-11-15 11:44:51 -08:00
Fengjin Chenandchenfengjin cc0ae92c5c Add -y to install docker-ce when build image 2021-08-02 12:40:22 +08:00
Tamir DubersteinandgVisor bot 13777b8b47 Update go-tools to 2020.2.1
...and a bunch of other things as I worked through the rot. Notably:
  - Upgrade to bazel 4.0.0
  - Upgrade to Go 1.15.7

Remove go_branch stderr suppression; this made it quite difficult to see
what was failing while developing this patch.

PiperOrigin-RevId: 355257833
2021-02-02 14:53:12 -08:00
Andrei VaginandAndrei Vagin 8e7b47626a Add ARM smoke test
make BAZEL_CONFIG=aarch64 arm-qemu-smoke-test

Signed-off-by: Andrei Vagin <[email protected]>
2021-01-07 17:41:43 -08:00
Adin ScannellandgVisor bot 727b2adc2f Tweak aarch64 support.
A few images were broken with respect to aarch64. We should now
be able to run push-all-images with ARCH=aarch64 as part of the
regular continuous integration builds, and add aarch64 smoke tests
(via user emulation for now) to the regular test suite (future).

PiperOrigin-RevId: 346685462
2020-12-09 18:51:17 -08:00
Adin ScannellandShentubot 0bcbf188c6 Refactor the Makefile to avoid recursive Make.
Recursive make is difficult to follow and debug. Drop this by using
internal functions, which, while difficult, are easier than trying to
following recursive invokations.

Further simplify the Makefile by collapsing the image bits and removing
the tools/vm directory, which is effectively unused.

Fixes #4952

PiperOrigin-RevId: 346569133
2020-12-09 15:53:23 -08:00
Pratik raj c87d4376a8 optimize size and time using "--no-cache-dir"
Using "--no-cache-dir" flag in pip install ,make sure dowloaded packages
by pip don't cached on system . This is a best practise which make sure
to fetch ftom repo instead of using local cached one . Further , in case
of Docker Containers , by restricing caching , we can reduce image size.
In term of stats , it depends upon the number of python packages
multiplied by their respective size . e.g for heavy packages with a lot
of dependencies it reduce a lot by don't caching pip packages.

Further , more detail information can be found at

https://medium.com/sciforce/strategies-of-docker-images-optimization-2ca9cc5719b6
2020-07-25 13:26:52 +05:30
Adin Scannell 5a6a84bb53 Convert go_generics tests to starlark.
For some reason these tests were broken when run via the bazel docker
container. The mechanism used was a bit crazy (self-extracting bundle),
so convert them to use straight-forward starlark rules. This has the
added advantaged that they are now independent tests.
2020-07-23 18:00:12 -07:00
Adin Scannell 01b4cd6c11 Adapt website to use g3doc sources and bazel.
This adapts the merged website repository to use the image and bazel
build framework. It explicitly avoids the container_image rules provided
by bazel, opting instead to build with direct docker commands when
necessary.

The relevant build commands are incorporated into the top-level
Makefile.
2020-05-06 14:15:18 -07:00
Adin ScannellandgVisor bot e4cf551982 Standardize all Docker images.
This change moves all Docker images to a standard location, and abstracts the
build process so that they can be maintained in an automated fashion. This also
allows the images to be architecture-independent.

All images will now be referred to by the test framework via the canonical
`gvisor.dev/images/<name>`, where `<name>` is a function of the path within the
source tree.

In a subsequent change, continuous integration will be added so that the images
will always be correct and available locally.

In the end, using `bazel` for Docker containers is simply not possible. Given
that we already have the need to use `make` with the base container (for
Docker), we extend this approach to get more flexibility.

This change also adds a self-documenting and powerful Makefile that is intended
to replace the collection of scripts in scripts. Canonical (self-documenting)
targets can be added here for targets that understand which images need to be
loaded and/or built.

PiperOrigin-RevId: 308322438
2020-04-24 14:11:42 -07:00