Skip to content

Regression in handling of empty lists on command line #2858

Closed
@amarburg

Description

@amarburg

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

Between v0.18.0 and v0.19.2, handling of null-values for keys from the command line changed, breaking existing configurations.

Expected behaviour

We have a docker-bake.yaml which sets the cache-to key:

target "default" {
  cache_to = [
    "type=local,dest=.docker-cache"
  ]
}

In some circumstances (some Github workflow builds, for example) we want to not cache the results. We would do this with:

$ docker buildx bake --set "*.cache-to="

(or the equivalent through the docker/bake-action workflow action).

The expected behavior is:

# Default bakefile
$ docker buildx bake --print

target "default" {
  cache_to = [
    "type=local,dest=.docker-cache"
  ]
}


# Bakefile without cache
$ docker buildx bake --print --set "*.cache="

target "default" {
  cache_to = []
}

Actual behaviour

Actual behavior:

# Bakefile without cache
> docker buildx bake --print --set "*.cache-to="
[+] Building 0.0s (1/1) FINISHED
 => [internal] load local bake definitions                                                                                    0.0s
 => => reading docker-bake.hcl 77B / 77B                                                                                      0.0s
ERROR: EOF

Buildx version

github.com/docker/buildx v0.19.2 1fc5647

Docker info

Client: Docker Engine - Community
 Version:    27.4.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.19.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.31.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Builders list

NAME/NODE                DRIVER/ENDPOINT                   STATUS    BUILDKIT   PLATFORMS
container-builder*       docker-container
 \_ container-builder0    \_ unix:///var/run/docker.sock   running   v0.17.1    linux/amd64 (+3), linux/arm64, linux/arm (+2), linux/ppc64le, (4 more)
default                  docker
 \_ default               \_ default                       running   v0.17.3    linux/amd64 (+3), linux/arm64, linux/arm (+2), linux/ppc64le, (4 more)

Configuration

FROM alpine
target "default" {
  cache_to = [
    "type=local,dest=.docker-cache"
  ]
}
$ docker buildx bake
$ docker buildx bake --set "*.cache-to="

Build logs


Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions