[libcxx-commits] [PATCH] D97782: [libc++] Add a utility script to run the Docker image used by builders

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 2 10:05:11 PST 2021

ldionne created this revision.
Herald added subscribers: jkorous, arichardson.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Several contributors have been asking me how to reproduce the CI
environment locally. This is the last step towards making that work
out-of-the-box. Basically, just run `libcxx/utils/ci/run-buildbot-container`
and you're good to go.

  rG LLVM Github Monorepo



Index: libcxx/utils/ci/run-buildbot-container
--- /dev/null
+++ libcxx/utils/ci/run-buildbot-container
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+# This script starts a shell in a container running the libc++ build bot Docker
+# image. That image emulates the environment used by libc++'s Linux builders on
+# BuildKite.
+# Once you're inside the shell, you can run the various build jobs with the
+# `run-buildbot` script.
+# This script must be run from within the LLVM monorepo. Furthermore, the
+# monorepo will be mounted as `/llvm` inside the container. Be careful, the
+# state in `/llvm` is shared between the container and the host machine, which
+# is useful for editing files on the host machine and re-running the build bot
+# in the container.
+set -e
+MONOREPO_ROOT="$(git rev-parse --show-toplevel)"
+if [[ ! -d "${MONOREPO_ROOT}/libcxx/utils/ci" ]]; then
+    echo "Was unable to find the root of the LLVM monorepo; are you running from within the monorepo?"
+    exit 1
+docker pull ldionne/libcxx-builder
+docker run -it --volume "${MONOREPO_ROOT}:/llvm" --workdir "/llvm" ldionne/libcxx-builder bash
Index: libcxx/utils/ci/Dockerfile
--- libcxx/utils/ci/Dockerfile
+++ libcxx/utils/ci/Dockerfile
@@ -17,19 +17,10 @@
 # The environment variables in `secrets.env` must be replaced by the actual
 # tokens for this to work. These should obviously never be checked in.
-# To start a shell in the Docker image, use:
-#   $ docker run -it --volume "$(git rev-parse --show-toplevel):/llvm" --workdir "/llvm" $(docker build -q .) bash
-# This will fire up the Docker container and mount the root of the monorepo
-# as /llvm in the container. Be careful, the state in /llvm is shared between
-# the container and the host machine.
-# Finally, a pre-built version of this image is available on DockerHub as
-# ldionne/libcxx-builder. To use the pre-built version of the image, use
-#   $ docker pull ldionne/libcxx-builder
-#   $ docker run -it <options> ldionne/libcxx-builder
+# If you're only looking to run the Docker image locally for debugging a
+# build bot, see the `run-buildbot-container` script located in this directory.
+# A pre-built version of this image is maintained on DockerHub as ldionne/libcxx-builder.
 # To update the image, rebuild it and push it to ldionne/libcxx-builder (which
 # will obviously only work if you have permission to do so).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97782.327504.patch
Type: text/x-patch
Size: 2541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210302/698a7f07/attachment.bin>

More information about the libcxx-commits mailing list