chainguard-dev / melange

build APKs from source code
Apache License 2.0
415 stars 96 forks source link

melange build fails with "413 Request Entity Too Large" #964

Open EirikAskheim opened 8 months ago

EirikAskheim commented 8 months ago

Not sure why it is failing with Request Entity Too Large. The application binary size is 7MiB.

ℹ️  x86_64    | pushing build image (336 MB) to [ttl.sh/melange@sha256:1ad1922ac8ff36abe5dd8ffd5cdb301c91c23a2cf985eb7caf79966d7d9a4579](http://ttl.sh/melange@sha256:1ad1922ac8ff36abe5dd8ffd5cdb301c91c23a2cf985eb7caf79966d7d9a4579)
ℹ️  x86_64    | error publishing build image: PATCH [https://ttl.sh/v2/melange/blobs/uploads/8fa98fe0-fa80-405b-a147-721005c1746f?_state=REDACTED:](https://ttl.sh/v2/melange/blobs/uploads/8fa98fe0-fa80-405b-a147-721005c1746f?_state=REDACTED) unexpected status code 413 Request Entity Too Large: <html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
❌  x86_64    | ERROR: failed to build package. the build environment has been preserved:
ℹ️  x86_64    |   workspace dir: /tmp/melange-workspace-2706266495
ℹ️  x86_64    |   guest dir: /tmp/melange-guest-1008454417
ℹ️            | error during command execution: failed to build package: unable to build guest: PATCH [https://ttl.sh/v2/melange/blobs/uploads/8fa98fe0-fa80-405b-a147-721005c1746f?_state=REDACTED:](https://ttl.sh/v2/melange/blobs/uploads/8fa98fe0-fa80-405b-a147-721005c1746f?_state=REDACTED) unexpected status code 413 Request Entity Too Large: <html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>cloudflare</center>
</body>
</html>

melange.yaml

package:
  name: application
  version: 0.2.4
  description: Description here
  target-architecture:
    - all
  copyright:
    - license: Apache-2.0
      paths:
        - "*"

environment:
  contents:
    repositories:
      - https://dl-cdn.alpinelinux.org/alpine/edge/main
      - https://dl-cdn.alpinelinux.org/alpine/edge/community
    packages:
      - alpine-baselayout-data
      - busybox
      - ca-certificates-bundle
      - cargo

pipeline:
  - name: Build Rust application
    runs: |
      TARGETDIR="$(mktemp -d)"
      cargo build --release --target-dir "${TARGETDIR}"
      mkdir -p "${{targets.destdir}}/usr/bin"
      mv "${TARGETDIR}/release/application" "${{targets.destdir}}/usr/bin"

The build runs on Kubernetes using the chainguard melange image.

melange build melange.yaml --runner kubernetes \
                           --arch amd64 \
                           --signing-key melange.rsa \
                           --apk-cache-dir=.apk-cache
vaikas commented 8 months ago

I think this is because the ttl.sh has a size limit. You would have to push to a different registry, maybe like gcr.io? Or since you're running on k8s you can create a local registry.