-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(debian): take installed files from the origin layer (#6849)
Signed-off-by: knqyf263 <[email protected]> Co-authored-by: DmitriyLewen <[email protected]>
- Loading branch information
1 parent
cf5aa33
commit 089b953
Showing
2 changed files
with
193 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -843,6 +843,188 @@ func TestApplyLayers(t *testing.T) { | |
}, | ||
}, | ||
}, | ||
{ | ||
name: "happy path with filling system files for debian packages", | ||
inputLayers: []types.BlobInfo{ | ||
{ | ||
SchemaVersion: 2, | ||
DiffID: "sha256:cdd7c73923174e45ea648d66996665c288e1b17a0f45efdbeca860f6dafdf731", | ||
OS: types.OS{ | ||
Family: "ubuntu", | ||
Name: "24.04", | ||
}, | ||
PackageInfos: []types.PackageInfo{ | ||
{ | ||
FilePath: "var/lib/dpkg/status", | ||
Packages: types.Packages{ | ||
{ | ||
ID: "[email protected]", | ||
Name: "apt", | ||
Version: "2.4.9", | ||
Arch: "amd64", | ||
SrcName: "apt", | ||
SrcVersion: "2.4.9", | ||
InstalledFiles: []string{ | ||
"/etc/apt/apt.conf.d/01-vendor-ubuntu", | ||
"/etc/apt/apt.conf.d/01autoremove", | ||
"/etc/apt/auth.conf.d", | ||
"/etc/apt/keyrings", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
// Install `curl` | ||
{ | ||
SchemaVersion: 2, | ||
DiffID: "sha256:faf30fa9c41c10f93b3b134d7b2c16e07753320393e020c481f0c97d10db067d", | ||
PackageInfos: []types.PackageInfo{ | ||
{ | ||
FilePath: "var/lib/dpkg/status", | ||
Packages: types.Packages{ | ||
{ | ||
ID: "[email protected]", | ||
Name: "apt", | ||
Version: "2.4.9", | ||
Arch: "amd64", | ||
SrcName: "apt", | ||
SrcVersion: "2.4.9", | ||
}, | ||
{ | ||
ID: "[email protected]", | ||
Name: "curl", | ||
Version: "8.5.0", | ||
Release: "2ubuntu10.1", | ||
Arch: "arm64", | ||
SrcName: "curl", | ||
SrcVersion: "8.5.0", | ||
SrcRelease: "2ubuntu10.1", | ||
InstalledFiles: []string{ | ||
"/usr/bin/curl", | ||
"/usr/share/doc/curl/README.Debian", | ||
"/usr/share/doc/curl/changelog.Debian.gz", | ||
"/usr/share/doc/curl/copyright", | ||
"/usr/share/man/man1/curl.1.gz", | ||
"/usr/share/zsh/vendor-completions/_curl", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
// Upgrade `apt` | ||
{ | ||
SchemaVersion: 2, | ||
DiffID: "sha256:440e26edc0eb9b4fee6e1d40d8af9eb59500d38e25edfc5d5302c55f59394c1e", | ||
PackageInfos: []types.PackageInfo{ | ||
{ | ||
FilePath: "var/lib/dpkg/status", | ||
Packages: types.Packages{ | ||
{ | ||
ID: "[email protected]", | ||
Name: "apt", | ||
Version: "2.4.12", | ||
Arch: "amd64", | ||
SrcName: "apt", | ||
SrcVersion: "2.4.12", | ||
InstalledFiles: []string{ | ||
"/etc/apt/apt.conf.d/01-vendor-ubuntu", | ||
"/etc/apt/apt.conf.d/01autoremove", | ||
"/etc/apt/auth.conf.d", | ||
"/etc/apt/keyrings", | ||
"/usr/share/man/it/man5/sources.list.5.gz", | ||
}, | ||
}, | ||
{ | ||
ID: "[email protected]", | ||
Name: "curl", | ||
Version: "8.5.0", | ||
Release: "2ubuntu10.1", | ||
Arch: "arm64", | ||
SrcName: "curl", | ||
SrcVersion: "8.5.0", | ||
SrcRelease: "2ubuntu10.1", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
// Remove curl | ||
{ | ||
SchemaVersion: 2, | ||
DiffID: "sha256:cb04e1d437de723d8d04bc7df89dc42271530c5f8ea1724c6072e3f0e7d6d38a", | ||
WhiteoutFiles: []string{ | ||
"usr/bin/curl", | ||
"usr/share/doc/curl", | ||
"usr/share/zsh", | ||
"var/lib/dpkg/info/curl.list", | ||
"var/lib/dpkg/info/curl.md5sums", | ||
}, | ||
PackageInfos: []types.PackageInfo{ | ||
{ | ||
FilePath: "var/lib/dpkg/status", | ||
Packages: types.Packages{ | ||
{ | ||
ID: "[email protected]", | ||
Name: "apt", | ||
Version: "2.4.12", | ||
Arch: "amd64", | ||
SrcName: "apt", | ||
SrcVersion: "2.4.12", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
want: types.ArtifactDetail{ | ||
OS: types.OS{ | ||
Family: "ubuntu", | ||
Name: "24.04", | ||
}, | ||
Packages: types.Packages{ | ||
{ | ||
ID: "[email protected]", | ||
Name: "apt", | ||
Version: "2.4.12", | ||
Arch: "amd64", | ||
SrcName: "apt", | ||
SrcVersion: "2.4.12", | ||
|
||
Identifier: types.PkgIdentifier{ | ||
UID: "80bc98a8f3159db9", | ||
PURL: &packageurl.PackageURL{ | ||
Type: packageurl.TypeDebian, | ||
Namespace: "ubuntu", | ||
Name: "apt", | ||
Version: "2.4.12", | ||
Qualifiers: packageurl.Qualifiers{ | ||
{ | ||
Key: "arch", | ||
Value: "amd64", | ||
}, | ||
{ | ||
Key: "distro", | ||
Value: "ubuntu-24.04", | ||
}, | ||
}, | ||
}, | ||
}, | ||
Layer: types.Layer{ | ||
DiffID: "sha256:440e26edc0eb9b4fee6e1d40d8af9eb59500d38e25edfc5d5302c55f59394c1e", | ||
}, | ||
InstalledFiles: []string{ | ||
"/etc/apt/apt.conf.d/01-vendor-ubuntu", | ||
"/etc/apt/apt.conf.d/01autoremove", | ||
"/etc/apt/auth.conf.d", | ||
"/etc/apt/keyrings", | ||
"/usr/share/man/it/man5/sources.list.5.gz", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: "happy path, opaque dirs with the trailing slash", | ||
inputLayers: []types.BlobInfo{ | ||
|