Skip to content

DL3061: fix false positive on pragmas#797

Merged
lorenzo merged 1 commit intohadolint:masterfrom
m-ildefons:dl3061-pragma-fix
Mar 18, 2022
Merged

DL3061: fix false positive on pragmas#797
lorenzo merged 1 commit intohadolint:masterfrom
m-ildefons:dl3061-pragma-fix

Conversation

@m-ildefons
Copy link
Copy Markdown
Member

  • Fix false positive error DL3061 when encountering a pragma before a
    FROM instruction.

In particular # syntax = docker/dockerfile... but also # shell = ...
pragmas can appear before the first FROM instruction without error.

fixes: #795

How to verify it

This should no longer produce false positive error DL3061 messages:

# syntax = docker/dockerfile:1.0-experimental

FROM node:16-alpine3.13 AS builder
WORKDIR /app
COPY ./package*.json ./

Thanks to @aaronfi-procore and @subodhdharma for reporting this issue.

- Fix false positive error DL3061 when encountering a pragma before a
  `FROM` instruction.

In particular `# syntax = docker/dockerfile...` but also `# shell = ...`
pragmas can appear before the first `FROM` instruction without error.

fixes: hadolint#795
@lorenzo
Copy link
Copy Markdown
Member

lorenzo commented Mar 18, 2022

thanks!

@lorenzo lorenzo merged commit 2f1ab2c into hadolint:master Mar 18, 2022
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

Successfully merging this pull request may close these issues.

Validation fail with DL3061 error when Dockerfile begin with comment that start with 'syntax'

2 participants