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

kubernetes driver fails to configure multi-node setup due to missing node option #215

Closed
DavidS-ovm opened this issue Mar 7, 2023 · 22 comments · Fixed by #219
Closed

kubernetes driver fails to configure multi-node setup due to missing node option #215

DavidS-ovm opened this issue Mar 7, 2023 · 22 comments · Fixed by #219

Comments

@DavidS-ovm
Copy link

DavidS-ovm commented Mar 7, 2023

Behaviour

Steps to reproduce this issue

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
        with:
          driver: kubernetes
          platforms: linux/amd64
          driver-opts: |
            "namespace=buildkit"
            "nodeselector=""kubernetes.io/arch=amd64"""
          append: |
            - platforms: linux/arm64
              driver-opts:
                - '"namespace=buildkit"'
                - '"nodeselector=""kubernetes.io/arch=arm64"""'

Expected behaviour

Create a working builder with an arm64 and an amd64 node

Actual behaviour

Creating a new builder instance
  /usr/bin/docker buildx create --name builder-ec5ab75e-cc9a-4e71-b560-72962afcfd54 --driver kubernetes --driver-opt "namespace=buildkit" --driver-opt "nodeselector=""kubernetes.io/arch=arm64""" --buildkitd-flags --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host --platform linux/amd64 --use
  builder-ec5ab75e-cc9a-4e71-b560-72962afcfd54
Appending node(s) to builder
  /usr/bin/docker buildx create --name builder-ec5ab75e-cc9a-4e71-b560-72962afcfd54 --append --driver-opt "namespace=buildkit" --driver-opt "nodeselector=""kubernetes.io/arch=arm64""" --platform linux/arm64
  ERROR: invalid duplicate endpoint kubernetes:///builder-ec5ab75e-cc9a-4e71-b560-72962afcfd54?deployment=&kubeconfig=

Workaround

this seems to be working:

      - name: Set up Docker Buildx
        id: setup-builder
        run: |
          UUID=$(uuidgen)
          BUILDER=$(docker buildx create --name builder-${UUID} --node builder-amd64-${UUID} --driver kubernetes --driver-opt "namespace=buildkit" --driver-opt "nodeselector=""kubernetes.io/arch=amd64""" --platform linux/amd64 --use)
          docker buildx create --name builder-${UUID} --node builder-arm64-${UUID} --append --driver-opt "namespace=buildkit" --driver-opt "nodeselector=""kubernetes.io/arch=arm64""" --platform linux/arm64
          docker buildx inspect
          echo "name=${BUILDER}" >> $GITHUB_OUTPUT

      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v4
        with:
          images: ghcr.io/.../...
          tags: |
            type=ref,event=branch
            type=ref,event=pr
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}

      - name: Login to GitHub Container Registry
        uses: docker/login-action@v2
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Build and push
        id: push
        uses: docker/build-push-action@v4
        with:
          builder: ${{ steps.setup-builder.outputs.name }}
          context: .
          cache-from: type=gha
          cache-to: type=gha,mode=max
          file: build/package/Dockerfile
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          platforms: linux/amd64,linux/arm64

      - name: Clean up Docker Buildx
        if: ${{ always() }}
        run: |
          docker buildx rm ${{ steps.setup-builder.outputs.name }}
@crazy-max
Copy link
Member

crazy-max commented Mar 10, 2023

I think the following should work:

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
        with:
          driver: kubernetes
          platforms: linux/amd64
          driver-opts: |
            namespace=buildkit
            nodeselector=kubernetes.io/arch=amd64
          append: |
            - platforms: linux/arm64
              driver-opts:
                - namespace=buildkit
                - nodeselector=kubernetes.io/arch=arm64

I will open a PR to set up k3s in our ci to see how it goes.

@DavidS-ovm
Copy link
Author

without --node on the docker buildx create command, it won't.

@crazy-max
Copy link
Member

crazy-max commented Mar 10, 2023

without --node on the docker buildx create command, it won't.

--node is not required and just decorative to set the name of the node. If --node is not set it takes the name of the builder and appends the index of the new node to it. See: https://github.com/docker/setup-buildx-action/actions/runs/4383408980/jobs/7673621134#step:4:117

Creating a new builder instance
  /usr/bin/docker buildx create --name builder-c914f57b-bb09-40ec-9887-0b2e371f89e7 --driver docker-container --buildkitd-flags --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host --use
  builder-c914f57b-bb09-40ec-9887-0b2e371f89e7
Appending node(s) to builder
  /usr/bin/docker buildx create --name builder-c914f57b-bb09-40ec-9887-0b2e371f89e7 --append --node builder2 --driver-opt image=moby/buildkit:master --driver-opt network=host --platform linux/amd64 ctxbuilder2
  builder-c914f57b-bb09-40ec-9887-0b2e371f89e7
  /usr/bin/docker buildx create --name builder-c914f57b-bb09-40ec-9887-0b2e371f89e7 --append --platform linux/arm64 ctxbuilder3
  builder-c914f57b-bb09-40ec-9887-0b2e371f89e7

Inspecting this builder:

  {
    "nodes": [
      {
        "name": "builder-c914f57b-bb09-40ec-9887-0b2e371f89e70",
        "endpoint": "unix:///var/run/docker.sock",
        "status": "running",
        "buildkitd-flags": "--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host",
        "buildkit": "v0.11.4",
        "platforms": "linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/amd64/v4,linux/386"
      },
      {
        "name": "builder2",
        "endpoint": "ctxbuilder2",
        "driver-opts": [
          "image=moby/buildkit:master",
          "network=host"
        ],
        "status": "running",
        "buildkit": "252e5a6",
        "platforms": "linux/amd64"
      },
      {
        "name": "builder-c914f57b-bb09-40ec-9887-0b2e371f89e71",
        "endpoint": "ctxbuilder3",
        "status": "running",
        "buildkit": "v0.11.4",
        "platforms": "linux/arm64"
      }
    ],
    "name": "builder-c914f57b-bb09-40ec-9887-0b2e371f89e7",
    "driver": "docker-container",
    "lastActivity": "2023-03-10T10:04:38.000Z"
  }

Can you show the full logs of the Set up Docker Buildx step please?

@DavidS-ovm
Copy link
Author

Thanks for looking into this. I could repro this with one of our public repos. Please see https://github.com/overmindtech/aws-source/actions/runs/4385572203/jobs/7678475151#step:7:128 (raw log

2023-03-10T14:41:20.8601797Z ##[group]Run docker/setup-buildx-action@v2
2023-03-10T14:41:20.8602066Z with:
2023-03-10T14:41:20.8602271Z   driver: kubernetes
2023-03-10T14:41:20.8602502Z   platforms: linux/amd64
2023-03-10T14:41:20.8602823Z   driver-opts: namespace=buildkit
nodeselector=kubernetes.io/arch=amd64

2023-03-10T14:41:20.8603267Z   append: - platforms: linux/arm64
  driver-opts:
    - namespace=buildkit
    - nodeselector=kubernetes.io/arch=arm64

