Skip to content
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

Containerfile parameter expansion syntax not parsed correctly #994

Open
2 of 3 tasks
sanmai-NL opened this issue Dec 21, 2023 · 0 comments
Open
2 of 3 tasks

Containerfile parameter expansion syntax not parsed correctly #994

sanmai-NL opened this issue Dec 21, 2023 · 0 comments

Comments

@sanmai-NL
Copy link

sanmai-NL commented Dec 21, 2023

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

A feature of Dockerfile syntax (1.6.0) is shell parameter expansion. In Docker Engine, Podman and nerdctl, these can be used to, e.g., fail a build when a build arg is unset ({VAR?} or when empty or unset {VAR:?}). I haven't found documentation for the feature by Docker Inc.

Expected behavior

Shell parameter expansions are parsed. For Hadolint, I presume this requires at minimum expanding the grammar/parser, without doing anything with the semantics.

Actual behavior

Shell parameter expansions not parsed, resulting in fatal failure.

Steps to reproduce the behavior

$ hadolint Containerfile

Containerfile:5:31 unexpected ':' expecting '@', '\', a new line followed by the next instruction, or the image tag

Output of hadolint --version or
docker run --rm hadolint/hadolint hadolint --version or
docker run --rm ghcr.io/hadolint/hadolint hadolint --version:

Haskell Dockerfile Linter 2.12.0

Dockerfile (if relevant)

# syntax=docker.io/docker/dockerfile:1@sha256:ac85f380a63b13dfcefa89046420e1781752bab202122f8f50032edf31be0021
ARG IMAGE_PREFIX=
ARG DISTRO=alpine
ARG VERSION_DISTRO=3.19
FROM ${IMAGE_PREFIX:?}${DISTRO:?}:${VERSION_DISTRO:?}

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

@sanmai-NL sanmai-NL changed the title Dockerfile variable expansion syntax not parsed correctly Containerfile parameter expansion syntax not parsed correctly Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant