build-push-action icon indicating copy to clipboard operation
build-push-action copied to clipboard

Build cache stopped working

Open omerh opened this issue 1 year ago • 17 comments

Contributing guidelines

I've found a bug, and:

  • [x] The documentation does not mention anything about my problem
  • [x] There are no open or closed issues that are related to my problem

Description

I was using build cache to S3 bucket

 - name: Build and push
        id: docker-build
        uses: docker/build-push-action@v6
        with:
          context: .
          platforms: linux/arm64
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          build-args: |
            BUILDKIT_INLINE_CACHE=1
          cache-to: |
            type=s3,region=eu-central-1,bucket=buildcache-bucket,prefix=${{ inputs.service_name }}-${{ matrix.environment }}-,mode=inline
          cache-from: |
            type=s3,region=eu-central-1,bucket=buildcache-bucket,prefix=${{ inputs.service_name }}-${{ matrix.environment }}-,mode=max

Without changing anything in the build or permissions using oidc to aws.

I get the following build error on layer export

 buildx failed with: ERROR: failed to build: failed to solve: error writing layer blob: upload multipart failed, upload id: 0CmOeTpIygbSJpgtG_iFzcKcWdeK1sLkI3ZcQe7ZkLmFj8.gAORXLej4RN3d47vSGD.NAFcHng2bd87otXv4rZDdktPL1HLRFvBANOohEZCTt5EzHR7mUqtmFyWo5yuL_o9ihX4o7yY4CmJzsIS8QSyPlzZl93TR1mqwtW4O500-, cause: operation error S3: CompleteMultipartUpload, https response error StatusCode: 400, RequestID: SHX5DBXB7E81W56D, HostID: p1oqbmZtDHuDL4ak8ysVjjtE15mdb2zRP2OXm9snUi5m4movFnOpYp450tiGRrTGZjHANwQOCq6ooe7UJDuk4IwNrOw2B3OC18wHGQCdymM=, api error InvalidPart: One or more of the specified parts could not be found.  The part may not have been uploaded, or the specified entity tag may not match the part's entity tag.

I tried changing inline to max same result error

Expected behaviour

Build cache work export layer correct. Expected logs

#21 exporting cache to Amazon S3
#21 preparing build cache for export
#21 writing layer sha256:29961bb2258c743c04056d982381746046014bb630810fe96328559c85d98619
#21 writing layer sha256:29961bb2258c743c04056d982381746046014bb630810fe96328559c85d98619 0.5s done
#21 preparing build cache for export 0.5s done
#21 DONE 0.5s

Actual behaviour

Errors

buildx failed with: ERROR: failed to build: failed to solve: error writing layer blob: upload multipart failed, upload id: 0CmOeTpIygbSJpgtG_iFzcKcWdeK1sLkI3ZcQe7ZkLmFj8.gAORXLej4RN3d47vSGD.NAFcHng2bd87otXv4rZDdktPL1HLRFvBANOohEZCTt5EzHR7mUqtmFyWo5yuL_o9ihX4o7yY4CmJzsIS8QSyPlzZl93TR1mqwtW4O500-, cause: operation error S3: CompleteMultipartUpload, https response error StatusCode: 400, RequestID: SHX5DBXB7E81W56D, HostID: p1oqbmZtDHuDL4ak8ysVjjtE15mdb2zRP2OXm9snUi5m4movFnOpYp450tiGRrTGZjHANwQOCq6ooe7UJDuk4IwNrOw2B3OC18wHGQCdymM=, api error InvalidPart: One or more of the specified parts could not be found. The part may not have been uploaded, or the specified entity tag may not match the part's entity tag.

Repository URL

No response

Workflow run URL

No response

YAML workflow

- name: Build and push
        id: docker-build
        uses: docker/build-push-action@v6
        with:
          context: .
          platforms: linux/arm64
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          build-args: |
            BUILDKIT_INLINE_CACHE=1
          cache-to: |
            type=s3,region=eu-central-1,bucket=buildcache-bucket,prefix=${{ inputs.service_name }}-${{ matrix.environment }}-,mode=inline
          cache-from: |
            type=s3,region=eu-central-1,bucket=buildcache-bucket,prefix=${{ inputs.service_name }}-${{ matrix.environment }}-,mode=max

Workflow logs

No response

BuildKit logs

Run docker/setup-buildx-action@v3
Docker info
Buildx version
Inspecting default docker context
Creating a new builder instance
Booting builder
Inspect builder
BuildKit version
  builder-f734ec54-95b6-4b56-a6cb-08700025305f0: v0.25.1

Additional info

No response

omerh avatar Nov 19 '25 19:11 omerh

We are also experiencing this, and have no clue yet why.

maxammann avatar Nov 19 '25 20:11 maxammann

Related: https://github.com/moby/buildkit/issues/6357

AlexaDeWit avatar Nov 19 '25 20:11 AlexaDeWit

+1 we are also experiencing this issue

Shahbaz-mahmood123 avatar Nov 19 '25 20:11 Shahbaz-mahmood123

+1

jpenagg avatar Nov 19 '25 20:11 jpenagg

I'm able workaround by pinging the buildkit version like this:

runs:
  steps:
    ...

    - name: Set up Docker Buildx
      id: buildx
      uses: docker/setup-buildx-action@v3
      with:
        driver-opts: image=moby/buildkit:v0.25.1
  
    - name: Build python image
      uses: docker/build-push-action@v5
      with:
        builder: ${{ steps.buildx.outputs.name }}
        ...

xinyang-zhu avatar Nov 19 '25 20:11 xinyang-zhu

Same here. We've temporarily disabled cache to unblock builds, but that isn't a long-term solution.

Same here.

Marlonzao avatar Nov 19 '25 23:11 Marlonzao

+1

gwolves avatar Nov 20 '25 02:11 gwolves

+1 We have same issue that just happening today. It was never an issue before. We are using version 0.22.0. After getting this S3 cache error, we tried to upgrade to latest version 0.30.1, but still face the same issue. I have no idea what trigger this issue. It was working all this while without upgrading our buildx or docker client.

We have 2 workaround for temporary solution, is either we disable cache to s3 or we switch to registry cache. We went for the 2nd option for now using registry cache type instead of s3. But we are very interested to know what cause this issue. Is there any changes in AWS S3 protocol ?

error writing layer blob: upload multipart failed, upload id:.QH8IUUGaFShEXzhDWPeOJVqH2OBQMZRhQg--, cause: operation error S3: CompleteMultipartUpload, https response error StatusCode: 400, RequestID: FY4PW3A8H550BCT0, HostID: xxxxxxxxxx5uJI=, api error InvalidPart: One or more of the specified parts could not be found.  The part may not have been uploaded, or the specified entity tag may not match the part's entity tag.

jlimai avatar Nov 20 '25 04:11 jlimai

Can someone try with this BuildKit image crazymax/buildkit:s3patch and report back to us? Thx

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
        with:
          driver-opts: image=crazymax/buildkit:s3patch

See https://github.com/moby/buildkit/pull/6373 for more info

crazy-max avatar Nov 20 '25 10:11 crazy-max

I can confirm this fixes it for us!

maxammann avatar Nov 20 '25 10:11 maxammann

Why this is closed? I still have the issues without the custom driver.

mihstaub avatar Nov 20 '25 11:11 mihstaub

Why this is closed? I still have the issues without the custom driver.

That's because the linked PR got merged on BuildKit repo. We are doing a BuildKit patch release today.

crazy-max avatar Nov 20 '25 11:11 crazy-max

Thank you. Do we have the eta for the release?

mihstaub avatar Nov 20 '25 12:11 mihstaub

Seems that it was cherry picked https://github.com/moby/buildkit/pull/6373 to v0.26.2

omerh avatar Nov 20 '25 16:11 omerh

can we remove driver-opts: image=moby/buildkit:v0.25.1 now ?

omerh avatar Nov 24 '25 10:11 omerh

can we remove driver-opts: image=moby/buildkit:v0.25.1 now ?

Yes, stable image has been updated to v0.26.2

crazy-max avatar Nov 24 '25 10:11 crazy-max