Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions common-npm-packages/docker-common/containerimageutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,11 @@ export function getBaseImageDigestDockerFile(dockerFileContentPath: string): str
var lines = dockerFileContent.split(/[\r?\n]/);
var aliasToImageNameMapping: Map<string, string> = new Map<string, string>();
var baseImage = "";

// Added regex pattern to check line starts with FROM IMAGE
const matchPatternForDockerImage = new RegExp(/^FROM\s+IMAGE/);

for (var i = 0; i < lines.length; i++) {
const currentLine = lines[i].trim();

if (!currentLine.toUpperCase().match(matchPatternForDockerImage)) {
if (!currentLine.toUpperCase().startsWith("FROM")) {
continue;
}
var nameComponents = currentLine.substring(4).toLowerCase().split(" as ");
Expand Down Expand Up @@ -304,7 +301,7 @@ export function getBaseImageDigestDockerFile(dockerFileContentPath: string): str
}
}

return null;
return baseImageData[0];
} catch (error) {
tl.debug(`An error ocurred getting the base image digest. ${error.message}`);
return null;
Expand Down
4 changes: 2 additions & 2 deletions common-npm-packages/docker-common/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common-npm-packages/docker-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azure-pipelines-tasks-docker-common",
"version": "2.254.0",
"version": "2.256.0",
"description": "Common Library for Azure Rest Calls",
"repository": {
"type": "git",
Expand Down
Loading