Skip to content

[libcxx] Enable installing new runner binary on existing container #148073

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

Open
wants to merge 1 commit into
base: users/boomanaiden154/main.libcxx-enable-installing-new-runner-binary-on-existing-container
Choose a base branch
from

Conversation

boomanaiden154
Copy link
Contributor

This patch does some refactoring to enable installing a new GHA runner binary
into an existing libcxx image. We achieve this by pushing the base image to the
registry and enabling control over the base image used for building the actions
image. This will always build and push both images even if an existing image is
being used for the actions image, but this should not impact anything as the
SHAs are pinned everywhere and space/build time is not a large concern.

Created using spr 1.3.4
@llvmbot llvmbot added libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. github:workflow labels Jul 10, 2025
@boomanaiden154
Copy link
Contributor Author

This depends on #148072.

@llvmbot
Copy link
Member

llvmbot commented Jul 10, 2025

@llvm/pr-subscribers-github-workflow

Author: Aiden Grossman (boomanaiden154)

Changes

This patch does some refactoring to enable installing a new GHA runner binary
into an existing libcxx image. We achieve this by pushing the base image to the
registry and enabling control over the base image used for building the actions
image. This will always build and push both images even if an existing image is
being used for the actions image, but this should not impact anything as the
SHAs are pinned everywhere and space/build time is not a large concern.


Full diff: https://github.com/llvm/llvm-project/pull/148073.diff

3 Files Affected:

  • (modified) .github/workflows/libcxx-build-containers.yml (+4-1)
  • (modified) libcxx/utils/ci/Dockerfile (+2-1)
  • (modified) libcxx/utils/ci/docker-compose.yml (+11)
diff --git a/.github/workflows/libcxx-build-containers.yml b/.github/workflows/libcxx-build-containers.yml
index 564a79341edb1..32777c217950b 100644
--- a/.github/workflows/libcxx-build-containers.yml
+++ b/.github/workflows/libcxx-build-containers.yml
@@ -36,7 +36,9 @@ jobs:
 
     - name: Build the Linux builder image
       working-directory: libcxx/utils/ci
-      run: docker compose build actions-builder
+      run: |
+        docker compose build builder-base
+        docker compose build actions-builder
       env:
         TAG: ${{ github.sha }}
 
@@ -57,6 +59,7 @@ jobs:
       if: github.event_name == 'push'
       working-directory: libcxx/utils/ci
       run: |
+        docker compose push builder-base
         docker compose push actions-builder
       env:
         TAG: ${{ github.sha }}
diff --git a/libcxx/utils/ci/Dockerfile b/libcxx/utils/ci/Dockerfile
index 316e9c7490991..24062d4cac2c2 100644
--- a/libcxx/utils/ci/Dockerfile
+++ b/libcxx/utils/ci/Dockerfile
@@ -38,6 +38,7 @@
 # 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.
 
+ARG ACTIONS_BASE_IMAGE
 
 # HACK: We set the base image in the docker-compose file depending on the final target (buildkite vs github actions).
 # This means we have a much slower container build, but we can use the same Dockerfile for both targets.
@@ -310,7 +311,7 @@ CMD /opt/android/container-setup.sh && buildkite-agent start
 #
 # IMAGE: ghcr.io/libcxx/actions-builder.
 #
-FROM builder-base AS actions-builder
+FROM $ACTIONS_BASE_IMAGE AS actions-builder
 
 ARG GITHUB_RUNNER_VERSION
 
diff --git a/libcxx/utils/ci/docker-compose.yml b/libcxx/utils/ci/docker-compose.yml
index 20536bc32fa65..dec05a9742c27 100644
--- a/libcxx/utils/ci/docker-compose.yml
+++ b/libcxx/utils/ci/docker-compose.yml
@@ -3,6 +3,16 @@ x-versions: &compiler_versions
   LLVM_HEAD_VERSION: 21
 
 services:
+  builder-base:
+    image: ghcr.io/llvm/libcxx-linux-builder-base:${TAG}
+    build:
+      context: .
+      dockerfile: Dockerfile
+      target: builder-base
+      args:
+        BASE_IMAGE: ubuntu:jammy
+        <<: *compiler_versions
+
   actions-builder:
     image: ghcr.io/llvm/libcxx-linux-builder:${TAG}
     build:
