Skip to content

Regression: Using --set *.cache.to= #3020

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

Closed
2 of 3 tasks
npetzall opened this issue Feb 22, 2025 · 1 comment · Fixed by #3021
Closed
2 of 3 tasks

Regression: Using --set *.cache.to= #3020

npetzall opened this issue Feb 22, 2025 · 1 comment · Fixed by #3021
Assignees
Labels
area/bake kind/bug Something isn't working

Comments

@npetzall
Copy link

npetzall commented Feb 22, 2025

Contributing guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

Initially discovered the issue using v0.20.1.
Reverted to v0.19.3 and it worked.

Found following closed issue for v0.19 branch
#2858

I've attempted to switch to object format of cache to see if that solved the problem. We've been using the CSV variant prio to this.

We have tried with both --set *.cache.to= and --set *.cache.to=""

Expected behaviour

Expectation is not to receive the EOF and that the cache-to configuration has been set to empty/null so that there is no push to the cache.

Actual behaviour

  /usr/bin/docker buildx bake --file docker-bake.hcl --set *.cache-to="" --print pr
  [internal] load local bake definitions
  reading docker-bake.hcl 1.78kB / 1.78kB done
  DONE 0.0s
  ERROR: EOF
Error: cannot parse bake definitions: ERROR: EOF

Buildx version

github.com/docker/buildx v0.21.1 7c2359c

Docker info

/usr/bin/docker version
  Client: Docker Engine - Community
   Version:           26.1.3
   API version:       1.45
   Go version:        go1.21.10
   Git commit:        b72abbb
   Built:             Thu May 16 08:33:35 2024
   OS/Arch:           linux/amd64
   Context:           default
  
  Server: Docker Engine - Community
   Engine:
    Version:          26.1.3
    API version:      1.45 (minimum version 1.24)
    Go version:       go1.21.10
    Git commit:       8e96db1
    Built:            Thu May 16 08:33:35 2024
    OS/Arch:          linux/amd64
    Experimental:     false
   containerd:
    Version:          1.7.25
    GitCommit:        bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
   runc:
    Version:          1.2.4
    GitCommit:        v1.2.4-0-g6c52b3f
   docker-init:
    Version:          0.19.0
    GitCommit:        de40ad0
  /usr/bin/docker info
  Client: Docker Engine - Community
   Version:    26.1.3
   Context:    default
   Debug Mode: false
   Plugins:
    buildx: Docker Buildx (Docker Inc.)
      Version:  v0.21.1
      Path:     /home/runner/.docker/cli-plugins/docker-buildx
    compose: Docker Compose (Docker Inc.)
      Version:  v2.27.1
      Path:     /usr/libexec/docker/cli-plugins/docker-compose
  
  Server:
   Containers: 1
    Running: 1
    Paused: 0
    Stopped: 0
   Images: 9
   Server Version: 26.1.3
   Storage Driver: overlay2
    Backing Filesystem: extfs
    Supports d_type: true
    Using metacopy: false
    Native Overlay Diff: false
    userxattr: false
   Logging Driver: json-file
   Cgroup Driver: systemd
   Cgroup Version: 2
   Plugins:
    Volume: local
    Network: bridge host ipvlan macvlan null overlay
    Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
   Swarm: inactive
   Runtimes: runc io.containerd.runc.v2
   Default Runtime: runc
   Init Binary: docker-init
   containerd version: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
   runc version: v1.2.4-0-g6c52b3f
   init version: de40ad0
   Security Options:
    apparmor
    seccomp
     Profile: builtin
    cgroupns
   Kernel Version: 6.8.0-1021-azure
   Operating System: Ubuntu 24.04.1 LTS
   OSType: linux
   Architecture: x86_64
   CPUs: 4
   Total Memory: 15.62GiB
   Name: fv-az1278-967
   ID: c134ce27-11c9-4288-a10a-13dadbadd510
   Docker Root Dir: /var/lib/docker
   Debug Mode: false
   Username: githubactions
   Experimental: false
   Insecure Registries:
    127.0.0.0/8
   Live Restore Enabled: false

Builders list

{
    "nodes": [
      {
        "name": "builder-55948288-4447-4ba1-b058-5ff0a0a24c900",
        "endpoint": "unix:///var/run/docker.sock",
        "status": "running",
        "buildkitd-flags": "--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host",
        "buildkit": "v0.20.0",
        "platforms": "linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/loong64,linux/arm/v7,linux/arm/v6",
        "features": {
          "Automatically load images to the Docker Engine image store": true,
          "Cache export": true,
          "Docker exporter": true,
          "Multi-platform build": true,
          "OCI exporter": true
        },
        "labels": {
          "org.mobyproject.buildkit.worker.executor": "oci",
          "org.mobyproject.buildkit.worker.hostname": "69f282376999",
          "org.mobyproject.buildkit.worker.network": "host",
          "org.mobyproject.buildkit.worker.oci.process-mode": "sandbox",
          "org.mobyproject.buildkit.worker.selinux.enabled": "false",
          "org.mobyproject.buildkit.worker.snapshotter": "overlayfs"
        },
        "gcPolicy": [
          {
            "all": false,
            "filter": [
              "type==source.local",
              "type==exec.cachemount",
              "type==source.git.checkout"
            ],
            "keepDuration": "48h0m0s"
          },
          {
            "all": false,
            "keepDuration": "1440h0m0s"
          },
          {
            "all": false
          },
          {
            "all": true
          }
        ]
      }
    ],
    "name": "builder-55948288-4447-4ba1-b058-5ff0a0a24c90",
    "driver": "docker-container",
    "lastActivity": "2025-02-22T18:59:44.000Z"
  }

Configuration

FROM curlimages/curl:8.2.1 AS drivers

ENV MYSQL_VERSION=8.0.28
ENV MARIADB_VERSION=1.1.10
ENV POSTGRESQL_VERSION=42.3.8
ENV JTDS_VERSION=1.3.1

RUN mkdir -p /tmp/drivers_inc
WORKDIR /tmp/drivers_inc

RUN curl -L "https://search.maven.org/remotecontent?filepath=mysql/mysql-connector-java/${MYSQL_VERSION}/mysql-connector-java-${MYSQL_VERSION}.jar" \
          -o "mysql-connector-java-${MYSQL_VERSION}.jar" && \
    curl -L "https://search.maven.org/remotecontent?filepath=org/mariadb/jdbc/mariadb-java-client/${MARIADB_VERSION}/mariadb-java-client-${MARIADB_VERSION}.jar" \
          -o "mariadb-java-client-${MARIADB_VERSION}.jar" && \
    curl -L "https://search.maven.org/remotecontent?filepath=org/postgresql/postgresql/${POSTGRESQL_VERSION}/postgresql-${POSTGRESQL_VERSION}.jar" \
          -o "postgresql-${POSTGRESQL_VERSION}.jar" && \
    curl -L "https://search.maven.org/remotecontent?filepath=net/sourceforge/jtds/jtds/${JTDS_VERSION}/jtds-${JTDS_VERSION}.jar" \
          -o "jtds-${JTDS_VERSION}.jar"

FROM eclipse-temurin:17.0.9_9-jre-jammy AS base

ADD docker/open-sans.tar.gz /usr/share/fonts

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
    apt-get install -y graphviz -o APT::Install-Suggests=0 -o APT::Install-Recommends=0 && \
    apt-get clean && \
    useradd -ms /bin/bash java && \
    mkdir /output && \
    chown -R java /output

USER java

FROM base
COPY --from=drivers /tmp/drivers_inc /drivers_inc
ADD target/schema*-app.jar /usr/local/lib/schemaspy/schemaspy-app.jar
ADD docker/schemaspy.sh /usr/local/bin/schemaspy

WORKDIR /

ENV SCHEMASPY_DRIVERS=/drivers
ENV SCHEMASPY_OUTPUT=/output

ENTRYPOINT ["/usr/local/bin/schemaspy"]
variable "VERSION" {
  default = "local"
}

variable "REGISTRY" {
  default = "docker.io/schemaspy"
}

variable "GITHUB_REF_NAME" {
  default = "$GITHUB_REF_NAME"
}

variable "GIT_BRANCH" {
  default = "${GITHUB_REF_NAME}"
}

variable "GITHUB_SHA" {
  default = "$GITHUB_SHA"
}

variable "GIT_REVISION" {
  default = "${GITHUB_SHA}"
}

group "default" {
  targets = [
    "schemaspy"
  ]
}

target "drivers" {
  cache-from = [
    {
      type="gha",
      scope="dkr-drivers"
    }
  ]
  target = "drivers"
  output = ["type=cacheonly"]
  cache-to = [ 
    { 
      type="gha",
      mode="min",
      scope="dkr-drivers"
    }
  ]
}

target "base" {
  cache-from = [
    {
      type="gha",
      scope="dkr-base"
    }
  ]
  target = "base"
  output = ["type=cacheonly"]
  platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7"]
  cache-to = [
    {
      type="gha",
      mode="min",
      scope="dkr-base"
    }
  ]
}

target "schemaspy" {
  cache-from = [
    {
      type="gha",
      scope="dkr-schemaspy"
    }
  ]
  contexts = {
    drivers = "target:drivers"
    base = "target:base"
  }
  labels = {
    "GIT_BRANCH" = "${GIT_BRANCH}"
    "GIT_REVISION" = "${GIT_REVISION}"
  }
  platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7"]
  cache-to = [
    {
      type="gha",
      mode="min",
      scope="dkr-schemaspy"
    }
  ]
}

target "pr" {
  inherits = ["schemaspy"]
    tags = [
      "${REGISTRY}/schemaspy:pr"
    ]
    platforms = ["linux/amd64"]
    output = ["type=docker"]
}

target "snapshot" {
  inherits = ["schemaspy"]
  tags = [
    "${REGISTRY}/schemaspy:snapshot"
  ]
}

target "release" {
  inherits = ["schemaspy"]
  context = "./target/checkout"
  tags = [
    "${REGISTRY}/schemaspy:${VERSION}",
    "${REGISTRY}/schemaspy:latest"
  ]
}
      - name: Set up QEMU (Docker)
        uses: docker/setup-qemu-action@v3
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
        with:
          version: v0.21.1
      - name: Docker Buildx Bake(Temurin-snapshot)
        uses: docker/bake-action@v6
        with:
          source: .
          files: docker-bake.hcl
          push: false
          targets: pr
          set: |
            *.cache-to=""

Build logs

/usr/bin/docker buildx bake --file docker-bake.hcl --set *.cache-to="" --print pr
  #1 [internal] load local bake definitions
  #1 reading docker-bake.hcl 1.78kB / 1.78kB done
  #1 DONE 0.0s
  ERROR: EOF

Additional info

No response

@crazy-max crazy-max added kind/bug Something isn't working area/bake and removed status/triage labels Feb 24, 2025
@crazy-max
Copy link
Member

I'm able to repro as well:

target "default" {
  cache-from = ["type=gha,scope=dkr-drivers"]
  target = "drivers"
  output = ["type=cacheonly"]
  cache-to = ["type=gha,mode=min,scope=dkr-drivers"]
}

With 0.19.3:

$ docker buildx bake --set *.cache-to="" --print
#1 [internal] load local bake definitions
#1 reading docker-bake.hcl 171B / 171B done
#1 DONE 0.0s
{
  "target": {
    "default": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "cache-from": [
        "type=gha,scope=dkr-drivers"
      ],
      "target": "drivers",
      "output": [
        "type=cacheonly"
      ]
    }
  }
}

Current latest:

docker buildx bake --set *.cache-to="" --print
#1 [internal] load local bake definitions
#1 reading docker-bake.hcl 171B / 171B done
#1 DONE 0.0s
ERROR: EOF
exit status 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/bake kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants