This is an archive of the discontinued LLVM Phabricator instance.

[libc++][Android] Add Android support to CI Docker image
ClosedPublic

Authored by rprichard on Jul 14 2023, 1:23 AM.

Details

Summary

Add an Android compiler and sysroot to support cross-compilation to
Android.

Add the Android platform-tools (e.g. adb) so that an Android buildbot
can run programs on an Android device. At container startup, copy
these platform tools to an "android-platform-tools" Docker volume to
share them with an emulator container. This copying ensures that the
emulator and libcxx-builder containers avoid mismatched adb versions.

Install Docker into libcxx-builder so that an Android buildbot can
manage a sibling Docker container that runs the Android emulator.

Stop configuring the BuildKite tags in buildkite-agent.cfg and provide
the tags using BUILDKITE_AGENT_TAGS instead. Using the environment
variable makes it possible to run separate VMs for non-Android versus
Android.

Diff Detail

Event Timeline

rprichard created this revision.Jul 14 2023, 1:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 1:23 AM
rprichard requested review of this revision.Jul 14 2023, 1:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 1:23 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
rprichard added inline comments.Jul 14 2023, 1:27 AM
libcxx/utils/ci/Dockerfile
131 ↗(On Diff #540314)

I removed this setting in favor of setting an environment variable, e.g.:

BUILDKITE_AGENT_TAGS=queue=libcxx-builders,arch=x86_64,os=linux

However, if we want to use the same GCE VMs for Android and non-Android Linux, then we could keep setting the tags in the Dockerfile.

This change was copied from the larger D139147 change.

Mordante added subscribers: ldionne, Mordante.

I would like @ldionne to have a look too since this changes a bit of the Buildkite infrastructure.

libcxx/utils/ci/run-buildbot-container
24 ↗(On Diff #540314)

Why do we need this change?

rprichard added inline comments.Jul 22 2023, 2:34 PM
libcxx/utils/ci/run-buildbot-container
24 ↗(On Diff #540314)

I needed it for testing the updated Docker image. i.e. I would build ldionne/libcxx-builder locally with the Android stuff added to it, and then I'd enter the buildbot container to run run-buildbot android-ndk. If I were to run docker pull ldionne/libcxx-builder, though, my locally-modified image would be replaced with the published one.

This isn't a new problem, though, so I'm wondering how the Docker image is ordinarily updated. e.g. When updating ldionne/libcxx-builder, is someone (e.g. ldionne or a bot) running tests with the new image before pushing it? The script was simpler before, so maybe the old process was to run docker run ... by hand, and not use this run-buildbot-container script.

Mordante added inline comments.Jul 23 2023, 3:23 AM
libcxx/utils/ci/run-buildbot-container
24 ↗(On Diff #540314)

I just comment out that line when testing with a locally built version. I typically test a few build locally before pushing an update to Dockerhub.

rprichard added inline comments.Jul 23 2023, 9:39 PM
libcxx/utils/ci/run-buildbot-container
24 ↗(On Diff #540314)

I kinda dislike the practice of keeping local edits around because it makes other version control work harder. e.g. I've been rebasing/merging/splitting/amending the Android commits for a while. I think I can put a docker wrapper script in my PATH that disables docker pull ldionne/libcxx-builder. I might do that instead of a local edit.

I'm thinking --no-pull or --local-image might be better names for the option if it were kept.

Add the Android team's current Clang build to the libcxx-builder Dockerfile.

rprichard edited the summary of this revision. (Show Details)Aug 15 2023, 10:56 PM
rprichard updated this revision to Diff 550969.Aug 16 2023, 8:26 PM

Restore the buildkite-agent.cfg setting. I confirmed that the tags from this config file can be overridden using the BUILDKITE_AGENT_TAGS environment variable.

This revision was not accepted when it landed; it landed in state Needs Review.Oct 19 2023, 2:15 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.