Commit Graph

170 Commits

Author SHA1 Message Date
gVisor bot 7c1c5917da Merge pull request #2797 from Rajpratik71:optimization/pip-no-cache
PiperOrigin-RevId: 323508910
2020-07-27 22:18:37 -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
Pratik raj b9d9418334 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
gVisor bot ea0342d470 Merge pull request #3356 from amscanne:generics_tests
PiperOrigin-RevId: 323066414
2020-07-24 13:59:45 -07:00
Ayush Ranjan c59b792f53 [go-marshal] Update API
- All Marshal* and Unmarshal* methods now require buffers to be correctly sized
- Only the Copy{In/Out} variants can handle smaller buffers (or address spaces)

PiperOrigin-RevId: 322953881
2020-07-24 01:19:34 -07:00
Adin Scannell ab0262bd94 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
Kevin Krakauer 3a2fac0ab9 Automated rollback of changelist 321227330
PiperOrigin-RevId: 322888057
2020-07-23 16:17:27 -07:00
Ayush Ranjan 6f7f739967 Marshallable socket opitons.
Socket option values are now required to implement marshal.Marshallable.

Co-authored-by: Rahat Mahmood <rahat@google.com>
PiperOrigin-RevId: 322831612
2020-07-23 11:45:10 -07:00
Michael Pratt 14839e027f Internal change
PiperOrigin-RevId: 322788791
2020-07-23 08:14:26 -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
Ian Lewis feb1d3d5a7 Clean up html on the website.
- Fixes some html validation issues.
- Fixes links on security basics blog post.
- Adds rel=noopener to links with target=_blank and adds a check to
  htmlproofer.
- Add favicon check to htmlproofer.

Fixes #3286
Fixes #3284

PiperOrigin-RevId: 321892602
2020-07-17 18:27:41 -07:00
Ting-Yu Wang 1d11c40378 Fix errors not getting caught when building vm image.
`set -e` does not catch errors in bash command substituions like
`echo $(bad cmd)` so bazel thinks it succeeded and cached the result.

PiperOrigin-RevId: 321412327
2020-07-15 12:20:23 -07:00
Kevin Krakauer 8a0082f5f3 remove IPv6 docker
Will re-submit when ICMP dest unreachable is handled correctly and it can be
turned back on.

PiperOrigin-RevId: 321227330
2020-07-14 13:49:15 -07:00
Ting-Yu Wang 87c33be9af Enable experimental features in docker.
PiperOrigin-RevId: 321062975
2020-07-13 17:02:32 -07:00
gVisor bot c81ac8ec3b Merge pull request #2672 from amscanne:shim-integrated
PiperOrigin-RevId: 321053634
2020-07-13 16:10:58 -07:00
Kevin Krakauer 3fe9be138c iptables: remove useless ip6tables VM rules
This rule isn't restored when the Kokoro VM is restarted, so it's not doing
anything. And the problem it was meant to solved is instead addressed by
https://github.com/google/gvisor/pull/3207.

PiperOrigin-RevId: 321026846
2020-07-13 13:54:54 -07:00
Adin Scannell 60dc5a4479 Automated rollback of changelist 320972241
PiperOrigin-RevId: 320999851
2020-07-13 11:43:28 -07:00
Adin Scannell 7ff4649b3c Use host networking for build container.
This will allow the use of default credentials.

PiperOrigin-RevId: 320972241
2020-07-13 09:39:06 -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
Adin Scannell 2f24ab3397 Allow arbitrary Go commands for go_mod.sh. 2020-07-09 16:59:43 -07:00
Kevin Krakauer 47ac142dc9 Enable docker IPv6 in kokoro
We need docker IPv6 for ip6tables tests. Docker has spotty IPv6 support, so just
enabling IPv6 in daemon.json breaks the Ruby image test (AFAICT it breaks
anything that tries to use IPv6 to reach the internet). An ip6tables NAT rule is
added to handle this.

We could make these changes as part of scripts/, but these would overwrite
global values and possibly break users' systems.

PiperOrigin-RevId: 318508209
2020-06-26 11:19:12 -07:00
Adin Scannell 364ac92baf Support for saving pointers to fields in the state package.
Previously, it was not possible to encode/decode an object graph which
contained a pointer to a field within another type. This was because the
encoder was previously unable to disambiguate a pointer to an object and a
pointer within the object.

This CL remedies this by constructing an address map tracking the full memory
range object occupy. The encoded Refvalue message has been extended to allow
references to children objects within another object. Because the encoding
process may learn about object structure over time, we cannot encode any
objects under the entire graph has been generated.

This CL also updates the state package to use standard interfaces intead of
reflection-based dispatch in order to improve performance overall. This
includes a custom wire protocol to significantly reduce the number of
allocations and take advantage of structure packing.

As part of these changes, there are a small number of minor changes in other
places of the code base:

* The lists used during encoding are changed to use intrusive lists with the
  objectEncodeState directly, which required that the ilist Len() method is
  updated to work properly with the ElementMapper mechanism.

* A bug is fixed in the list code wherein Remove() called on an element that is
  already removed can corrupt the list (removing the element if there's only a
  single element). Now the behavior is correct.

* Standard error wrapping is introduced.

* Compressio was updated to implement the new wire.Reader and wire.Writer
  inteface methods directly. The lack of a ReadByte and WriteByte caused issues
  not due to interface dispatch, but because underlying slices for a Read or
  Write call through an interface would always escape to the heap!

* Statify has been updated to support the new APIs.

See README.md for a description of how the new mechanism works.

PiperOrigin-RevId: 318010298
2020-06-23 23:34:06 -07:00
Michael Pratt 3970c12743 Remove various uses of 'whitelist'
Updates #2972

PiperOrigin-RevId: 317113059
2020-06-18 09:03:39 -07:00
Michael Pratt 6d806ee719 Remove various uses of 'blacklist'
Updates #2972

PiperOrigin-RevId: 316942245
2020-06-17 12:34:33 -07:00
Fabricio Voznika fbe41987c9 Enable nogo again
PiperOrigin-RevId: 316011323
2020-06-11 17:34:02 -07:00
Michael Pratt 0c7a5bc69c Add nogo TODO.
PiperOrigin-RevId: 315911025
2020-06-11 09:13:01 -07:00
gVisor bot ac37979ca8 Merge pull request #1875 from zhiqiangxu:fix_scope_add
PiperOrigin-RevId: 315341669
2020-06-08 13:34:58 -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 2c6c4365ea Move to make for tag release workflow.
This will make tag & release workflows idempotent.

PiperOrigin-RevId: 314154888
2020-06-01 10:31:26 -07:00
Adin Scannell 04a1f431e3 Fix the APT repository structure.
This change fixes the apt repository structure to avoid emiting warnings on
Ubuntu 18.04 (and potentially other versions). This requires a slight refactor
of the repository generation scripts, since we can no longer copy the same
release files for different "suites".

This should avoid the warning by setting the suite to the distribution:
  https://github.com/Debian/apt/blob/master/apt-pkg/metaindex.cc#L75

This change also moves over to the standardized Makefile entrypoint, which
makes settings clearer and enables local testing.

PiperOrigin-RevId: 313817017
2020-05-29 11:30:02 -07:00
gVisor bot 226cba97fb Merge pull request #2771 from amscanne:fix_build
PiperOrigin-RevId: 313652557
2020-05-28 13:49:31 -07:00
gVisor bot c826bb3502 Merge pull request #2748 from amscanne:go_branch
PiperOrigin-RevId: 313404235
2020-05-27 09:32:50 -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 8437ef752d Normalize permissions in the go branch.
Fixes #2722
2020-05-20 22:57:52 -07:00
Reapor-Yurnero 059879e143 Implement gap tracking in the segment set.
This change was derived from a change by:
  Reapor-Yurnero <reapor.yurnero@gmail.com>

And has been modified by:
  Adin Scannell <ascannell@google.com>

(The original change author is preserved for the commit.)

This change implements gap tracking in the segment set by adding additional
information in each node, and using that information to speed up gap finding
from a linear scan to a O(log(n)) walk of the tree.

This gap tracking is optional, and will default to off except for segment
instances that set gapTracking equal to 1 in their const lists.

PiperOrigin-RevId: 312621607
2020-05-20 22:50:07 -07:00
Nicolas Lacasse 2374660f11 Automated rollback of changelist 312522097
PiperOrigin-RevId: 312529859
2020-05-20 12:17:06 -07:00
Nicolas Lacasse 7f57a09008 Upgrade to Bazel 3.1.0.
This upgrades the Kokoro images, bazel toolchains used by RBE runners, and
rules_go, gazelle, and go toolchain versions.

PiperOrigin-RevId: 312522097
2020-05-20 11:36:24 -07:00
Adin Scannell cbfb55869e Implement Go branch updater with GitHub actions.
PiperOrigin-RevId: 312155686
2020-05-18 14:36:16 -07:00
Adin Scannell c5a939d76c Update vm scripts to handle existing kbuilder user.
PiperOrigin-RevId: 311751972
2020-05-15 10:09:54 -07:00
Adin Scannell 4502b73d00 Update Kokoro images to include newer gcloud.
PiperOrigin-RevId: 311658774
2020-05-14 20:22:45 -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 1f4087e7cd Fix tags used for determining file sets.
Updates #2569
Updates #2298

PiperOrigin-RevId: 310423629
2020-05-07 13:19:01 -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
gVisor bot 660a1a1028 Internal change.
PiperOrigin-RevId: 309801320
2020-05-04 12:49:29 -07:00