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

Support parsing of the tag even a digest is provided #112

Closed
rcjsuen opened this issue Sep 10, 2023 · 0 comments
Closed

Support parsing of the tag even a digest is provided #112

rcjsuen opened this issue Sep 10, 2023 · 0 comments
Assignees

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Sep 10, 2023

FROM alpine:non-existent-tag@sha256:1fd62556954250bac80d601a196bb7fd480ceba7c10e94dd8fd4c6d1c08783d5
$ docker build .
[+] Building 0.1s (5/5) FINISHED                                                                                                                                                                               docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                                     0.0s
 => => transferring dockerfile: 138B                                                                                                                                                                                     0.0s
 => [internal] load .dockerignore                                                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                                                          0.0s
 => [internal] load metadata for docker.io/library/alpine:non-existent-tag@sha256:1fd62556954250bac80d601a196bb7fd480ceba7c10e94dd8fd4c6d1c08783d5                                                                       0.0s
 => CACHED [1/1] FROM docker.io/library/alpine:non-existent-tag@sha256:1fd62556954250bac80d601a196bb7fd480ceba7c10e94dd8fd4c6d1c08783d5                                                                                  0.0s
 => exporting to image                                                                                                                                                                                                   0.0s
 => => exporting layers                                                                                                                                                                                                  0.0s
 => => writing image sha256:5a2ff9dc5af00d30bd1864bc77b5d83b54f1d06bcee20d99732f6fa72fa43b00

We should return the range of non-existent-tag instead of returning null.

const lib = require("dockerfile-ast");
const instruction = lib.DockerfileParser.parse("FROM alpine:non-existent-tag@sha256:1fd62556954250bac80d601a196bb7fd480ceba7c10e94dd8fd4c6d1c08783d5").getInstructions()[0];
console.log(instruction.getImageTagRange());
null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant