From 5b00df950460dec00915aa19710104043c02a5d3 Mon Sep 17 00:00:00 2001 From: Dima R <90623914+cx-dmitri-rivin@users.noreply.github.com> Date: Sun, 20 Jul 2025 17:01:57 +0300 Subject: [PATCH 1/2] version of types 1.0.8 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f43fd23..0b57f7d 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/Checkmarx/containers-images-extractor go 1.24.1 require ( - github.com/Checkmarx/containers-types v1.0.7 + github.com/Checkmarx/containers-types v1.0.8 github.com/rs/zerolog v1.34.0 gopkg.in/yaml.v3 v3.0.1 helm.sh/helm/v3 v3.17.3 diff --git a/go.sum b/go.sum index 6ae1995..e9aa4d7 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c h1:udKWzYgxTojEK github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/Checkmarx/containers-types v1.0.7 h1:SZUB8S//yFc1WlgLbw33conN5eR9CLv+DTewxMGVp7M= -github.com/Checkmarx/containers-types v1.0.7/go.mod h1:KR0w8XCosq3+6jRCfQrH7i//Nj2u11qaUJM62CREFZA= +github.com/Checkmarx/containers-types v1.0.8 h1:8zUhhqmODJSpcLFcFNk1OoHdw7bbj8PdQsBghbmLP08= +github.com/Checkmarx/containers-types v1.0.8/go.mod h1:KR0w8XCosq3+6jRCfQrH7i//Nj2u11qaUJM62CREFZA= github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU= github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= From b189be278f3b5b5b2b0550c61d383a364995ec42 Mon Sep 17 00:00:00 2001 From: Dima R <90623914+cx-dmitri-rivin@users.noreply.github.com> Date: Sun, 20 Jul 2025 17:17:41 +0300 Subject: [PATCH 2/2] tests fix --- pkg/imagesExtractor/files_extractor_test.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/imagesExtractor/files_extractor_test.go b/pkg/imagesExtractor/files_extractor_test.go index 0fd1207..47e73f7 100644 --- a/pkg/imagesExtractor/files_extractor_test.go +++ b/pkg/imagesExtractor/files_extractor_test.go @@ -39,10 +39,10 @@ func TestExtractAndMergeImagesFromFiles(t *testing.T) { }, }, UserInput: []types.ImageModel{ - {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.NoFilePath}}}, + {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.CustomImages}}}, }, ExpectedImages: []types.ImageModel{ - {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.NoFilePath, Line: 0, StartIndex: 0, EndIndex: 0}}}, + {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.CustomImages, Line: 0, StartIndex: 0, EndIndex: 0}}}, {Name: "mcr.microsoft.com/dotnet/sdk:6.0", ImageLocations: []types.ImageLocation{{Origin: types.DockerFileOrigin, Path: "Dockerfile", FinalStage: false, Line: 1, StartIndex: 5, EndIndex: 37}}}, {Name: "mcr.microsoft.com/dotnet/aspnet:6.0", ImageLocations: []types.ImageLocation{{Origin: types.DockerFileOrigin, Path: "Dockerfile", FinalStage: true, Line: 25, StartIndex: 5, EndIndex: 40}}}, {Name: "buildimage:latest", ImageLocations: []types.ImageLocation{{Origin: types.DockerComposeFileOrigin, Path: "docker-compose1.yml", Line: 0, StartIndex: 0, EndIndex: 0}}}, @@ -61,11 +61,11 @@ func TestExtractAndMergeImagesFromFiles(t *testing.T) { }, }, UserInput: []types.ImageModel{ - {Name: "mcr.microsoft.com/dotnet/sdk:6.0", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.NoFilePath, Line: 1, StartIndex: 5, EndIndex: 37}}}, + {Name: "mcr.microsoft.com/dotnet/sdk:6.0", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.CustomImages, Line: 1, StartIndex: 5, EndIndex: 37}}}, }, ExpectedImages: []types.ImageModel{ {Name: "mcr.microsoft.com/dotnet/sdk:6.0", ImageLocations: []types.ImageLocation{ - {Origin: types.UserInput, Path: types.NoFilePath, Line: 1, StartIndex: 5, EndIndex: 37}, + {Origin: types.UserInput, Path: types.CustomImages, Line: 1, StartIndex: 5, EndIndex: 37}, {Origin: types.DockerFileOrigin, Path: "Dockerfile", Line: 1, StartIndex: 5, EndIndex: 37}, {Origin: types.DockerComposeFileOrigin, Path: "docker-compose-4.yml", Line: 0, StartIndex: 0, EndIndex: 0}, }}, @@ -80,12 +80,12 @@ func TestExtractAndMergeImagesFromFiles(t *testing.T) { }, }, UserInput: []types.ImageModel{ - {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.NoFilePath}}}, + {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.CustomImages}}}, }, ExpectedImages: []types.ImageModel{ {Name: "mcr.microsoft.com/dotnet/sdk:6.0", ImageLocations: []types.ImageLocation{{Origin: types.DockerFileOrigin, Path: "Dockerfile", FinalStage: false, Line: 1, StartIndex: 5, EndIndex: 37}}}, {Name: "mcr.microsoft.com/dotnet/aspnet:6.0", ImageLocations: []types.ImageLocation{{Origin: types.DockerFileOrigin, Path: "Dockerfile", FinalStage: true, Line: 25, StartIndex: 5, EndIndex: 40}}}, - {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.NoFilePath, Line: 0, StartIndex: 0, EndIndex: 0}}}}, + {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.CustomImages, Line: 0, StartIndex: 0, EndIndex: 0}}}}, }, { Name: "OnlyDockerComposeFound", @@ -95,11 +95,11 @@ func TestExtractAndMergeImagesFromFiles(t *testing.T) { }, }, UserInput: []types.ImageModel{ - {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.NoFilePath}}}, + {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.CustomImages}}}, }, ExpectedImages: []types.ImageModel{ {Name: "mcr.microsoft.com/dotnet/sdk:6.0", ImageLocations: []types.ImageLocation{{Origin: types.DockerComposeFileOrigin, Path: "docker-compose-4.yml", Line: 0, StartIndex: 0, EndIndex: 0}}}, - {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.NoFilePath, Line: 0, StartIndex: 0, EndIndex: 0}}}, + {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.CustomImages, Line: 0, StartIndex: 0, EndIndex: 0}}}, }, }, { @@ -115,10 +115,10 @@ func TestExtractAndMergeImagesFromFiles(t *testing.T) { }, }, UserInput: []types.ImageModel{ - {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.NoFilePath}}}, + {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.CustomImages}}}, }, ExpectedImages: []types.ImageModel{ - {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.NoFilePath, Line: 0, StartIndex: 0, EndIndex: 0}}}, + {Name: "debian:11", ImageLocations: []types.ImageLocation{{Origin: types.UserInput, Path: types.CustomImages, Line: 0, StartIndex: 0, EndIndex: 0}}}, {Name: "checkmarx.jfrog.io/ast-docker/containers-worker:b201b1f", ImageLocations: []types.ImageLocation{{Origin: types.HelmFileOrigin, Path: "containers/templates/containers-worker.yaml", Line: 0, StartIndex: 0, EndIndex: 0}}}, {Name: "checkmarx.jfrog.io/ast-docker/image-insights:f4b507b", ImageLocations: []types.ImageLocation{{Origin: types.HelmFileOrigin, Path: "containers/templates/image-insights.yaml", Line: 0, StartIndex: 0, EndIndex: 0}}}, },