@@ -11,6 +21,7 @@ services:
       target: actions-builder
       args:
         BASE_IMAGE: ubuntu:jammy
+        ACTIONS_BASE_IMAGE: builder-base
         GITHUB_RUNNER_VERSION: "2.326.0"
         <<: *compiler_versions
 

@llvmbot
Copy link
Member

llvmbot commented Jul 10, 2025

@llvm/pr-subscribers-libcxx

Author: Aiden Grossman (boomanaiden154)

Changes

This patch does some refactoring to enable installing a new GHA runner binary
into an existing libcxx image. We achieve this by pushing the base image to the
registry and enabling control over the base image used for building the actions
image. This will always build and push both images even if an existing image is
being used for the actions image, but this should not impact anything as the
SHAs are pinned everywhere and space/build time is not a large concern.


Full diff: https://github.com/llvm/llvm-project/pull/148073.diff

3 Files Affected:

  • (modified) .github/workflows/libcxx-build-containers.yml (+4-1)
  • (modified) libcxx/utils/ci/Dockerfile (+2-1)
  • (modified) libcxx/utils/ci/docker-compose.yml (+11)
diff --git a/.github/workflows/libcxx-build-containers.yml b/.github/workflows/libcxx-build-containers.yml
index 564a79341edb1..32777c217950b 100644
--- a/.github/workflows/libcxx-build-containers.yml
+++ b/.github/workflows/libcxx-build-containers.yml
@@ -36,7 +36,9 @@ jobs:
 
     - name: Build the Linux builder image
       working-directory: libcxx/utils/ci
-      run: docker compose build actions-builder
+      run: |
+        docker compose build builder-base
+        docker compose build actions-builder
       env:
         TAG: ${{ github.sha }}
 
@@ -57,6 +59,7 @@ jobs:
       if: github.event_name == 'push'
       working-directory: libcxx/utils/ci
       run: |
+        docker compose push builder-base
         docker compose push actions-builder
       env:
         TAG: ${{ github.sha }}
diff --git a/libcxx/utils/ci/Dockerfile b/libcxx/utils/ci/Dockerfile
index 316e9c7490991..24062d4cac2c2 100644
--- a/libcxx/utils/ci/Dockerfile
+++ b/libcxx/utils/ci/Dockerfile
@@ -38,6 +38,7 @@
 # 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.
 
+ARG ACTIONS_BASE_IMAGE
 
 # HACK: We set the base image in the docker-compose file depending on the final target (buildkite vs github actions).
 # This means we have a much slower container build, but we can use the same Dockerfile for both targets.
@@ -310,7 +311,7 @@ CMD /opt/android/container-setup.sh && buildkite-agent start
 #
 # IMAGE: ghcr.io/libcxx/actions-builder.
 #
-FROM builder-base AS actions-builder
+FROM $ACTIONS_BASE_IMAGE AS actions-builder
 
 ARG GITHUB_RUNNER_VERSION
 
diff --git a/libcxx/utils/ci/docker-compose.yml b/libcxx/utils/ci/docker-compose.yml
index 20536bc32fa65..dec05a9742c27 100644
--- a/libcxx/utils/ci/docker-compose.yml
+++ b/libcxx/utils/ci/docker-compose.yml
@@ -3,6 +3,16 @@ x-versions: &compiler_versions
   LLVM_HEAD_VERSION: 21
 
 services:
+  builder-base:
+    image: ghcr.io/llvm/libcxx-linux-builder-base:${TAG}
+    build:
+      context: .
+      dockerfile: Dockerfile
+      target: builder-base
+      args:
+        BASE_IMAGE: ubuntu:jammy
+        <<: *compiler_versions
+
   actions-builder:
     image: ghcr.io/llvm/libcxx-linux-builder:${TAG}
     build:
@@ -11,6 +21,7 @@ services:
       target: actions-builder
       args:
         BASE_IMAGE: ubuntu:jammy
+        ACTIONS_BASE_IMAGE: builder-base
         GITHUB_RUNNER_VERSION: "2.326.0"
         <<: *compiler_versions
 

@boomanaiden154 boomanaiden154 requested review from ldionne and EricWF and removed request for ldionne July 10, 2025 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github:workflow libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants