Commit Graph

40 Commits

Author SHA1 Message Date
Andrei Vagin d4386896d6 Fix "Installing from source" instructions
Fixes #6387
2021-10-05 17:32:15 -07:00
Andrei Vagin 95fe4fea19 tools/show_paths.bzl: check that provider_map isn't None
Otherwise it can fail:
$ bazel cquery pkg/p9/... --output=starlark --starlark:file=tools/show_paths.bzl
...
ERROR: Starlark evaluation error for //pkg/p9/p9test:mockgen:
Traceback (most recent call last):
	File "tools/show_paths.bzl", line 8, column 32, in format
Error: 'NoneType' value has no field or method 'get'
PiperOrigin-RevId: 396457764
2021-09-13 15:35:22 -07:00
Adin Scannell 8dc3be7a61 Use --output=starlark trick for all build path parsing.
There is no reason to limit this to debian paths.

PiperOrigin-RevId: 392469415
2021-08-23 10:53:38 -07:00
Ayush Ranjan c2353e4055 [op] Fix //debian:debian.
Co-authored-by: Andrei Vagin <avagin@google.com>
PiperOrigin-RevId: 390232925
2021-08-11 15:28:51 -07:00
Tamir Duberstein fb422db706 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
Ayush Ranjan 010cadd3b8 [infra] Fix Build Github action failure.
The GH Build action has been failing with the error message:
```
--- BUILD -c opt //runsc
tee: /proc/self/fd/2: No such device or address
```

tee /dev/fd/2 seems to be the canonical way of copying stdin to stderr.
So use that instead.

PiperOrigin-RevId: 353259087
2021-01-22 09:42:15 -08:00
Adin Scannell be2b9d75d7 Drop shutdown in docker run.
This can race and cause issues. Instead, a manual shutdown can be done
via 'bazel-shutdown' if required for specific cases. The ARM64 builds
are now done using cross-compilation, so this hack is not necessary.

PiperOrigin-RevId: 351477908
2021-01-12 17:02:11 -08:00
Adin Scannell 0c99ab7090 Support releasing aarch64 builds.
This change works around an issue in rules_pkg, described here:
  https://github.com/bazelbuild/rules_pkg/pull/263

PiperOrigin-RevId: 350869030
2021-01-08 18:03:17 -08:00
Andrei Vagin 8de562b799 Add ARM smoke test
make BAZEL_CONFIG=aarch64 arm-qemu-smoke-test

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2021-01-07 17:41:43 -08:00
Adin Scannell f89af8b504 Don't canonicalize cache directory.
... Otherwise it will be mounted in via some other path, and will
not be available inside the container at all.

PiperOrigin-RevId: 350440843
2021-01-06 15:37:54 -08:00
Adin Scannell a1e3845b65 Make build command more robust.
This returns all targets, and handles no targets.

PiperOrigin-RevId: 350263578
2021-01-05 18:55:05 -08:00
Adin Scannell 3b1d37f6ab Remove remote execution support.
PiperOrigin-RevId: 349616845
2020-12-30 16:54:16 -08:00
Adin Scannell 899b9ba46a Add BuildKite annotations for failures and profiles.
This change cleans up some minor Makefile issues, and adds support for
BuildKite annotations on failure and on profiles being generated. These
annotations will make failures very clear and link to the artifacts.

This change is a stepping stone for aggregating coverage data from all
individual test jobs, as this will also happen in .buildkite/annotate.sh.

PiperOrigin-RevId: 349606598
2020-12-30 15:09:12 -08:00
Adin Scannell 65a2242db4 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 Scannell a855a814d6 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
Adin Scannell 80552b936d Support partitions for other tests.
PiperOrigin-RevId: 345399936
2020-12-03 01:00:21 -08:00
Adin Scannell a94663ee56 Fix bad Makefile variable reference.
PiperOrigin-RevId: 343946859
2020-11-23 16:04:29 -08:00
Adin Scannell 756bc3e52b Clean up build output.
This change also simplifies and documents the build_cmd pipeline, and
reduces general noise for debugging Makefile issues.

It also drops the mapping for /etc/docker/daemon.json, which if it
does not exist initially will create this as a directory (causing lots
of confusion and breaks).

PiperOrigin-RevId: 343932456
2020-11-23 14:45:34 -08:00
Adin Scannell 3a6f046ae8 Avoid creating users if user is root already.
PiperOrigin-RevId: 339886754
2020-10-30 09:41:04 -07:00
Adin Scannell 54e989ec3a Remove legacy bazel configurations.
Using the newer bazel rules necessitates a transition from proto1 to
proto2. In order to resolve the incompatibility between proto2 and
gogoproto, the cri runtimeoptions proto must be vendored.

Further, some of the semantics of bazel caching changed during the
transition. It is now necessary to:

- Ensure that :gopath depends only on pure library targets, as the
  propagation of go_binary build attributes (pure, static) will
  affected the generated files (though content remains the same,
  there are conflicts with respect to the gopath).
- Update bazel.mk to include the possibility of binaries in the
  bazel-out directory, as it will now put runsc and others there.
  This required some refinements to the mechanism of extracting
  paths, since some the existing regex resulted in false positives.
- Change nogo rules to prevent escape generation on binary targets.
  For some reason, the newer version of bazel attempted to run the
  nogo analysis on the binary targets, which fails due to the fact
  that objdump does not work on the final binary. This must be due
  to a change in the semantics of aspects in bazel3.

PiperOrigin-RevId: 337958324
2020-10-19 16:28:40 -07:00
Dean Deng 7e55ee14eb Fix text processing in bazel build command.
The extraction of the build target was overfitted before, making build_cmd fail
in some environments.

