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

Variable resolution is wrong for ARG variables used in a FROM #22

Closed
rcjsuen opened this issue Apr 15, 2018 · 0 comments
Closed

Variable resolution is wrong for ARG variables used in a FROM #22

rcjsuen opened this issue Apr 15, 2018 · 0 comments
Assignees
Labels

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Apr 15, 2018

The variable resolution code currently always scopes itself to the build stage that the instruction is in. However, in the case of a FROM, it needs to try to resolve itself with the ARG variables that are defined at the beginning of the dockerfile.

import { DockerfileParser } from 'dockerfile-ast';

const content =
`ARG tag=8
FROM node:$tag`

let dockerfile = DockerfileParser.parse(content);
let variables = dockerfile.getAvailableVariables(1);
// this will print out undefined instead of 8
console.log(dockerfile.resolveVariable("tag", 1));
@rcjsuen rcjsuen added the bug label Apr 15, 2018
@rcjsuen rcjsuen self-assigned this Apr 15, 2018
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