-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17c167f
commit d5a5461
Showing
7 changed files
with
2,605 additions
and
7 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
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 |
---|---|---|
@@ -0,0 +1,103 @@ | ||
load("@aspect_bazel_lib//lib:tar.bzl", "tar") | ||
load("@container_structure_test//:defs.bzl", "container_structure_test") | ||
load("@rules_distroless//apt:defs.bzl", "dpkg_status") | ||
load("@rules_distroless//distroless:defs.bzl", "cacerts", "group", "passwd") | ||
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball") | ||
|
||
passwd( | ||
name = "passwd", | ||
entries = [ | ||
{ | ||
"uid": 0, | ||
"gid": 0, | ||
"home": "/root", | ||
"shell": "/bin/bash", | ||
"username": "r00t", | ||
}, | ||
{ | ||
"uid": 100, | ||
"gid": 65534, | ||
"home": "/home/_apt", | ||
"shell": "/usr/sbin/nologin", | ||
"username": "_apt", | ||
}, | ||
], | ||
) | ||
|
||
group( | ||
name = "group", | ||
entries = [ | ||
{ | ||
"name": "root", | ||
"gid": 0, | ||
}, | ||
{ | ||
"name": "_apt", | ||
"gid": 65534, | ||
}, | ||
], | ||
) | ||
|
||
tar( | ||
name = "sh", | ||
mtree = [ | ||
# needed as dpkg assumes sh is installed in a typical debian installation. | ||
"./bin/sh type=link link=/bin/bash", | ||
], | ||
) | ||
|
||
cacerts( | ||
name = "cacerts", | ||
package = "@flat_repository//ca-certificates/amd64:data", | ||
) | ||
|
||
PACKAGES = [ | ||
"@flat_repository//ncurses-base", | ||
"@flat_repository//libncurses6", | ||
"@flat_repository//tzdata", | ||
"@flat_repository//bash", | ||
"@flat_repository//coreutils", | ||
"@flat_repository//dpkg", | ||
"@flat_repository//apt", | ||
"@flat_repository//perl", | ||
"@flat_repository//r-doc-html", | ||
] | ||
|
||
# Creates /var/lib/dpkg/status with installed package information. | ||
dpkg_status( | ||
name = "dpkg_status", | ||
controls = [ | ||
"%s/amd64:control" % package | ||
for package in PACKAGES | ||
], | ||
) | ||
|
||
oci_image( | ||
name = "apt", | ||
architecture = "amd64", | ||
os = "linux", | ||
tars = [ | ||
":sh", | ||
":passwd", | ||
":group", | ||
":dpkg_status", | ||
":cacerts", | ||
] + [ | ||
"%s/amd64" % package | ||
for package in PACKAGES | ||
], | ||
) | ||
|
||
oci_tarball( | ||
name = "tarball", | ||
image = ":apt", | ||
repo_tags = [ | ||
"distroless/test:latest", | ||
], | ||
) | ||
|
||
container_structure_test( | ||
name = "test", | ||
configs = ["test_linux_amd64.yaml"], | ||
image = ":apt", | ||
) |
Oops, something went wrong.