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

Set up remote builders #23

Merged
merged 3 commits into from
Sep 23, 2022
Merged

Set up remote builders #23

merged 3 commits into from
Sep 23, 2022

Conversation

crazy-max
Copy link
Member

Signed-off-by: CrazyMax crazy-max@users.noreply.github.com

@crazy-max
Copy link
Member Author

Looks good:

NAME/NODE                                       DRIVER/ENDPOINT             STATUS  BUILDKIT         PLATFORMS
builder-34774e78-9bcd-419b-b554-a2640ed62f1e *  docker-container                                     
  builder-34774e78-9bcd-419b-b554-a2640ed62f1e0 unix:///var/run/docker.sock running v0.10.4          linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/amd64/v4, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
  builder-34774e78-9bcd-419b-b554-a2640ed62f1e1 ssh://***@***  running v0.10.4          linux/arm64*, linux/arm/v7*, linux/arm/v5*, linux/arm/v6*
default                                         docker                                               
  default                                       default                     running 20.10.17+azure-3 linux/amd64, linux/386, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/arm/v7, linux/arm/v6

@crazy-max
Copy link
Member Author

Outch:

$ docker ps -a
CONTAINER ID   IMAGE                           COMMAND       CREATED              STATUS                     PORTS     NAMES
2f022df15675   moby/buildkit:buildx-stable-1   "buildkitd"   45 seconds ago       Up 43 seconds                        buildx_buildkit_builder-d39baf45-89cb-413a-b5a6-994e329c72441
dd1aead9f667   moby/buildkit:buildx-stable-1   "buildkitd"   53 seconds ago       Up 51 seconds                        buildx_buildkit_builder-4df9c1fa-17cc-4ab3-9a2c-92f05113614c1
d8b29094bbba   moby/buildkit:buildx-stable-1   "buildkitd"   54 seconds ago       Up 53 seconds                        buildx_buildkit_builder-8ebb0c16-6dec-482f-a9af-7f0a7d8b553a1
db1ea9283c0e   moby/buildkit:buildx-stable-1   "buildkitd"   54 seconds ago       Up 53 seconds                        buildx_buildkit_builder-b5aa3352-e479-48b8-aa4b-686f72d825a21
fa27dd050702   moby/buildkit:buildx-stable-1   "buildkitd"   56 seconds ago       Up 54 seconds                        buildx_buildkit_builder-44f4deb0-f622-4cb1-b7fa-020b836b4ebb1
b986c9203675   moby/buildkit:buildx-stable-1   "buildkitd"   57 seconds ago       Up 55 seconds                        buildx_buildkit_builder-653afae1-c773-43c6-8db2-a4df5c38a6481
e431884e3c6d   moby/buildkit:buildx-stable-1   "buildkitd"   57 seconds ago       Up 56 seconds                        buildx_buildkit_builder-bbffa967-47c1-4ff9-894e-9543fe5b4d341
b608df9278a0   moby/buildkit:buildx-stable-1   "buildkitd"   59 seconds ago       Up 58 seconds                        buildx_buildkit_builder-22fce95d-2ee0-49d2-92e4-41c9d2e53e111
791e4b7b2c28   moby/buildkit:buildx-stable-1   "buildkitd"   59 seconds ago       Up 58 seconds                        buildx_buildkit_builder-1a16496a-6269-4cb3-8abe-262d0a2c313e1
58f7e131b6a2   moby/buildkit:buildx-stable-1   "buildkitd"   About a minute ago   Up 59 seconds                        buildx_buildkit_builder-54af43f0-1649-4d22-b14f-c94568e3320b1
bf04451b11a8   moby/buildkit:buildx-stable-1   "buildkitd"   About a minute ago   Up About a minute                    buildx_buildkit_builder-b73ee3df-e300-4cfd-8ceb-2c03a697af381
5625b2694a00   moby/buildkit:buildx-stable-1   "buildkitd"   About a minute ago   Up About a minute                    buildx_buildkit_builder-f95f1abd-44fe-4cca-a7ce-bf2dc3fdc87c1
c26119ac3928   moby/buildkit:buildx-stable-1   "buildkitd"   About a minute ago   Up About a minute                    buildx_buildkit_builder-5c9f44f1-d9a1-4d9d-a984-df20dda075661
8a31a13c4d8e   moby/buildkit:buildx-stable-1   "buildkitd"   About a minute ago   Up About a minute                    buildx_buildkit_builder-ad68f1af-7c4c-41e2-b6c4-008dd2096a8e1
cea2840c0c10   moby/buildkit:buildx-stable-1   "buildkitd"   About a minute ago   Up About a minute                    buildx_buildkit_builder-c71061b8-3a30-415a-bd7a-1aa7851f378a1
e4b2f61dce47   moby/buildkit:buildx-stable-1   "buildkitd"   About a minute ago   Up About a minute                    buildx_buildkit_builder-13e80175-360b-4d8b-8b02-eb990aa1aa321
22e5456c382b   moby/buildkit:buildx-stable-1   "buildkitd"   About a minute ago   Up About a minute                    buildx_buildkit_builder-e30b0b84-6349-408a-aa3d-deb49cf748321
d892202766da   moby/buildkit:buildx-stable-1   "buildkitd"   About a minute ago   Up About a minute                    buildx_buildkit_builder-fbb97fbc-ac47-43b7-8456-db2f190d33b11
5868768043c5   moby/buildkit:buildx-stable-1   "buildkitd"   About a minute ago   Up About a minute                    buildx_buildkit_builder-be7b7266-8b8a-488b-9f5a-cee3772f18db1
8906ef80a2cd   moby/buildkit:buildx-stable-1   "buildkitd"   About a minute ago   Up About a minute                    buildx_buildkit_builder-2f577646-5b81-4c15-8d94-83e34bfa29161
386f47c19c96   moby/buildkit:buildx-stable-1   "buildkitd"   About a minute ago   Up About a minute                    buildx_buildkit_builder-34774e78-9bcd-419b-b554-a2640ed62f1e1

