xref: /aosp_15_r20/external/cronet/third_party/libc++/src/utils/ci/run-buildbot-container (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1#!/usr/bin/env bash
2
3# This script starts a shell in a container running the libc++ build bot Docker
4# image. That image emulates the environment used by libc++'s Linux builders on
5# BuildKite.
6#
7# Once you're inside the shell, you can run the various build jobs with the
8# `run-buildbot` script.
9#
10# This script must be run from within the LLVM monorepo. Furthermore, the
11# monorepo will be mounted as `/llvm` inside the container. Be careful, the
12# state in `/llvm` is shared between the container and the host machine, which
13# is useful for editing files on the host machine and re-running the build bot
14# in the container.
15#
16# If you are on Linux you will likely not be able to write to the mount because
17# the user in the container doesn't have permissions to do so.
18# If you need to do this, give that user permission to do so after running
19# the container or add this flag to run the container as your local user IDs:
20# --user $(id -u):$(id -g)
21
22set -e
23
24MONOREPO_ROOT="$(git rev-parse --show-toplevel)"
25if [[ ! -d "${MONOREPO_ROOT}/libcxx/utils/ci" ]]; then
26    echo "Was unable to find the root of the LLVM monorepo; are you running from within the monorepo?"
27    exit 1
28fi
29docker pull ghcr.io/libcxx/actions-builder
30docker run -it --volume "${MONOREPO_ROOT}:/llvm" --workdir "/llvm" --cap-add=SYS_PTRACE ghcr.io/libcxx/actions-builder \
31    bash -c 'git config --global --add safe.directory /llvm ; exec bash'
32