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

[libc++] Add a Github action to build libc++'s Docker images #110020

Merged

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Sep 25, 2024

This patch adds a Github action that runs whenever changes to the libc++ Docker images are pushed to main. The action will rebuild the Docker images and push them to LLVM's container registry so that we can then point to those images from our CI nodes.

@ldionne ldionne requested a review from EricWF September 25, 2024 18:04
@llvmbot llvmbot added libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. github:workflow labels Sep 25, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 25, 2024

@llvm/pr-subscribers-github-workflow

Author: Louis Dionne (ldionne)

Changes

This patch adds a Github action that runs whenever changes to the libc++ Docker images are pushed to main. The action will rebuild the Docker images and push them to LLVM's container registry so that we can then point to those images from our CI nodes.


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

1 Files Affected:

  • (added) .github/workflows/libcxx-build-containers.yaml (+51)
diff --git a/.github/workflows/libcxx-build-containers.yaml b/.github/workflows/libcxx-build-containers.yaml
new file mode 100644
index 00000000000000..e4ff2141f1357e
--- /dev/null
+++ b/.github/workflows/libcxx-build-containers.yaml
@@ -0,0 +1,51 @@
+# This file defines an action that builds the various Docker images used to run
+# libc++ CI whenever modifications to those Docker files are pushed to `main`.
+#
+# The images are pushed to the LLVM package registry at https://github.com/orgs/llvm/packages
+# and tagged appropriately. The selection of which Docker image version is used by the libc++
+# CI nodes at any given point is controlled by the libc++ maintainers using a mechanism that
+# is not publicly visible for safety purposes.
+
+name: Build Docker images for libc++ CI
+
+permissions:
+  contents: read
+  packages: write
+
+on:
+  push:
+    branches:
+      - main
+    paths:
+      - 'libcxx/utils/ci/**'
+
+jobs:
+  build-and-push:
+    runs-on: ubuntu-latest
+    if: github.repository_owner == 'llvm'
+
+    steps:
+    - uses: actions/checkout@v4
+
+    - name: Log in to GitHub Container Registry
+      uses: docker/login-action@v3
+      with:
+        registry: ghcr.io
+        username: ${{ github.actor }}
+        password: ${{ secrets.GITHUB_TOKEN }}
+
+    - name: Build and push the Linux builder image
+      working-directory: libcxx/utils/ci
+      run:
+        - docker compose build actions-builder
+        - docker compose push actions-builder
+      env:
+        TAG: libcxx-linux-builder:${{ github.sha }}
+
+    - name: Build and push the Android builder image
+      working-directory: libcxx/utils/ci
+      run:
+        - docker compose build android-buildkite-builder
+        - docker compose push android-buildkite-builder
+      env:
+        TAG: libcxx-android-builder:${{ github.sha }}

@llvmbot
Copy link
Member

llvmbot commented Sep 25, 2024

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

Changes

This patch adds a Github action that runs whenever changes to the libc++ Docker images are pushed to main. The action will rebuild the Docker images and push them to LLVM's container registry so that we can then point to those images from our CI nodes.


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

1 Files Affected:

  • (added) .github/workflows/libcxx-build-containers.yaml (+51)
diff --git a/.github/workflows/libcxx-build-containers.yaml b/.github/workflows/libcxx-build-containers.yaml
new file mode 100644
index 00000000000000..e4ff2141f1357e
--- /dev/null
+++ b/.github/workflows/libcxx-build-containers.yaml
@@ -0,0 +1,51 @@
+# This file defines an action that builds the various Docker images used to run
+# libc++ CI whenever modifications to those Docker files are pushed to `main`.
+#
+# The images are pushed to the LLVM package registry at https://github.com/orgs/llvm/packages
+# and tagged appropriately. The selection of which Docker image version is used by the libc++
+# CI nodes at any given point is controlled by the libc++ maintainers using a mechanism that
+# is not publicly visible for safety purposes.
+
+name: Build Docker images for libc++ CI
+
+permissions:
+  contents: read
+  packages: write
+
+on:
+  push:
+    branches:
+      - main
+    paths:
+      - 'libcxx/utils/ci/**'
+
+jobs:
+  build-and-push:
+    runs-on: ubuntu-latest
+    if: github.repository_owner == 'llvm'
+
+    steps:
+    - uses: actions/checkout@v4
+
+    - name: Log in to GitHub Container Registry
+      uses: docker/login-action@v3
+      with:
+        registry: ghcr.io
+        username: ${{ github.actor }}
+        password: ${{ secrets.GITHUB_TOKEN }}
+
+    - name: Build and push the Linux builder image
+      working-directory: libcxx/utils/ci
+      run:
+        - docker compose build actions-builder
+        - docker compose push actions-builder
+      env:
+        TAG: libcxx-linux-builder:${{ github.sha }}
+
+    - name: Build and push the Android builder image
+      working-directory: libcxx/utils/ci
+      run:
+        - docker compose build android-buildkite-builder
+        - docker compose push android-buildkite-builder
+      env:
+        TAG: libcxx-android-builder:${{ github.sha }}

Copy link
Collaborator

@tstellar tstellar left a comment

Choose a reason for hiding this comment

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

This looks good to me.

@ldionne
Copy link
Member Author

ldionne commented Sep 25, 2024

@tstellar Do you know how I could test this? How did you test .github/workflows/build-ci-container.yml when you first came up with it?

@boomanaiden154
Copy link
Contributor

Do you know how I could test this? How did you test .github/workflows/build-ci-container.yml when you first came up with it?

We added a pull_request event to it and then conditioned the actual upload on being a push event. So it builds the container and runs through everything in a pull request modifying it, but only actually uploads and deploys when it gets pushed into main.

steps:
- uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
Copy link
Member

Choose a reason for hiding this comment

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

Can we move the login after the build, that way we can't capture the docker credentials inside the build?

Copy link
Member

@EricWF EricWF left a comment

Choose a reason for hiding this comment

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

LGTM after the slight change regarding the credentials.

This patch adds a Github action that runs whenever changes to the
libc++ Docker images are pushed to `main`. The action will rebuild
the Docker images and push them to LLVM's container registry so that
we can then point to those images from our CI nodes.
@ldionne ldionne force-pushed the review/ci-build-libcxx-docker-container-action branch from 7c02307 to 45482ba Compare November 15, 2024 07:31
@ldionne ldionne merged commit 1799d57 into llvm:main Nov 15, 2024
6 checks passed
@ldionne ldionne deleted the review/ci-build-libcxx-docker-container-action branch November 15, 2024 07:36
akshayrdeodhar pushed a commit to akshayrdeodhar/llvm-project that referenced this pull request Nov 18, 2024
…0020)

This patch adds a Github action that runs whenever changes to the libc++
Docker images are pushed to `main`. The action will rebuild the Docker
images and push them to LLVM's container registry so that we can then
point to those images from our CI nodes.
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.

5 participants