Commit Graph

13 Commits

Author SHA1 Message Date
Stefano Bonicatti
66601db099 Fix OpenSSL build when no system ar is installed (#5782)
OpenSSL should use the ar binary provided by the custom toolchain.
Also updated the docker image to avoid installing binutils and hiding the
issue.
2019-09-09 19:19:20 -04:00
Stefano Bonicatti
0b2cd791d3 Linux custom toolchain integration (#5759)
- Always link to libc++abi.a, dl and rt.
- Add OSQUERY_TOOLCHAIN_SYSROOT option which should contain
  the path to the sysroot where the portable compiler and its libraries are in.
- Fix OpenSSL build with custom toolchain.
- Always include the custom toolchain cmake.
  Unfortunately system name detection is done when project() is called
  which is also when compiler detection is done, and we need the compiler
  to be set before that, so we always include the cmake file.
- Do not use getrandom syscall in Boost, for glibc < 2.25 support.
- Remove usage of secure_getenv and getauxval in librpm.
- Update CI to use the toolchain.
- Reflect changes in the docs.
2019-09-06 19:51:25 -04:00
Stefano Bonicatti
0861929498
Implement caching on the CI (#5754)
Use the new CacheBeta task to cache and restore the ccache
directory, which greatly improves build times.

The cache is saved only if the job ends with success.

A pipeline variable CacheVersion present in the cache key
is used to invalidate all old caches if such a need arises.
2019-09-06 22:11:45 +02:00
Stefano Bonicatti
e51098b76a Add missing tests not run in Buck (#5752)
All the tests under tests/ and plugins/from the root of the project were not run.
2019-09-05 19:32:58 -04:00
Alessandro Gario
6481b34e23
Refactor third-party libraries to build from source on Linux (#5706)
Add a way to compile third-party libraries from source instead of downloading prebuilt ones.
Each library source code is downloaded with git into a submodule at configure time,
in response to the find_package(library_name) CMake call,
except for OpenSSL where the official source archive is used.
Each submodule is attached to a release tag on its own upstream repository.
All the libraries are built using CMake directly, except for OpenSSL which uses a formula system,
which permits to build libraries with a separate build system
when there's no easy way to integrate it directly with CMake.

This new dependency system determines which library is fetched from where using the concept of "layers".
Currently we have three of them: source, formula, facebook,
where the last layer represents the pre-built libraries.
The provided order will be used when looking for libraries.

A system to patch submodule source code has been added and it's currently used with googletest, libudev and util-linux.
Patches should be put under libraries/cmake/source/<library name>/patches/<submodule>,
where <submodule> is often one and is "src", but in other cases, like AWS,
there are multiple with a more specific name.
If for whatever reason the submodule cloning or the patching fails,
the submodule has to be unregistered and its folder should be cleared.
This should be achievable with "git submodule deinit -f <submodule path>"

Following some other changes on existing functionality:

- Changed the CMake variable BUILD_TESTING to OSQUERY_BUILD_TESTS
  to avoid enabling tests on third party libraries.
  Due to an issue with glog the BUILD_TESTING variable
  will be always forced to OFF.
- Moved compiler and linker flags to their own file cmake/flags.cmake
- Moved all the third-party CMakeLists.txt used for pre-built libraries under libraries/cmake/facebook
- Added the --exclude-folders option to tools/format-check.py and tools/git-clang-format.py,
  so that it's possible to ignore any third party library source code.
- The format and format_check target use the new --exclude-folders option
  to exclude libraries/cmake/source from formatting.
- The test and osquery binaries are properly compiled with PIE (osquery/osquery#5611)

Co-authored-by: Stefano Bonicatti <stefano.bonicatti@gmail.com>
Co-authored-by: Teddy Reed <teddy@casualhacking.io>
2019-08-30 16:25:19 +02:00
Stefano Bonicatti
f2514a347e
Fix python detection on Azure Pipelines (#5673)
A new Windows VM has been recently deployed that moves the
Python 2 installation, Windows Buck builds are now failing.

Support the old and new path for Python 2 and
support multiple minor versions of python instead of hardcoding one.
2019-07-29 10:26:23 +02:00
Stefano Bonicatti
31e35ae276 Add buck builds on Azure Pipelines (#5632)
First part of osquery/osquery#5620

Remove travis.
2019-07-11 17:12:54 -07:00
Stefano Bonicatti
08c36472cf Enable Debug builds on the CI (#5626)
* Add an option to avoid generating debug symbols

A new option, OSQUERY_NO_DEBUG_SYMBOLS, has been added
to avoid generating debug symbols when building in Debug or RelWithDebInfo.
This is especially needed on the CI where the disk size is limited
and symbols are not necessary, because we cannot directly access
processes to debug them.

* Enable Debug builds on the CI

Enabled Debug builds on macOS and Linux; a special job has been created
to represent the combined build status of Release and Debug builds.

Also format the other long cmakeArgs line so that there's one argument
per line.

* Run Docker as privileged also in Debug builds

* Simplify azure pipelines configuration

Use strategy and matrix to avoid repeating the script
for Release and Debug builds.
2019-07-10 00:32:26 +02:00
Stefano Bonicatti
f34afd223c Fix ConfigTests.test_content_update
Do not checkout with carriage returns on Windows, otherwise it would
mess up with code that expect unix style files.
2019-07-09 12:59:45 +02:00
Stefano Bonicatti
6e928157b3 Fix ebpf tests failing.
Fix ebpfTests.sysEbpf_null_attr, ebpfTests.sysEbpf_create_map,
ebpfMapTests.int_key_int_value, ebpfMapTests.int_key_struct_value
by running Docker as privileged on Azure Pipelines.

Docker is used only to get a new distribution running, it's not used
for any security purpose, so there's no point in limiting it.
2019-07-09 12:59:45 +02:00
Stefano Bonicatti
dc7ffb820a
Fix tests output and yaml formatting for Azure Pipelines (#5613)
Apparently there's a bug in the visualization of the logs,
where color codes eat characters.
So we disable tests colored output until a fix on Azure Pipelines appears.

Formatting a bit more consistently the yaml file.
2019-06-29 12:48:08 +02:00
Stefano Bonicatti
2addb87602
Merge Azure Pipelines build and test jobs (#5610)
Originally the separation existed because there were multiple branches,
and only one of them was protected by PRs.
So broken commits could land and differentiating from broken build
or tests was useful.

This is not true anymore and PRs checks are per pipeline, not per job,
so the separation wouldn't make a difference.
2019-06-28 08:59:14 -04:00
Stefano Bonicatti
f8e279b4b9 Add Azure Pipelines support
Taken from osql-experimental.

- Use AppleClang compiler for macOS

- Run format_check on Linux

- Run pipeline only on master
2019-06-26 21:49:06 -04:00