Skip to content

Commit

Permalink
Merge pull request #1221 from snyk/feat/image-names
Browse files Browse the repository at this point in the history
RUN-2459 feat: pass image id to snyk docker plugin
  • Loading branch information
minsiyang authored Jan 12, 2023
2 parents 94ecbef + ea6ae3c commit ff1fd46
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"child-process-promise": "^2.2.1",
"fs-extra": "^10.1.0",
"lru-cache": "^6.0.0",
"minipass": "3.3.6",
"needle": "^3.0.0",
"sleep-promise": "^9.1.0",
"snyk-config": "5.1.0",
Expand Down
1 change: 1 addition & 0 deletions src/scanner/images/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export async function scanImages(
const pluginResponse = await scan({
path: archivePath,
imageNameAndTag: imageName,
imageNameAndDigest: imageWithDigest,
});

if (
Expand Down
2 changes: 1 addition & 1 deletion src/scanner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function getUniqueImages(workloadMetadata: IWorkload[]): IScanImage[] {

accum[meta.imageName] = {
imageWithDigest: digest && `${imageName}@${digest}`,
imageName: meta.imageName, // Image name with tag
imageName: meta.imageName, // Image name with tag or digest, according to metadata image field declaration
skopeoRepoType: SkopeoRepositoryType.DockerArchive,
};

Expand Down
7 changes: 7 additions & 0 deletions test/system/kind.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,13 @@ test('Kubernetes-Monitor with KinD', async () => {
{ type: 'imageLayers', data: expect.any(Array) },
{ type: 'rootFs', data: expect.any(Array) },
{ type: 'imageOsReleasePrettyName', data: expect.any(String) },
{
type: 'imageNames',
data: [
'docker.io/library/openjdk:latest',
expect.stringContaining('docker.io/library/openjdk@sha256:'),
],
},
]),
target: { image: 'docker-image|docker.io/library/openjdk' },
identity: { type: 'rpm', args: { platform: 'linux/amd64' } },
Expand Down
2 changes: 1 addition & 1 deletion test/unit/scanner/images.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('getImageParts()', () => {
.imageName,
).toEqual('kind-registry:5000/python-27');
});
it('removed repository/image:tag contining dashes', () => {
it('removed repository/image:tag continuing dashes', () => {
expect(
scannerImages.getImageParts(
'kind-registry:5000/test/python-27:rc-buster',
Expand Down

0 comments on commit ff1fd46

Please sign in to comment.