PiperOrigin-RevId: 335916651
2020-10-07 11:45:26 -07:00
Adin Scannell 994c90e2d2 Add nogo check annotations to GitHub.
When nogo checks are violated, they will automatically posted
as annotations on the specific GitHub commit. This allows us
to ensure analysis & style rules and have them called out.

PiperOrigin-RevId: 334447285
2020-09-29 13:16:54 -07:00
Andrei Vagin 2111cba9ce make: specify /dev/null for the tail tool 2020-09-23 21:05:45 -07:00
Ayush Ranjan d796b100ec Provide testing container with docker config file.
This is needed by test/e2e/integration_test:TestCheckpointRestore to check for
filesystem versioning.

PiperOrigin-RevId: 332285566
2020-09-17 12:11:41 -07:00
Adin Scannell c5f5806fe6 Enable "make packetimpact-tests" to work.
This required minor fixes to the bazel wrapper. The "dut_platform" is
also changed to "native" to line-up with the system call tests and
remove the hard-coded "linux" and "netstack" strings.
2020-08-04 20:49:00 -07:00
Adin Scannell 877fac4864 Allocate a pseudo-tty for exec.
Otherwise Ctrl-C will kill the 'docker exec' as opposed to killing
the bazel command being run inside the container.

PiperOrigin-RevId: 324079339
2020-07-30 14:11:09 -07:00
Bhasker Hariharan 4d076ec152 Fix for gvisor-builder image.
As it happens
gvisor/tools/bazel.mk:88
 useradd --uid $(UID) --non-unique --no-create-home \
adds the user-id to /var/log/lastlog which happens to be a sparse file except
Go's tar support can't handle sparse files so it actually tries to allocate
the file to seek to the end causing the VM to run out of disk space.

See:
https://github.com/moby/moby/issues/5419#issuecomment-193876183

The fix is to pass -l to useradd to prevent it from trying to add to lastlog.

Fixes #3397

PiperOrigin-RevId: 323492591
2020-07-27 19:38:35 -07:00
Adin Scannell 4b336f16b8 Enable RBE for standard-tests.
PiperOrigin-RevId: 323454998
2020-07-27 15:36:21 -07:00
Adin Scannell d0fd97541a Clean-up bazel wrapper.
The bazel server was being started as the wrong user, leading to issues
where the container would suddenly exit during a build.

We can also simplify the waiting logic by starting the container in two
separate steps: those that must complete first, then the asynchronous bit.

PiperOrigin-RevId: 323391161
2020-07-27 10:40:29 -07:00
Ayush Ranjan c9399797d8 Fix kokoro presubmits!
Fixed the following error:
tools/bazel.mk:119: *** Destination not provided..  Stop.
The issue was that we were running all make commands in a subshell so variables
like $T were not passed on.

The other issue was related to credentials. The test passed locally but not on
kokoro, the only difference in the workflow was the credentials bit.

Also fixed up some other tiny issues I came across, were not blockers.

PiperOrigin-RevId: 322782457
2020-07-23 07:29:06 -07:00
Adin Scannell e1a04f84e8 Add standard entrypoints for test targets.
PiperOrigin-RevId: 322265513
2020-07-20 18:05:05 -07:00
Adin Scannell 2afff44403 Update shim to build using bazel.
The go.mod dependency tree for the shim was somehow contradictory. After
resolving these issues (e.g. explicitly imported k8s 1.14, pulling a
specific dbus version), and adding all dependencies, the shim can now be
build as part of the regular bazel tree.

As part of this process, minor cleanup was done in all the source files:
headers were standardized (and include "The gVisor Authors" in addition
to the "The containerd Authors" if originally derived from containerd
sources), and comments were cleaned up to meet coding standards.

This change makes the containerd installation dynamic, so that multiple
versions can be tested, and drops the static installer for the VM image
itself.

This change also updates test/root/crictl_test.go and related utilities,
so that the containerd tests can be run on any version (and in cases
where it applies, they can be run on both v1 and v2 as parameterized
tests).
2020-07-09 17:39:47 -07:00
Andrei Vagin 5e4d7072a6 make: Allow to specify bazel startup options.
And don't parse binary paths for the build target.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2020-06-02 11:30:26 -07:00
Adin Scannell a6325cca51 Ensure docker group exists in the container.
The --groups command will fail if the group is not defined in
/etc/groups, even though it is specified by GID.

By coincidence, the group happens to be there for many installations of
Ubuntu 18.04 (which uses 999 for the Docker group), but it is strangely
absent in others (which use 130).

Fixes #2765
2020-05-25 18:21:03 -07:00
Adin Scannell f589a85889 Run issue_reviver via GitHub.
PiperOrigin-RevId: 311600872
2020-05-14 14:02:43 -07:00
gVisor bot a3f97a757a Merge pull request #2513 from amscanne:website-integrated
PiperOrigin-RevId: 311184385
2020-05-12 12:55:23 -07:00
Andrei Vagin 5d54ddcf03 make: exit with non-zero code if "bazel build" failed
Without this fix, make exits with zero code when bazel build failed:

$ make run TARGETS="--abra --kadabra"
ERROR: Unrecognized option: --abra
$ echo $?
0

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2020-05-07 18:25:32 -07:00
Adin Scannell 5536073969 make: bazel docker container should clean itself up.
This change two does things:

1) Name the container based on the canonical directory path.

2) Allow the container to exit after bazel itself has exited.

The first is necessary to support multiple working directories,
while the second one allows these instances to clean up properly.

PiperOrigin-RevId: 310460748
2020-05-07 16:39:37 -07:00
Adin Scannell 508e25b6d6 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 Scannell c60613475c 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