Skip to content

DL3029: Improve BUILDPLATFORM/TARGETPLATFORM exceptions #861

@maxbrunet

Description

@maxbrunet
  • This is a bug report
  • This is a feature request
  • I searched existing issues before opening this one

Expected behavior

These cases should be allowed:

  • --platform=$TARGETPLATFORM
  • --platform="$BUILDPLATFORM"
  • --platform=${BUILDPLATFORM}
  • --platform=${BUILDPLATFORM:-}
  • --platform="${BUILDPLATFORM:-}"

Actual behavior

The rule only checks for a literal $BUILDPLATFORM, adding braces, quotes, parameter expansions... or using TARGETPLATFORM results in:

DL3029 warning: Do not use --platform flag with FROM

Steps to reproduce the behavior

Use FROM --platform="${TARGETPLATFORM:-linux/amd64}" and run hadolint.

Dockerfile (if relevant)

FROM --platform="${TARGETPLATFORM:-linux/amd64}" docker.io/library/busybox

Additional environment details (OS, stack version, etc.)

Follow up to #772

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions