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

feat: Add option to update all packages without scanner input. #548

Merged
merged 33 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
41eb7e0
debian and alpine changes for updating all pacakges
ashnamehrotra Mar 26, 2024
b1dc802
saving rpm changes
ashnamehrotra Mar 26, 2024
2a4d51f
comment out debugging
ashnamehrotra Mar 26, 2024
3654a00
cleanup
ashnamehrotra Mar 26, 2024
e78c054
cleanup
ashnamehrotra Mar 26, 2024
07f34ab
remove platform from config and set as nil, get host platform for rpm…
ashnamehrotra Mar 27, 2024
4c063fa
Merge branch 'main' of github.com:project-copacetic/copacetic into pa…
ashnamehrotra Mar 27, 2024
1ce4400
run go mod tidy
ashnamehrotra Mar 27, 2024
f7dc3aa
cleanup and add --update-all flag
ashnamehrotra Mar 27, 2024
091ad69
clean up
ashnamehrotra Mar 27, 2024
4aafbb6
remove unused manifest parameter in IntializeBuildkitConfig
ashnamehrotra Mar 27, 2024
8c2ee14
remove unit test for required report flag
ashnamehrotra Mar 27, 2024
ef4cd8a
get platform for tooling image dpkg
ashnamehrotra Mar 28, 2024
dbad0f9
add unit test getOSType
ashnamehrotra Mar 28, 2024
ceaa1b2
change integration test to take in --update-all flag
ashnamehrotra Mar 28, 2024
3feefc2
add step to run integration tests with --update-all enabled
ashnamehrotra Mar 28, 2024
13fc3e8
clean up
ashnamehrotra Mar 28, 2024
ee5b387
omit Platform: nil
ashnamehrotra Mar 28, 2024
299ea33
wrap errors
ashnamehrotra Mar 28, 2024
76473e7
remove updateAll flag
ashnamehrotra Mar 28, 2024
a1351ed
add unit tests for all os
ashnamehrotra Mar 28, 2024
4ceb28f
fix integration test
ashnamehrotra Mar 28, 2024
cd23e75
cleanup
ashnamehrotra Mar 28, 2024
9dee20f
fix integration test
ashnamehrotra Mar 28, 2024
c065478
integration test changes
ashnamehrotra Apr 1, 2024
c684c30
Merge branch 'main' of github.com:project-copacetic/copacetic into pa…
ashnamehrotra Apr 1, 2024
9351b22
test non-distroless for no report input
ashnamehrotra Apr 2, 2024
db021d9
lint fix
ashnamehrotra Apr 2, 2024
02cf1a9
dont call withSkipDBUpdate if no report
ashnamehrotra Apr 2, 2024
cd93321
set ignoreErrors to false for no report test
ashnamehrotra Apr 2, 2024
8b35d0f
patch test fixes
ashnamehrotra Apr 2, 2024
a8fe060
add apt clean and apt autoremove in dpkg
ashnamehrotra Apr 2, 2024
4f897df
Merge branch 'main' of github.com:project-copacetic/copacetic into pa…
ashnamehrotra Apr 2, 2024
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
92 changes: 92 additions & 0 deletions integration/fixtures/test-images-non-distroless.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
[
{
"image": "docker.io/grafana/grafana",
"tag": "8.5.0",
"digest": "sha256:42d3e6bc186572245aded5a0be381012adba6d89355fa9486dd81b0c634695b5",
"distro": "Alpine",
"description": "Valid apk/db, apk present",
"ignoreErrors": false
},
{
"image": "docker.io/grafana/grafana",
"tag": "8.5.0",
"localName": "registry.copacetic.test/repo/image:tag",
"digest": "sha256:42d3e6bc186572245aded5a0be381012adba6d89355fa9486dd81b0c634695b5",
"distro": "Alpine",
"description": "Valid apk/db, apk present, locally tagged with fully-qualified name",
"ignoreErrors": false
},
{
"image": "docker.io/library/nginx",
"tag": "1.21.6",
"digest": "sha256:2bcabc23b45489fb0885d69a06ba1d648aeda973fae7bb981bafbb884165e514",
"distro": "Debian",
"description": "Valid dpkg/status, apt present",
"ignoreErrors": false
},
{
"image": "docker.io/library/nginx",
"tag": "1.21.6",
"digest": "sha256:2bcabc23b45489fb0885d69a06ba1d648aeda973fae7bb981bafbb884165e514",
"localName": "local/image:tag",
"distro": "Debian",
"description": "Valid dpkg/status, apt present, locally tagged with repo and image name",
"ignoreErrors": false
},
{
"image": "registry.k8s.io/kube-proxy",
"tag": "v1.23.4",
"digest": "sha256:30116c7218264d95623d3918a50da703675755cae866cd4c324586611fcd50ea",
"distro": "Debian",
"description": "Valid dpkg/status, apt present, custom network config",
"ignoreErrors": false
},
{
"image": "quay.io/calico/cni",
"tag": "v3.15.1",
"digest": "sha256:a925b445c2688fc9c149b20ea04faabd40610d3304a6efda68e5dada7a41b813",
"distro": "Redhat",
"description": "Valid rpm DB, microdnf & rpm present",
"ignoreErrors": false
},
{
"image": "mcr.microsoft.com/cbl-mariner/base/core",
"tag": "2.0.20240112",
"digest": "sha256:60323975ec3aabe1840920a65237950a54c5fef6ffc811a5d26bb6bd130f1cc3",
"distro": "Mariner",
"description": "Valid rpm DB, no dnf, yum & rpm present",
"ignoreErrors": false
},
{
"image": "mcr.microsoft.com/cbl-mariner/base/core",
"tag": "2.0.20240112-arm64",
"digest": "sha256:c85680df0ddccfd5bf0cd60ff7d0c07b0ea783bcee9ce5dc748b68c0d36e280a",
"distro": "Mariner",
"description": "Valid rpm DB, no dnf, yum & rpm present, arm64 cross-arch",
"ignoreErrors": false
},
{
"image": "docker.io/library/centos",
"tag": "7.6.1810",
"digest": "sha256:62d9e1c2daa91166139b51577fe4f4f6b4cc41a3a2c7fc36bd895e2a17a3e4e6",
"distro": "CentOS",
"description": "Valid rpm DB, yum present",
"ignoreErrors": false
},
{
"image": "docker.io/library/amazonlinux",
"tag": "2.0.20210326.0",
"digest": "sha256:06380711d6a8ac0b6989f7e2a4419e560796791d9c7c843753a719c73552dc30",
"distro": "Amazon Linux",
"description": "Valid rpm DB, yum present",
"ignoreErrors": false
},
{
"image": "docker.io/grafana/grafana-image-renderer",
"tag" : "3.4.0",
"digest": "sha256:205a39f5b58f96b9ff81a0b523a60c26c86e88e76575696fcd6debde9de02197",
"distro": "Alpine",
"description": "Valid apk/db, apk present, fail to patch libssl/libcryto",
"ignoreErrors": true
sozercan marked this conversation as resolved.
Show resolved Hide resolved
}
]
22 changes: 18 additions & 4 deletions integration/patch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ import (
)

var (
//go:embed fixtures/test-images.json
testImages []byte

//go:embed fixtures/trivy_ignore.rego
trivyIgnore []byte
)
Expand All @@ -37,8 +34,25 @@ type testImage struct {
}

func TestPatch(t *testing.T) {
var file []byte
var err error

// test distroless and non-distroelsss
sozercan marked this conversation as resolved.
Show resolved Hide resolved
if reportFile {
file, err = os.ReadFile("fixtures/test-images.json")
if err != nil {
t.Error("Unable to read test-images", err)
}
} else {
// only test distroless
sozercan marked this conversation as resolved.
Show resolved Hide resolved
file, err = os.ReadFile("fixtures/test-images-non-distroless.json")
if err != nil {
t.Error("Unable to read test-images", err)
}
}

var images []testImage
err := json.Unmarshal(testImages, &images)
err = json.Unmarshal(file, &images)
require.NoError(t, err)

tmp := t.TempDir()
Expand Down
Loading