Skip to content

Commit

Permalink
Fix #120 Correct link range if image has a tag and digest
Browse files Browse the repository at this point in the history
This was fixed in 0.11.0 but no regression test was added so one will be
added now.

CHANGELOG.md is also retroactively being corrected to include this as
one of the fixes included in 0.11.0. Note that the Git tag itself of
course will not change and will continue to point at
a7e1c23 which was what was used to
release 0.11.0 to npm.

Signed-off-by: Remy Suen <[email protected]>
  • Loading branch information
rcjsuen committed Sep 10, 2023
1 parent a7e1c23 commit 9b647d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ All notable changes to this project will be documented in this file.
- flag empty tag specified with a digest in FROM instructions as an error ([rcjsuen/dockerfile-utils#118](https://github.com/rcjsuen/dockerfile-utils/issues/118))
- ignore predefined platform ARG variables if they are used as a base image ([rcjsuen/dockerfile-utils#119](https://github.com/rcjsuen/dockerfile-utils/issues/119))

### Fixed
- correct link range calculation if tag provided with a digest ([#120](https://github.com/rcjsuen/dockerfile-language-service/issues/120))

## [0.10.2] - 2023-06-01
### Fixed
- ignore quotes in comments if it's within an embedded argument with CRLF used as a newline delimiter ([#113](https://github.com/rcjsuen/dockerfile-language-service/issues/113))
Expand Down
8 changes: 8 additions & 0 deletions test/dockerLinks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ describe("Dockerfile links", function () {
links[0] = service.resolveLink(links[0]);
assertLink(links[0], "https://hub.docker.com/r/microsoft/dotnet/", "r/microsoft/dotnet/", 0, 5, 0, 21);
});

it("FROM microsoft/dotnet:non-existent-tag@sha256:5483e2b609c0f66c3ebd96666de7b0a74537613b43565879ecb0d0a73e845d7d", () => {
const links = service.computeLinks("FROM microsoft/dotnet:non-existent-tag@sha256:5483e2b609c0f66c3ebd96666de7b0a74537613b43565879ecb0d0a73e845d7d");
assert.strictEqual(links.length, 1);
assertLink(links[0], undefined, "r/microsoft/dotnet/", 0, 5, 0, 21);
links[0] = service.resolveLink(links[0]);
assertLink(links[0], "https://hub.docker.com/r/microsoft/dotnet/", "r/microsoft/dotnet/", 0, 5, 0, 21);
});
});

describe("build stages", function () {
Expand Down

0 comments on commit 9b647d6

Please sign in to comment.