2023-03-10T14:41:20.8603772Z   buildkitd-flags: --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host
2023-03-10T14:41:20.8604135Z   install: false
2023-03-10T14:41:20.8604335Z   use: true
2023-03-10T14:41:20.8604529Z   cleanup: true
2023-03-10T14:41:20.8604835Z env:
2023-03-10T14:41:20.8605044Z   AWS_DEFAULT_REGION: eu-west-2
2023-03-10T14:41:20.8605283Z   AWS_REGION: eu-west-2
2023-03-10T14:41:20.8605594Z   AWS_ACCESS_KEY_ID: ***
2023-03-10T14:41:20.8605928Z   AWS_SECRET_ACCESS_KEY: ***
2023-03-10T14:41:20.8609033Z   AWS_SESSION_TOKEN: ***
2023-03-10T14:41:20.8609303Z   DOCKER_METADATA_OUTPUT_VERSION: pr-131
2023-03-10T14:41:20.8609642Z   DOCKER_METADATA_OUTPUT_TAGS: ghcr.io/overmindtech/aws-source:pr-131
2023-03-10T14:41:20.8610681Z   DOCKER_METADATA_OUTPUT_LABELS: org.opencontainers.image.title=aws-source
org.opencontainers.image.description=Overmind source for AWS resources
org.opencontainers.image.url=https://github.com/overmindtech/aws-source
org.opencontainers.image.source=https://github.com/overmindtech/aws-source
org.opencontainers.image.version=pr-131
org.opencontainers.image.created=2023-03-10T14:41:20.190Z
org.opencontainers.image.revision=1c7f33fdeddf45ca48bbfa89f155f550f5295a32
org.opencontainers.image.licenses=Apache-2.0
2023-03-10T14:41:20.8612411Z   DOCKER_METADATA_OUTPUT_JSON: {"tags":["ghcr.io/overmindtech/aws-source:pr-131"],"labels":{"org.opencontainers.image.title":"aws-source","org.opencontainers.image.description":"Overmind source for AWS resources","org.opencontainers.image.url":"https://github.com/overmindtech/aws-source","org.opencontainers.image.source":"https://github.com/overmindtech/aws-source","org.opencontainers.image.version":"pr-131","org.opencontainers.image.created":"2023-03-10T14:41:20.190Z","org.opencontainers.image.revision":"1c7f33fdeddf45ca48bbfa89f155f550f5295a32","org.opencontainers.image.licenses":"Apache-2.0"}}
2023-03-10T14:41:20.8613556Z   DOCKER_METADATA_OUTPUT_BAKE_FILE: /tmp/docker-metadata-action-IzOowK/docker-metadata-action-bake.json
2023-03-10T14:41:20.8613910Z ##[endgroup]
2023-03-10T14:41:20.9906755Z ##[group]Docker info
2023-03-10T14:41:20.9945992Z [command]/usr/bin/docker version
2023-03-10T14:41:21.0257718Z Client:
2023-03-10T14:41:21.0263348Z  Version:           20.10.23+azure-2
2023-03-10T14:41:21.0264218Z  API version:       1.41
2023-03-10T14:41:21.0264626Z  Go version:        go1.19.6
2023-03-10T14:41:21.0265521Z  Git commit:        715524332ff91d0f9ec5ab2ec95f051456ed1dba
2023-03-10T14:41:21.0265978Z  Built:             Wed Jan 18 20:42:16 UTC 2023
2023-03-10T14:41:21.0266695Z  OS/Arch:           linux/amd64
2023-03-10T14:41:21.0267076Z  Context:           default
2023-03-10T14:41:21.0267758Z  Experimental:      true
2023-03-10T14:41:21.0268047Z 
2023-03-10T14:41:21.0268557Z Server:
2023-03-10T14:41:21.0268882Z  Engine:
2023-03-10T14:41:21.0269591Z   Version:          20.10.23+azure-2
2023-03-10T14:41:21.0270015Z   API version:      1.41 (minimum version 1.12)
2023-03-10T14:41:21.0270708Z   Go version:       go1.19.6
2023-03-10T14:41:21.0271134Z   Git commit:       6051f142912a5c06064e96b92de5e4e8f052131b
2023-03-10T14:41:21.0271859Z   Built:            Wed Jan 18 16:24:28 2023
2023-03-10T14:41:21.0272259Z   OS/Arch:          linux/amd64
2023-03-10T14:41:21.0272956Z   Experimental:     false
2023-03-10T14:41:21.0273336Z  containerd:
2023-03-10T14:41:21.0274035Z   Version:          1.6.19+azure-1
2023-03-10T14:41:21.0274469Z   GitCommit:        1e1ea6e986c6c86565bc33d52e34b81b3e2bc71f
2023-03-10T14:41:21.0275153Z  runc:
2023-03-10T14:41:21.0275764Z   Version:          1.1.4
2023-03-10T14:41:21.0276511Z   GitCommit:        5fd4c4d144137e991c4acebb2146ab1483a97925
2023-03-10T14:41:21.0276967Z  docker-init:
2023-03-10T14:41:21.0277618Z   Version:          0.19.0
2023-03-10T14:41:21.0277987Z   GitCommit:        
2023-03-10T14:41:21.0335279Z [command]/usr/bin/docker info
2023-03-10T14:41:21.2546592Z Client:
2023-03-10T14:41:21.2549561Z  Context:    default
2023-03-10T14:41:21.2550304Z  Debug Mode: false
2023-03-10T14:41:21.2550686Z  Plugins:
2023-03-10T14:41:21.2551530Z   buildx: Docker Buildx (Docker Inc., 0.10.3+azure-1)
2023-03-10T14:41:21.2552085Z   compose: Docker Compose (Docker Inc., 2.16.0+azure-2)
2023-03-10T14:41:21.2552622Z 
2023-03-10T14:41:21.2552851Z Server:
2023-03-10T14:41:21.2553412Z  Containers: 0
2023-03-10T14:41:21.2553947Z   Running: 0
2023-03-10T14:41:21.2554513Z   Paused: 0
2023-03-10T14:41:21.2554867Z   Stopped: 0
2023-03-10T14:41:21.2555415Z  Images: 17
2023-03-10T14:41:21.2555830Z  Server Version: 20.10.23+azure-2
2023-03-10T14:41:21.2556446Z  Storage Driver: overlay2
2023-03-10T14:41:21.2556849Z   Backing Filesystem: extfs
2023-03-10T14:41:21.2557444Z   Supports d_type: true
2023-03-10T14:41:21.2557838Z   Native Overlay Diff: false
2023-03-10T14:41:21.2558424Z   userxattr: false
2023-03-10T14:41:21.2558854Z  Logging Driver: json-file
2023-03-10T14:41:21.2559462Z  Cgroup Driver: cgroupfs
2023-03-10T14:41:21.2559843Z  Cgroup Version: 2
2023-03-10T14:41:21.2560399Z  Plugins:
2023-03-10T14:41:21.2560754Z   Volume: local
2023-03-10T14:41:21.2561430Z   Network: bridge host ipvlan macvlan null overlay
2023-03-10T14:41:21.2562044Z   Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
2023-03-10T14:41:21.2562717Z  Swarm: inactive
2023-03-10T14:41:21.2563223Z  Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
2023-03-10T14:41:21.2563900Z  Default Runtime: runc
2023-03-10T14:41:21.2564329Z  Init Binary: docker-init
2023-03-10T14:41:21.2564983Z  containerd version: 1e1ea6e986c6c86565bc33d52e34b81b3e2bc71f
2023-03-10T14:41:21.2565474Z  runc version: 5fd4c4d144137e991c4acebb2146ab1483a97925
2023-03-10T14:41:21.2566089Z  init version: 
2023-03-10T14:41:21.2566455Z  Security Options:
2023-03-10T14:41:21.2567025Z   apparmor
2023-03-10T14:41:21.2567370Z   seccomp
2023-03-10T14:41:21.2567920Z    Profile: default
2023-03-10T14:41:21.2568910Z   cgroupns
2023-03-10T14:41:21.2569714Z  Kernel Version: 5.15.0-1034-azure
2023-03-10T14:41:21.2570664Z  Operating System: Ubuntu 22.04.2 LTS
2023-03-10T14:41:21.2572027Z  OSType: linux
2023-03-10T14:41:21.2572603Z  Architecture: x86_64
2023-03-10T14:41:21.2573502Z  CPUs: 2
2023-03-10T14:41:21.2573996Z  Total Memory: 6.781GiB
2023-03-10T14:41:21.2575109Z  Name: fv-az450-571
2023-03-10T14:41:21.2575759Z  ID: OYFA:TVUO:SUD2:K2LB:K4QE:UXLH:YMUH:YNPY:YTTK:HHBL:PLV3:2L4T
2023-03-10T14:41:21.2577055Z  Docker Root Dir: /var/lib/docker
2023-03-10T14:41:21.2577903Z  Debug Mode: false
2023-03-10T14:41:21.2578475Z  Username: githubactions
2023-03-10T14:41:21.2579275Z  Registry: https://index.docker.io/v1/
2023-03-10T14:41:21.2579674Z  Labels:
2023-03-10T14:41:21.2580366Z  Experimental: false
2023-03-10T14:41:21.2580749Z  Insecure Registries:
2023-03-10T14:41:21.2581472Z   127.0.0.0/8
2023-03-10T14:41:21.2581837Z  Live Restore Enabled: false
2023-03-10T14:41:21.2582467Z 
2023-03-10T14:41:21.2582974Z ##[endgroup]
2023-03-10T14:41:21.3347842Z ##[group]Buildx version
2023-03-10T14:41:21.3364898Z [command]/usr/bin/docker buildx version
2023-03-10T14:41:21.3945087Z github.com/docker/buildx 0.10.3+azure-1 79e156beb11f697f06ac67fa1fb958e4762c0fab
2023-03-10T14:41:21.3971744Z ##[endgroup]
2023-03-10T14:41:21.3982456Z ##[group]Creating a new builder instance
2023-03-10T14:41:21.4753795Z [command]/usr/bin/docker buildx create --name builder-fa3ebe16-90b9-4a55-a1d9-c28963af20fa --driver kubernetes --driver-opt namespace=buildkit --driver-opt nodeselector=kubernetes.io/arch=amd64 --buildkitd-flags --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host --platform linux/amd64 --use
2023-03-10T14:41:22.9282964Z builder-fa3ebe16-90b9-4a55-a1d9-c28963af20fa
2023-03-10T14:41:22.9346407Z ##[endgroup]
2023-03-10T14:41:22.9347260Z ##[group]Appending node(s) to builder
2023-03-10T14:41:22.9364373Z [command]/usr/bin/docker buildx create --name builder-fa3ebe16-90b9-4a55-a1d9-c28963af20fa --append --driver-opt namespace=buildkit --driver-opt nodeselector=kubernetes.io/arch=arm64 --platform linux/arm64
2023-03-10T14:41:23.0116888Z ERROR: invalid duplicate endpoint kubernetes:///builder-fa3ebe16-90b9-4a55-a1d9-c28963af20fa?deployment=&kubeconfig=
2023-03-10T14:41:23.0146786Z ##[endgroup]
2023-03-10T14:41:23.0179174Z ##[error]The process '/usr/bin/docker' failed with exit code 1
2023-03-10T14:41:23.0241952Z Post job cleanup.
2023-03-10T14:41:23.1397144Z ##[group]Removing builder
2023-03-10T14:41:24.3553416Z [command]/usr/bin/docker buildx rm builder-fa3ebe16-90b9-4a55-a1d9-c28963af20fa
2023-03-10T14:41:25.5358145Z builder-fa3ebe16-90b9-4a55-a1d9-c28963af20fa removed
2023-03-10T14:41:25.5391960Z ##[endgroup]

@DavidS-ovm
Copy link
Author

DavidS-ovm commented Mar 10, 2023

I see in ci.yml that it is defining both builds in append, while I've been trying to do one at the top-level and one in append. I'll give this a try.

@DavidS-ovm
Copy link
Author

Indeed with both builders in append, and a name supplied this works now: overmindtech/aws-source@b44996a

@crazy-max
Copy link
Member

Looking at our docs https://docs.docker.com/build/drivers/kubernetes/#native it seems you effectively need to define --node for native builds.

Also it seems namespace and nodeselector should be part of the same driver-opt as shown in the docs too:

$  docker buildx create \
  --append \
  --bootstrap \
  --name=kube \
  --driver=kubernetes \
  --platform=linux/arm64 \
  --node=builder-arm64 \
  --driver-opt=namespace=buildkit,nodeselector="kubernetes.io/arch=arm64"

Can you try with:

      - name: Set up Docker Buildx
        id: setup-builder
        uses: docker/setup-buildx-action@v2
        with:
          driver: kubernetes
          platforms: linux/amd64
          driver-opts: |
            namespace=buildkit,nodeselector="kubernetes.io/arch=amd64"
          append: |
            - name: arm64
              platforms: linux/arm64
              driver-opts:
                - namespace=buildkit,nodeselector="kubernetes.io/arch=arm64"

@crazy-max
Copy link
Member

Indeed with both builders in append, and a name supplied this works now: overmindtech/aws-source@b44996a

Does not seem to work properly: https://github.com/overmindtech/aws-source/actions/runs/4385745527

image

Hence my previous comment about having a single driver-opt otherwise the namespace is wrong.

DavidS-ovm added a commit to overmindtech/aws-source that referenced this issue Mar 10, 2023
@DavidS-ovm
Copy link
Author

@crazy-max
Copy link
Member

nice! https://github.com/overmindtech/aws-source/actions/runs/4385908114/jobs/7679252628 built and cleaned up

Yes looks good!

  {
    "nodes": [
      {
        "name": "builder-a02cb880-5b61-445e-a2ae-98d6f3e2283f0",
        "endpoint": "kubernetes:///builder-a02cb880-5b61-445e-a2ae-98d6f3e2283f?deployment=&kubeconfig=",
        "driver-opts": [
          "namespace=buildkit",
          "nodeselector=kubernetes.io/arch=amd64"
        ],
        "status": "running",
        "buildkitd-flags": "--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host",
        "buildkit": "v0.11.4",
        "platforms": "linux/amd64"
      },
      {
        "name": "arm64",
        "endpoint": "kubernetes:///builder-a02cb880-5b61-445e-a2ae-98d6f3e2283f?deployment=arm64&kubeconfig=",
        "driver-opts": [
          "namespace=buildkit",
          "nodeselector=kubernetes.io/arch=arm64"
        ],
        "status": "running",
        "buildkit": "v0.11.4",
        "platforms": "linux/arm64"
      }
    ],
    "name": "builder-a02cb880-5b61-445e-a2ae-98d6f3e2283f",
    "driver": "kubernetes",
    "lastActivity": "2023-03-10T15:20:44.000Z"
  }

@DavidS-ovm
Copy link
Author

whoops, had the name still on the arm builder. Retrying without it to avoid name-clashes on the deployments in k8s on concurrent builds

@DavidS-ovm
Copy link
Author

yeah, https://github.com/overmindtech/aws-source/actions/runs/4385935559/jobs/7679313927 failed with the same ERROR: invalid duplicate endpoint kubernetes:///builder-d9f08fac-27a7-4994-a393-3b491c18ec55?deployment=&kubeconfig=

At least now I have a working config - I can specify the name from somewhere unique, like adding github.run_attempt

@crazy-max
Copy link
Member

I can specify the name from somewhere unique, like adding github.run_attempt

You could use github.run_id from github context:

      - name: Set up Docker Buildx
        id: setup-builder
        uses: docker/setup-buildx-action@v2
        with:
          driver: kubernetes
          platforms: linux/amd64
          driver-opts: |
            namespace=buildkit,nodeselector="kubernetes.io/arch=amd64"
          append: |
            - name: run-${{ github.run_id }}-arm64
              platforms: linux/arm64
              driver-opts:
                - namespace=buildkit,nodeselector="kubernetes.io/arch=arm64"

I wonder if we should do this automatically with the action when the kubernetes driver is being used. WDYT?

@DavidS-ovm
Copy link
Author

DavidS-ovm commented Mar 10, 2023

Reading through the docs, I think this would need both to avoid any clashes with concurrent runs (although I don't know if multiple attempts of the same run can run concurrently):

run_id: This number does not change if you re-run the workflow run.
run_attempt: This number begins at 1 for the workflow run's first attempt, and increments with each re-run.

so this works for me: commit, run.

It still also needs to consider the job and a few other things that could clash. really, it would be nice if the action could just chuck in a UUID and not have me think about these things :-D

@DavidS-ovm
Copy link
Author

e.g. using run-${{ github.run_id }}-${{ github.run_attempt }}-arm64 might also clash between actions on different repos, when using a shared k8s cluster in the backend (which I do), when they accidentally have the same run number at the same time.

@crazy-max
Copy link
Member

crazy-max commented Mar 10, 2023

It still also needs to consider the job and a few other things that could clash. really, it would be nice if the action could just chuck in a UUID and not have me think about these things :-D

Yeah we could do the same thing as:

return driver == 'docker' ? await Docker.context() : `builder-${uuid.v4()}`;

@crazy-max
Copy link
Member

What I found strange is the generated node name should not collide with anything.

For example in our ci workflow:

-
name: Set up Docker Buildx
id: buildx
uses: ./
with:
append: |
- name: builder2
endpoint: ctxbuilder2
platforms: linux/amd64
driver-opts:
- image=moby/buildkit:master
- network=host
- endpoint: ctxbuilder3
platforms: linux/arm64

For this run

builder name is builder-c914f57b-bb09-40ec-9887-0b2e371f89e7.

  • first node name (auto): builder-c914f57b-bb09-40ec-9887-0b2e371f89e70
  • second node name (manually set): builder2
  • third node name (auto): builder-c914f57b-bb09-40ec-9887-0b2e371f89e71

So for me it should be fine is you don't define any name for the nodes as it takes the generated builder name and append the node position (0 for first one and 1 for third node).

@DavidS-ovm
Copy link
Author

those are on two different endpoints

@crazy-max
Copy link
Member

those are on two different endpoints

Ah good point that might be it. I will add a new job in our ci to check this out.

@crazy-max
Copy link
Member

@DavidS-om #219 should fix this issue. See https://github.com/docker/setup-buildx-action/actions/runs/4387426773/jobs/7682713422#step:4:171

You can test with uses: crazy-max/docker-setup-buildx-action@ci-k3s-append.

@DavidS-ovm
Copy link
Author

ran just fine with the random names: commit, run

thanks so much for your time and work!

@crazy-max
Copy link
Member

Awesome. I will open a follow-up to fix this issue upstream on buildx repo.

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 a pull request may close this issue.

2 participants