As we are building with a matrix, a buildkit container is created for each of them. Performance wise this is not good. Maybe the remote driver would be nice for this. cc @jedevc

@crazy-max
Copy link
Member Author

Ok managed to use the remote driver instead of docker-container one:

NAME/NODE                                       DRIVER/ENDPOINT                                                                  STATUS  BUILDKIT         PLATFORMS
builder-abc433dc-acb9-4ecb-a024-f680e456b0c7    docker-container                                                                                          
  builder-abc433dc-acb9-4ecb-a024-f680e456b0c70 unix:///var/run/docker.sock                                                      running v0.10.4          linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
remote-builder *                                remote                                                                                                    
  remote-builder0                               docker-container://buildx_buildkit_builder-abc433dc-acb9-4ecb-a024-f680e456b0c70 running                  linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
  remote-builder1                               tcp://***:1234                                                          running                  linux/arm64*, linux/arm/v5*, linux/arm/v6*, linux/arm/v7*
default                                         docker                                                                                                    
  default                                       default                                                                          running 20.10.17+azure-3 linux/amd64, linux/386, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/arm/v7, linux/arm/v6

Still hacky atm, will work on adding append support to setup-buildx-action.

@crazy-max crazy-max changed the title Set up remote arm64 builder Set up remote builders Sep 16, 2022
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
@crazy-max
Copy link
Member Author

Added LinuxONE s390x remote builder too (thanks @sam-thibault):

NAME/NODE                                       DRIVER/ENDPOINT                                                                  STATUS  BUILDKIT         PLATFORMS
builder-3a89b7e5-772b-4c6d-96eb-a125b984c294    docker-container                                                                                          
  builder-3a89b7e5-772b-4c6d-96eb-a125b984c2940 unix:///var/run/docker.sock                                                      running v0.10.4          linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
remote-builder *                                remote                                                                                                    
  remote-builder0                               docker-container://buildx_buildkit_builder-3a89b7e5-772b-4c6d-96eb-a125b984c2940 running                  linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
  aws_graviton2                                 tcp://***:1234                                                          running                  darwin/arm64*, linux/arm64*, linux/arm/v5*, linux/arm/v6*, linux/arm/v7*, windows/arm64*
  linuxone_s390x                                tcp://***:1234                                                        running                  linux/s390x*
default                                         docker                                                                                                    
  default                                       default                                                                          running 20.10.17+azure-3 linux/amd64, linux/386, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/arm/v7, linux/arm/v6

Only PowerPC go through QEMU atm.

Comment on lines 1 to 2
name: 'Setup remote builder'
description: 'Composite action to set up BuildKit remote builder'
Copy link

Choose a reason for hiding this comment

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

Should we split this out into a separate action at some point? It seems fairly generic, and could be useful 👀

Copy link
Member Author

@crazy-max crazy-max Sep 16, 2022

Choose a reason for hiding this comment

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

Yes I planned to move that to setup-buildx-action at some point but pure typescript. I'm still thinking of how to handle authentication for the protocols we currently support like ssh:// and tcp://.

@crazy-max
Copy link
Member Author

@jedevc Opened several PRs in setup-buildx repo to add support for appending additional nodes to the builder and also authentication:

Step would look like this:

      -
        name: Set up Docker Buildx
        uses: crazy-max/docker-setup-buildx-action@append
        with:
          driver: remote
          endpoint: docker-container://buildx_buildkit_${{ steps.builder.outputs.name }}0
          append: |
            - name: aws_graviton2
              endpoint: tcp://${{ secrets.AWS_ARM64_HOST }}:1234
              platforms: darwin/arm64,linux/arm64,linux/arm/v5,linux/arm/v6,linux/arm/v7,windows/arm64
            - name: linuxone_s390x
              endpoint: tcp://${{ secrets.LINUXONE_S390X_HOST }}:1234
              platforms: linux/s390x
        env:
          BUILDER_NODE_1_AUTH_TLS_CACERT: ${{ secrets.AWS_ARM64_CACERT }}
          BUILDER_NODE_1_AUTH_TLS_CERT: ${{ secrets.AWS_ARM64_CERT }}
          BUILDER_NODE_1_AUTH_TLS_KEY: ${{ secrets.AWS_ARM64_KEY }}
          BUILDER_NODE_2_AUTH_TLS_CACERT: ${{ secrets.LINUXONE_S390X_CACERT }}
          BUILDER_NODE_2_AUTH_TLS_CERT: ${{ secrets.LINUXONE_S390X_CERT }}
          BUILDER_NODE_2_AUTH_TLS_KEY: ${{ secrets.LINUXONE_S390X_KEY }}

image

@crazy-max crazy-max marked this pull request as ready for review September 23, 2022 13:41
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
@crazy-max crazy-max merged commit 3834b22 into docker:main Sep 23, 2022
@crazy-max crazy-max deleted the remote-builder branch September 23, 2022 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants