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

ARG and ENV instructions do not ignore comments correctly #80

Closed
rcjsuen opened this issue Jun 17, 2020 · 0 comments
Closed

ARG and ENV instructions do not ignore comments correctly #80

rcjsuen opened this issue Jun 17, 2020 · 0 comments
Assignees
Labels

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Jun 17, 2020

ARG \
# comment
var=value
ENV \
# comment
var=value
import { DockerfileParser, PropertyInstruction } from 'dockerfile-ast';

let dockerfile = DockerfileParser.parse("ENV \\\n# comment");
let instruction = dockerfile.getInstructions()[0];
let properties = (instruction as PropertyInstruction).getProperties();
console.log(properties.length);

dockerfile = DockerfileParser.parse("ENV \\\n# comment\nvar=value");
instruction = dockerfile.getInstructions()[0];
properties = (instruction as PropertyInstruction).getProperties();
console.log(properties.length);
console.log(properties[0].getName());

dockerfile = DockerfileParser.parse("ARG \\\n# comment");
instruction = dockerfile.getInstructions()[0];
properties = (instruction as PropertyInstruction).getProperties();
console.log(properties.length);

dockerfile = DockerfileParser.parse("ARG \\\n# comment\nvar=value");
instruction = dockerfile.getInstructions()[0];
properties = (instruction as PropertyInstruction).getProperties();
console.log(properties.length);
console.log(properties[0].getName());

We should expect the first scenario to not have any properties and the second to have a property with a name of var. This is not the case though.

1
1
#
1
1
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant