crashappsec / chalk

Chalk allows you to follow code from development, through builds and into production.
https://crashoverride.com/
GNU General Public License v3.0
348 stars 15 forks source link

fix(docker): fixing --metadata-file support #357

Closed miki725 closed 3 months ago

miki725 commented 3 months ago

Issue

chalk build fails due to invalid --metadata-file flag.

Description

In older docker versions, as docker build is not an alias to docker buildx build, --metadata-file flag is not supported. It only works when explicitly using docker buildx build in which case 0.6.0 is required which added that flag. Otherwise docker version needs to be >=22 which aliased build to buildx build as well as have supported buildx version.

No easy way of testing it in CI but tested locally various combination of versions.

Testing

Was running something like:

➜ echo '
  FROM docker:22.06-rc
  COPY --from=docker/buildx-bin:0.6.0 /buildx /usr/lib/docker/cli-plugins/docker-buildx
  COPY --from=docker/buildx-bin:0.6.0 /buildx /usr/local/libexec/docker/cli-plugins/docker-buildx
  ' | docker build -f - . -t dockerbuildx
  and docker run -it --rm dockerbuildx docker --version
  and docker run -it --rm dockerbuildx buildx version
  and docker run -it --rm dockerbuildx build --help
  and docker run -it --rm dockerbuildx buildx build --help