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

[Telemetry] Detect if vcpkg is running in a container #730

Merged
merged 9 commits into from
Oct 12, 2022

Conversation

vicroms
Copy link
Member

@vicroms vicroms commented Oct 7, 2022

Implement basic container detection heuristics:

  • Windows containers
    • Try to find Container Execution Service through registry
    • Try to find username ContainerAdministrator or ContainerUser
  • Linux containers
    • Try to find /.dockerenv file
    • Try to check control groups
  • Verify working on Linux container
  • Verify working on Windows container
  • Hook detection to telemetry
  • Don't run heuristics if metrics are disabled
  • Tests (how do we test this?)

Working on Linux container:
vcpkg on linux container

Working on Windows container
vcpkg on windows container

src/vcpkg.cpp Outdated Show resolved Hide resolved
src/vcpkg.cpp Outdated Show resolved Hide resolved
@vicroms vicroms marked this pull request as ready for review October 9, 2022 02:35
@vicroms vicroms changed the title [wip][Telemetry] Detect if vcpkg is running in a container [Telemetry] Detect if vcpkg is running in a container Oct 9, 2022
include/vcpkg/metrics.h Outdated Show resolved Hide resolved
src/vcpkg.cpp Show resolved Hide resolved
src/vcpkg.cpp Outdated Show resolved Hide resolved
src/vcpkg.cpp Outdated Show resolved Hide resolved
src/vcpkg/metrics.cpp Outdated Show resolved Hide resolved
vicroms and others added 2 commits October 11, 2022 17:44
Co-authored-by: Billy O'Neal <bion@microsoft.com>
src/vcpkg.cpp Outdated Show resolved Hide resolved
using P = ParserBase;
constexpr auto is_separator_or_lineend = [](auto ch) { return ch == ':' || P::is_lineend(ch); };

auto parser = ParserBase(text, origin);
Copy link
Member

Choose a reason for hiding this comment

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

❣️

@BillyONeal BillyONeal merged commit b586c27 into microsoft:main Oct 12, 2022
@vicroms vicroms deleted the detect_container branch October 12, 2022 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants